summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-admin
diff options
context:
space:
mode:
Diffstat (limited to 'wp-inst/wp-admin')
-rw-r--r--wp-inst/wp-admin/admin-db.php90
-rw-r--r--wp-inst/wp-admin/admin-footer.php13
-rw-r--r--wp-inst/wp-admin/admin-functions.php1398
-rw-r--r--wp-inst/wp-admin/admin-header.php104
-rw-r--r--wp-inst/wp-admin/admin.php69
-rw-r--r--wp-inst/wp-admin/bookmarklet.php108
-rw-r--r--wp-inst/wp-admin/categories.php167
-rw-r--r--wp-inst/wp-admin/dbx-key.js44
-rw-r--r--wp-inst/wp-admin/dbx.js6
-rw-r--r--wp-inst/wp-admin/edit-comments.php171
-rw-r--r--wp-inst/wp-admin/edit-form-advanced.php212
-rw-r--r--wp-inst/wp-admin/edit-form-comment.php89
-rw-r--r--wp-inst/wp-admin/edit-form.php76
-rw-r--r--wp-inst/wp-admin/edit-page-form.php160
-rw-r--r--wp-inst/wp-admin/edit-pages.php52
-rw-r--r--wp-inst/wp-admin/edit.php291
-rw-r--r--wp-inst/wp-admin/import-b2.php247
-rw-r--r--wp-inst/wp-admin/import-blogger.php207
-rw-r--r--wp-inst/wp-admin/import-greymatter.php315
-rw-r--r--wp-inst/wp-admin/import-livejournal.php124
-rw-r--r--wp-inst/wp-admin/import-mt.php418
-rw-r--r--wp-inst/wp-admin/import-rss.php191
-rw-r--r--wp-inst/wp-admin/import-textpattern.php138
-rw-r--r--wp-inst/wp-admin/index.php154
-rw-r--r--wp-inst/wp-admin/install-helper.php152
-rw-r--r--wp-inst/wp-admin/install.php218
-rw-r--r--wp-inst/wp-admin/link-add.php272
-rw-r--r--wp-inst/wp-admin/link-categories.php453
-rw-r--r--wp-inst/wp-admin/link-import.php131
-rw-r--r--wp-inst/wp-admin/link-manager.php755
-rw-r--r--wp-inst/wp-admin/link-parse-opml.php65
-rw-r--r--wp-inst/wp-admin/menu-header.php58
-rw-r--r--wp-inst/wp-admin/menu.php67
-rw-r--r--wp-inst/wp-admin/moderation.php220
-rw-r--r--wp-inst/wp-admin/options-discussion.php100
-rw-r--r--wp-inst/wp-admin/options-general.php91
-rw-r--r--wp-inst/wp-admin/options-head.php24
-rw-r--r--wp-inst/wp-admin/options-misc.php46
-rw-r--r--wp-inst/wp-admin/options-permalink.php116
-rw-r--r--wp-inst/wp-admin/options-reading.php63
-rw-r--r--wp-inst/wp-admin/options-writing.php101
-rw-r--r--wp-inst/wp-admin/options.php123
-rw-r--r--wp-inst/wp-admin/page-new.php26
-rw-r--r--wp-inst/wp-admin/plugin-editor.php124
-rw-r--r--wp-inst/wp-admin/plugins.php120
-rw-r--r--wp-inst/wp-admin/post.php410
-rw-r--r--wp-inst/wp-admin/profile.php281
-rw-r--r--wp-inst/wp-admin/quicktags.js389
-rw-r--r--wp-inst/wp-admin/referers.php431
-rw-r--r--wp-inst/wp-admin/setup-config.php156
-rw-r--r--wp-inst/wp-admin/sidebar.php81
-rw-r--r--wp-inst/wp-admin/template-chooser.php202
-rw-r--r--wp-inst/wp-admin/templates.php187
-rw-r--r--wp-inst/wp-admin/theme-editor.php157
-rw-r--r--wp-inst/wp-admin/themes.php172
-rw-r--r--wp-inst/wp-admin/toggle.pngbin0 -> 210 bytes
-rw-r--r--wp-inst/wp-admin/update-links.php44
-rw-r--r--wp-inst/wp-admin/upgrade-functions.php753
-rw-r--r--wp-inst/wp-admin/upgrade-schema.php295
-rw-r--r--wp-inst/wp-admin/upgrade.php95
-rw-r--r--wp-inst/wp-admin/upload.php235
-rw-r--r--wp-inst/wp-admin/user-edit.php216
-rw-r--r--wp-inst/wp-admin/users.php290
-rw-r--r--wp-inst/wp-admin/wp-admin.css682
-rw-r--r--wp-inst/wp-admin/wpmu-admin.php33
-rw-r--r--wp-inst/wp-admin/wpmu-blogs.php304
-rw-r--r--wp-inst/wp-admin/wpmu-edit.php102
-rw-r--r--wp-inst/wp-admin/wpmu-users.php199
68 files changed, 13883 insertions, 0 deletions
diff --git a/wp-inst/wp-admin/admin-db.php b/wp-inst/wp-admin/admin-db.php
new file mode 100644
index 0000000..b657edd
--- /dev/null
+++ b/wp-inst/wp-admin/admin-db.php
@@ -0,0 +1,90 @@
+<?php
+
+function get_users_drafts( $user_id ) {
+ global $wpdb;
+ $user_id = (int) $user_id;
+ $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_id ORDER BY ID DESC";
+ $query = apply_filters('get_users_drafts', $query);
+ return $wpdb->get_results( $query );
+}
+
+function get_others_drafts( $user_id ) {
+ global $wpdb;
+ $user = get_userdata( $user_id );
+ $level_key = $wpdb->prefix . 'user_level';
+ if ( 1 < $user->user_level ) {
+ $editable = get_editable_user_ids( $user_id );
+
+ if( !$editable ) {
+ $other_drafts = '';
+ } else {
+ $editable = join(',', $editable);
+ $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
+ }
+ } else {
+ $other_drafts = false;
+ }
+ return apply_filters('get_others_drafts', $other_drafts);
+}
+
+function get_editable_authors( $user_id ) {
+ global $wpdb;
+ $user = get_userdata( $user_id );
+ $level_key = $wpdb->prefix . 'user_level';
+
+ if ( 7 > $user->user_level ) // TODO: ROLE SYSTEM
+ return false;
+
+ $editable = get_editable_user_ids( $user_id );
+
+ if( !$editable )
+ return false;
+ else {
+ $editable = join(',', $editable);
+ $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable)" );
+ }
+
+ return apply_filters('get_editable_authors', $authors);
+}
+
+function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
+ global $wpdb;
+ $user = get_userdata( $user_id );
+ $level_key = $wpdb->prefix . 'user_level';
+
+ $query = "SELECT * FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
+ if ( $exclude_zeros )
+ $query .= " AND meta_value != '0'";
+ $possible = $wpdb->get_results( $query );
+
+ if ( !$possible )
+ return false;
+
+ $user_ids = array();
+ foreach ( $possible as $mark )
+ if ( intval($mark->meta_value) <= $user->user_level )
+ $user_ids[] = $mark->user_id;
+ if ( empty( $user_ids ) )
+ return false;
+ return $user_ids;
+}
+
+function get_author_user_ids() {
+ global $wpdb;
+ $level_key = $wpdb->prefix . 'user_level';
+
+ $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
+
+ return $wpdb->get_col( $query );
+}
+
+function get_nonauthor_user_ids() {
+ global $wpdb;
+ $level_key = $wpdb->prefix . 'user_level';
+
+ $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
+
+ return $wpdb->get_col( $query );
+}
+
+?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/admin-footer.php b/wp-inst/wp-admin/admin-footer.php
new file mode 100644
index 0000000..14b832b
--- /dev/null
+++ b/wp-inst/wp-admin/admin-footer.php
@@ -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/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
new file mode 100644
index 0000000..cb3fcff
--- /dev/null
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -0,0 +1,1398 @@
+<?php
+
+// Creates a new post from the "Write Post" form using $_POST information.
+function write_post() {
+ global $user_ID;
+
+ if ( !user_can_create_draft($user_ID) )
+ die( __('You are not allowed to create posts or drafts on this blog.') );
+
+ // Rename.
+ $_POST['post_content'] = $_POST['content'];
+ $_POST['post_excerpt'] = $_POST['excerpt'];
+ $_POST['post_parent'] = $_POST['parent_id'];
+ $_POST['to_ping'] = $_POST['trackback_url'];
+
+ if (! empty($_POST['post_author_override'])) {
+ $_POST['$post_author'] = (int) $_POST['post_author_override'];
+ } else if (! empty($_POST['post_author'])) {
+ $_POST['post_author'] = (int) $_POST['post_author'];
+ } else {
+ $_POST['post_author'] = (int) $_POST['user_ID'];
+ }
+
+ if ( !user_can_edit_user($user_ID, $_POST['post_author']) )
+ die( __('You cannot post as this user.') );
+
+ if ( 'publish' == $_POST['post_status'] && (!user_can_create_post($user_ID)) )
+ $_POST['post_status'] = 'draft';
+
+ // What to do based on which button they pressed
+ if ('' != $_POST['saveasdraft']) $_POST['post_status'] = 'draft';
+ if ('' != $_POST['saveasprivate']) $_POST['post_status'] = 'private';
+ if ('' != $_POST['publish']) $_POST['post_status'] = 'publish';
+ if ('' != $_POST['advanced']) $_POST['post_status'] = 'draft';
+ if ('' != $_POST['savepage']) $_POST['post_status'] = 'static';
+
+ if (user_can_set_post_date($user_ID) && (!empty($_POST['edit_date']))) {
+ $aa = $_POST['aa'];
+ $mm = $_POST['mm'];
+ $jj = $_POST['jj'];
+ $hh = $_POST['hh'];
+ $mn = $_POST['mn'];
+ $ss = $_POST['ss'];
+ $jj = ($jj > 31) ? 31 : $jj;
+ $hh = ($hh > 23) ? $hh - 24 : $hh;
+ $mn = ($mn > 59) ? $mn - 60 : $mn;
+ $ss = ($ss > 59) ? $ss - 60 : $ss;
+ $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+ $_POST['post_date_gmt'] = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
+ }
+
+ // Create the post.
+ $post_ID = wp_insert_post($_POST);
+ add_meta($post_ID);
+
+ return $post_ID;
+}
+
+// Update an existing post with values provided in $_POST.
+function edit_post() {
+ global $user_ID;
+
+ if ( !isset($blog_ID) )
+ $blog_ID = 1;
+
+ $post_ID = (int) $_POST['post_ID'];
+
+ if (!user_can_edit_post($user_ID, $post_ID, $blog_ID))
+ die( __('You are not allowed to edit this post.') );
+
+ // Rename.
+ $_POST['ID'] = (int) $_POST['post_ID'];
+ $_POST['post_content'] = $_POST['content'];
+ $_POST['post_excerpt'] = $_POST['excerpt'];
+ $_POST['post_parent'] = $_POST['parent_id'];
+ $_POST['to_ping'] = $_POST['trackback_url'];
+
+ if (! empty($_POST['post_author_override'])) {
+ $_POST['$post_author'] = (int) $_POST['post_author_override'];
+ } else if (! empty($_POST['post_author'])) {
+ $_POST['post_author'] = (int) $_POST['post_author'];
+ } else {
+ $_POST['post_author'] = (int) $_POST['user_ID'];
+ }
+
+ if ( !user_can_edit_user($user_ID, $_POST['post_author']) )
+ die( __('You cannot post as this user.') );
+
+ if (user_can_set_post_date($user_ID) && (!empty($_POST['edit_date']))) {
+ $aa = $_POST['aa'];
+ $mm = $_POST['mm'];
+ $jj = $_POST['jj'];
+ $hh = $_POST['hh'];
+ $mn = $_POST['mn'];
+ $ss = $_POST['ss'];
+ $jj = ($jj > 31) ? 31 : $jj;
+ $hh = ($hh > 23) ? $hh - 24 : $hh;
+ $mn = ($mn > 59) ? $mn - 60 : $mn;
+ $ss = ($ss > 59) ? $ss - 60 : $ss;
+ $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+ $_POST['post_date_gmt'] = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
+ }
+
+ wp_update_post($_POST);
+
+ // Meta Stuff
+ if ($_POST['meta']) :
+ foreach ($_POST['meta'] as $key => $value) :
+ update_meta($key, $value['key'], $value['value']);
+ endforeach;
+ endif;
+
+ if ($_POST['deletemeta']) :
+ foreach ($_POST['deletemeta'] as $key => $value) :
+ delete_meta($key);
+ endforeach;
+ endif;
+
+ add_meta($post_ID);
+}
+
+function edit_comment() {
+ global $user_ID;
+
+ $comment_ID = (int) $_POST['comment_ID'];
+ $comment_post_ID = (int) $_POST['comment_post_ID'];
+
+ if (!user_can_edit_post_comments($user_ID, $comment_post_ID))
+ die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.') );
+
+ $_POST['comment_author'] = $_POST['newcomment_author'];
+ $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
+ $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
+ $_POST['comment_approved'] = $_POST['comment_status'];
+ $_POST['comment_content'] = $_POST['content'];
+ $_POST['comment_ID'] = (int) $_POST['comment_ID'];
+
+ if (user_can_edit_post_date($user_ID, $post_ID) && (!empty($_POST['edit_date']))) {
+ $aa = $_POST['aa'];
+ $mm = $_POST['mm'];
+ $jj = $_POST['jj'];
+ $hh = $_POST['hh'];
+ $mn = $_POST['mn'];
+ $ss = $_POST['ss'];
+ $jj = ($jj > 31) ? 31 : $jj;
+ $hh = ($hh > 23) ? $hh - 24 : $hh;
+ $mn = ($mn > 59) ? $mn - 60 : $mn;
+ $ss = ($ss > 59) ? $ss - 60 : $ss;
+ $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
+ }
+
+ wp_update_comment($_POST);
+}
+
+// Get an existing post and format it for editing.
+function get_post_to_edit($id) {
+ $post = get_post($id);
+
+ $post->post_content = format_to_edit($post->post_content);
+ $post->post_content = apply_filters('content_edit_pre', $post->post_content);
+
+ $post->post_excerpt = format_to_edit($post->post_excerpt);
+ $post->post_excerpt = apply_filters('excerpt_edit_pre', $post->post_excerpt);
+
+ $post->post_title = format_to_edit($post->post_title);
+ $post->post_title = apply_filters('title_edit_pre', $post->post_title);
+
+ if ($post->post_status == 'static')
+ $post->page_template = get_post_meta($id, '_wp_page_template', true);
+
+ return $post;
+}
+
+// Default post information to use when populating the "Write Post" form.
+function get_default_post_to_edit() {
+ global $content, $excerpt, $edited_post_title;
+
+ $post->post_status = 'draft';
+ $post->comment_status = get_settings('default_comment_status');
+ $post->ping_status = get_settings('default_ping_status');
+ $post->post_pingback = get_settings('default_pingback_flag');
+ $post->post_category = get_settings('default_category');
+ $content = wp_specialchars($content);
+ $post->post_content = apply_filters('default_content', $content);
+ $post->post_title = apply_filters('default_title', $edited_post_title);
+ $post->post_excerpt = apply_filters('default_excerpt', $excerpt);
+ $post->page_template = 'default';
+ $post->post_parent = 0;
+ $post->menu_order = 0;
+
+ return $post;
+}
+
+function get_comment_to_edit($id) {
+ $comment = get_comment($id);
+
+ $comment->comment_content = format_to_edit($comment->comment_content);
+ $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
+
+ $comment->comment_author = format_to_edit($comment->comment_author);
+ $comment->comment_author_email = format_to_edit($comment->comment_author_email);
+ $comment->comment_author_url = format_to_edit($comment->comment_author_url);
+
+ return $comment;
+}
+
+function get_category_to_edit($id) {
+ $category = get_category($id);
+
+ return $category;
+}
+
+function wp_insert_category($catarr) {
+ global $wpdb;
+
+ extract($catarr);
+
+ $cat_ID = (int) $cat_ID;
+
+ // Are we updating or creating?
+ if ( !empty($cat_ID) ) {
+ $update = true;
+ } else {
+ $update = false;
+ $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->categories'");
+ $cat_ID = $id_result->Auto_increment;
+ }
+
+ $cat_name = wp_specialchars($cat_name);
+
+ if ( empty($category_nicename) )
+ $category_nicename = sanitize_title($cat_name, $cat_ID);
+ else
+ $category_nicename = sanitize_title($category_nicename, $cat_ID);
+
+ if ( empty($category_description) )
+ $category_description = '';
+
+ if ( empty($category_parent) )
+ $category_parent = 0;
+
+ if ( !$update)
+ $query = "INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')";
+ else
+ $query = "UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'";
+
+ $result = $wpdb->query($query);
+
+ if ( $update ) {
+ $rval = $wpdb->rows_affected;
+ do_action('edit_category', $cat_ID);
+ } else {
+ $rval = $wpdb->insert_id;
+ do_action('create_category', $cat_ID);
+ }
+
+ return $rval;
+}
+
+function wp_update_category($catarr) {
+ global $wpdb;
+
+ $cat_ID = (int) $catarr['cat_ID'];
+
+ // First, get all of the original fields
+ $category = get_category($cat_ID, ARRAY_A);
+
+ // Escape data pulled from DB.
+ $category = add_magic_quotes($category);
+
+ // Merge old and new fields with new fields overwriting old ones.
+ $catarr = array_merge($category, $catarr);
+
+ return wp_insert_category($catarr);
+}
+
+function wp_delete_category($cat_ID) {
+ global $wpdb;
+
+ $cat_ID = (int) $cat_ID;
+
+ // Don't delete the default cat.
+ if ( 1 == $cat_ID )
+ return 0;
+
+ $category = get_category($cat_ID);
+
+ $parent = $category->category_parent;
+
+ // Delete the category.
+ $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
+
+ // Update children to point to new parent.
+ $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
+
+ // TODO: Only set categories to general if they're not in another category already
+ $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
+
+ do_action('delete_category', $cat_ID);
+
+ return 1;
+}
+
+function wp_delete_user($id) {
+ global $wpdb;
+
+ $id = (int) $id;
+
+ $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
+
+ if ($post_ids) {
+ $post_ids = implode(',', $post_ids);
+
+ // Delete comments, *backs
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID IN ($post_ids)");
+ // Clean cats
+ $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id IN ($post_ids)");
+ // Clean post_meta
+ $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN ($post_ids)");
+ // Clean links
+ $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
+ // Delete posts
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_author = $id");
+ }
+
+ // FINALLY, delete user
+ $wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
+
+ do_action('delete_user', $id);
+
+ return true;
+}
+
+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, $current_user;
+
+ $user_level = $current_user->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."), $wpdb->escape($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 the_quicktags () {
+// Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
+if ( !strstr($_SERVER['HTTP_USER_AGENT'], 'Safari') ) :
+ echo '
+ <div id="quicktags">
+ <script src="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 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');
+
+function documentation_link( $for ) {
+ return;
+}
+
+?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/admin-header.php b/wp-inst/wp-admin/admin-header.php
new file mode 100644
index 0000000..fb52818
--- /dev/null
+++ b/wp-inst/wp-admin/admin-header.php
@@ -0,0 +1,104 @@
+<?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 if ( isset( $editing ) ) : ?>
+<script type="text/javascript" src="dbx.js"></script>
+<script type="text/javascript" src="dbx-key.js"></script>
+<?php endif; ?>
+
+<?php do_action('admin_head', ''); ?>
+</head>
+<body>
+
+<div id="wphead">
+<h1><?php echo wptexturize(get_settings(('blogname'))); ?> <span>(<a href="<?php echo get_settings('home') . '/'; ?>"><?php _e('View site') ?> &raquo;</a>)</span></h1>
+</div>
+
+<?php
+require(ABSPATH . '/wp-admin/menu-header.php');
+
+if ( $parent_file == 'options-general.php' ) {
+ require(ABSPATH . '/wp-admin/options-head.php');
+}
+?>
diff --git a/wp-inst/wp-admin/admin.php b/wp-inst/wp-admin/admin.php
new file mode 100644
index 0000000..64e602a
--- /dev/null
+++ b/wp-inst/wp-admin/admin.php
@@ -0,0 +1,69 @@
+<?php
+if ( defined('ABSPATH') )
+ require_once( ABSPATH . 'wp-config.php');
+else
+ require_once('../wp-config.php');
+
+require_once(ABSPATH . 'wp-admin/admin-functions.php');
+require_once(ABSPATH . 'wp-admin/admin-db.php');
+auth_redirect();
+
+nocache_headers();
+
+update_category_cache();
+
+get_currentuserinfo();
+
+$posts_per_page = get_settings('posts_per_page');
+$what_to_show = get_settings('what_to_show');
+$date_format = get_settings('date_format');
+$time_format = get_settings('time_format');
+
+$wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+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/wp-inst/wp-admin/bookmarklet.php b/wp-inst/wp-admin/bookmarklet.php
new file mode 100644
index 0000000..555abee
--- /dev/null
+++ b/wp-inst/wp-admin/bookmarklet.php
@@ -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/wp-inst/wp-admin/categories.php b/wp-inst/wp-admin/categories.php
new file mode 100644
index 0000000..5b327be
--- /dev/null
+++ b/wp-inst/wp-admin/categories.php
@@ -0,0 +1,167 @@
+<?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?'));
+
+ wp_insert_category($_POST);
+
+ header('Location: categories.php?message=1#addcat');
+break;
+
+case 'delete':
+
+ check_admin_referer();
+
+ if ( $user_level < 3 )
+ die (__('Cheatin&#8217; uh?'));
+
+ $cat_ID = (int) $_GET['cat_ID'];
+ $cat_name = get_catname($cat_ID);
+
+ if ( 1 == $cat_ID )
+ die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+
+ wp_delete_category($cat_ID);
+
+ header('Location: categories.php?message=2');
+
+break;
+
+case 'edit':
+
+ require_once ('admin-header.php');
+ $cat_ID = (int) $_GET['cat_ID'];
+ $category = get_category_to_edit($cat_ID);
+ ?>
+
+<div class="wrap">
+ <h2><?php _e('Edit Category') ?></h2>
+ <form name="editcat" action="categories.php" method="post">
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
+ <tr>
+ <th width="33%" scope="row"><?php _e('Category name:') ?></th>
+ <td width="67%"><input name="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /> <input type="hidden" name="action" value="editedcat" />
+<input type="hidden" name="cat_ID" value="<?php echo $category->cat_ID ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Category slug:') ?></th>
+ <td><input name="category_nicename" type="text" value="<?php echo wp_specialchars($category->category_nicename); ?>" size="40" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Category parent:') ?></th>
+ <td>
+ <select name='category_parent'>
+ <option value='0' <?php if (!$category->category_parent) echo " selected='selected'"; ?>><?php _e('None') ?></option>
+ <?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
+ </select></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Description:') ?></th>
+ <td><textarea name="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->category_description, 1); ?></textarea></td>
+ </tr>
+ </table>
+ <p class="submit"><input type="submit" name="submit" value="<?php _e('Edit category') ?> &raquo;" /></p>
+ </form>
+ <p><a href="categories.php"><?php _e('&laquo; Return to category list'); ?></a></p>
+</div>
+ <?php
+
+break;
+
+case 'editedcat':
+ if ($user_level < 3)
+ die (__('Cheatin&#8217; uh?'));
+
+ wp_update_category($_POST);
+
+ header('Location: categories.php?message=3');
+break;
+
+default:
+
+require_once ('admin-header.php');
+
+$messages[1] = __('Category added.');
+$messages[2] = __('Category deleted.');
+$messages[3] = __('Category updated.');
+?>
+
+<?php if (isset($_GET['message'])) : ?>
+<div 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='category_parent' class='postform'>
+ <option value='0'><?php _e('None') ?></option>
+ <?php wp_dropdown_cats(0); ?>
+ </select></p>
+ <p><?php _e('Description: (optional)') ?> <br />
+ <textarea name="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
+ <p class="submit"><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
+ </form>
+</div>
+<?php endif; ?>
+
+<?php
+break;
+}
+
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/dbx-key.js b/wp-inst/wp-admin/dbx-key.js
new file mode 100644
index 0000000..a68ff66
--- /dev/null
+++ b/wp-inst/wp-admin/dbx-key.js
@@ -0,0 +1,44 @@
+
+
+//initialisation function
+window.onload = function()
+{
+ //initialise the docking boxes manager
+ var manager = new dbxManager('postmeta'); //session ID [/-_a-zA-Z0-9/]
+
+
+ //create new docking boxes group
+ var meta = new dbxGroup(
+ 'grabit', // container ID [/-_a-zA-Z0-9/]
+ 'vertical', // orientation ['vertical'|'horizontal']
+ '7', // drag threshold ['n' pixels]
+ 'no', // restrict drag movement to container axis ['yes'|'no']
+ '10', // animate re-ordering [frames per transition, or '0' for no effect]
+ 'yes', // include open/close toggle buttons ['yes'|'no']
+ 'closed', // default state ['open'|'closed']
+ 'open', // word for "open", as in "open this box"
+ 'close', // word for "close", as in "close this box"
+ 'click-down and drag to move this box', // sentence for "move this box" by mouse
+ 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse
+ 'use the arrow keys to move this box', // sentence for "move this box" by keyboard
+ ', or press the enter key to %toggle% it', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
+ '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
+ );
+
+ var advanced = new dbxGroup(
+ 'advancedstuff', // container ID [/-_a-zA-Z0-9/]
+ 'vertical', // orientation ['vertical'|'horizontal']
+ '7', // drag threshold ['n' pixels]
+ 'yes', // restrict drag movement to container axis ['yes'|'no']
+ '10', // animate re-ordering [frames per transition, or '0' for no effect]
+ 'yes', // include open/close toggle buttons ['yes'|'no']
+ 'closed', // default state ['open'|'closed']
+ 'open', // word for "open", as in "open this box"
+ 'close', // word for "close", as in "close this box"
+ 'click-down and drag to move this box', // sentence for "move this box" by mouse
+ 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse
+ 'use the arrow keys to move this box', // sentence for "move this box" by keyboard
+ ', or press the enter key to %toggle% it', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
+ '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
+ );
+};
diff --git a/wp-inst/wp-admin/dbx.js b/wp-inst/wp-admin/dbx.js
new file mode 100644
index 0000000..2cb73f9
--- /dev/null
+++ b/wp-inst/wp-admin/dbx.js
@@ -0,0 +1,6 @@
+// DBX2.0[beta] :: Docking Boxes (dbx)
+// *****************************************************
+// DOM scripting by brothercake -- http://www.brothercake.com/
+// GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html
+//******************************************************
+var dbx;function dbxManager(sid){dbx=this;if(!/^[-_a-z0-9]+$/i.test(sid)){alert('Error from dbxManager:\n"'+sid+'" is an invalid session ID'); return;}this.supported=!(document.getElementsByTagName('*').length==0||(navigator.vendor=='KDE'&&typeof window.sidebar=='undefined'));if(!this.supported){return;}this.etype=typeof document.addEventListener!='undefined'?'addEventListener':typeof document.attachEvent!='undefined'?'attachEvent':'none';this.eprefix=(this.etype=='attachEvent'?'on':'');if(typeof window.opera!='undefined'&&parseFloat(navigator.userAgent.toLowerCase().split(/opera[\/ ]/)[1].split(' ')[0],10) < 7.5){this.etype='none';}if(this.etype=='none'){this.supported=false; return;}this.running=0;this.gc=[];this.sid=sid;this.savedata={};this.cookiestate=this.getCookieState();};dbxManager.prototype.setCookieState=function(){var now=new Date();now.setTime(now.getTime()+(365*24*60*60*1000));var str='';for(j in this.savedata){str+=j+'='+this.savedata[j]+'&'}this.state=str.replace(/^(.+)&$/,'$1');if(typeof this.onstatechange=='undefined'||this.onstatechange()){document.cookie='dbx-'+this.sid+'='+this.state+'; expires='+now.toGMTString()+'; path=/';}};dbxManager.prototype.getCookieState=function(){this.cookiestate=null;if(document.cookie){if(document.cookie.indexOf('dbx-'+this.sid)!=-1){this.cookie=document.cookie.split('dbx-'+this.sid+'=')[1].split('&');for(var i in this.cookie){this.cookie[i]=this.cookie[i].split('=');this.cookie[i][1]=this.cookie[i][1].split(',');}this.cookiestate={};for(i in this.cookie){this.cookiestate[this.cookie[i][0]]=this.cookie[i][1];}}}return this.cookiestate;};dbxManager.prototype.addDataMember=function(gid,order){this.savedata[gid]=order;};dbxManager.prototype.createElement=function(tag){return typeof document.createElementNS!='undefined'?document.createElementNS('http://www.w3.org/1999/xhtml',tag):document.createElement(tag);};dbxManager.prototype.getTarget=function(e,pattern,node){if(typeof node!='undefined'){var target=node;}else{target=typeof e.target!='undefined'?e.target:e.srcElement;}var regex=new RegExp(pattern,'');while(!regex.test(target.className)){target=target.parentNode;}return target;};function dbxGroup(gid,dir,thresh,fix,ani,togs,def,open,close,move,toggle,kmove,ktoggle,syntax){if(!/^[-_a-z0-9]+$/i.test(gid)){alert('Error from dbxGroup:\n"'+gid+'" is an invalid container ID'); return;}this.container=document.getElementById(gid);if(this.container==null||!dbx.supported){return;}var self=this;this.gid=gid;this.dragok=false;this.box=null;this.vertical=dir=='vertical';this.threshold=parseInt(thresh,10);this.restrict=fix=='yes';this.resolution=parseInt(ani,10);this.toggles=togs=='yes';this.defopen=def!='closed';this.vocab={'open':open,'close':close,'move':move, 'toggle':toggle,'kmove':kmove, 'ktoggle':ktoggle,'syntax':syntax};this.container.style.position='relative';this.container.style.display='block';if(typeof window.opera!='undefined'){this.container.style.display='run-in';}this.boxes=[];this.buttons=[];this.order=[];this.eles=this.container.getElementsByTagName('*');for(var i=0;i<this.eles.length; i++){if(/dbx\-box/i.test(this.eles[i].className)&&!/dbx\-dummy/i.test(this.eles[i].className)){this.eles[i].style.position='relative';this.eles[i].style.display='block';this.boxes.push(this.eles[i]);this.eles[i].className+=' dbx-box-open';this.eles[i].className+=' dbxid'+this.order.length;this.order.push(this.order.length.toString()+'+');this.eles[i][dbx.etype](dbx.eprefix+'mousedown',function(e){if(!e){e=window.event;}self.mousedown(e,dbx.getTarget(e,'dbx\-box'));},false);}if(/dbx\-handle/i.test(this.eles[i].className)){this.eles[i].style.position='relative';this.eles[i].style.display='block';this.eles[i].className+=' dbx-handle-cursor';this.eles[i].setAttribute('title',this.eles[i].getAttribute('title')==null||this.eles[i].title==''?this.vocab.move:this.vocab.syntax.replace('%mytitle%',this.eles[i].title).replace('%dbxtitle%',this.vocab.move));if(this.toggles){this.buttons.push(this.addToggleBehavior(this.eles[i]));}else{this.eles[i][dbx.etype](dbx.eprefix+'key'+(typeof document.uniqueID!='undefined'||navigator.vendor=='Apple Computer, Inc.'?'down':'press'),function(e) {if(!e){e=window.event;}return self.keypress(e,dbx.getTarget(e,'dbx\-handle'));},false);this.eles[i][dbx.etype](dbx.eprefix+'focus',function(e){if(!e){e=window.event;}self.createTooltip(null,dbx.getTarget(e,'dbx\-handle'));},false);this.eles[i][dbx.etype](dbx.eprefix+'blur',function(){self.removeTooltip();},false);}}}dbx.addDataMember(this.gid,this.order.join(','));var dummy=this.container.appendChild(dbx.createElement('span'));dummy.className='dbx-box dbx-dummy';dummy.style.display='block';dummy.style.width='0';dummy.style.height='0';dummy.style.overflow='hidden';if(this.vertical){dummy.className+=' dbx-offdummy';}this.boxes.push(dummy);if(dbx.cookiestate!=null&&typeof dbx.cookiestate[this.gid]!='undefined'){var num=dbx.cookiestate[this.gid].length;if(num==this.boxes.length - 1){for(i=0;i<num; i++){var index=parseInt(dbx.cookiestate[this.gid][i],10);this.container.insertBefore(this.boxes[index],dummy);if(this.toggles&&dbx.cookiestate[this.gid][i].charAt(1)=='-'){this.toggleBoxState(this.buttons[index],false);}}this.getBoxOrder();}}else if(!this.defopen&&this.toggles){var len=this.buttons.length;for(i=0;i<len; i++){this.toggleBoxState(this.buttons[i],true);}}document[dbx.etype](dbx.eprefix+'mouseout',function(e){if(typeof e.target=='undefined'){e=window.event; e.relatedTarget=e.toElement;}if(e.relatedTarget==null){self.mouseup(e);}},false);document[dbx.etype](dbx.eprefix+'mousemove',function(e){self.mousemove(e);},false);document[dbx.etype](dbx.eprefix+'mouseup',function(e){self.mouseup(e);},false);this.keydown=false;document[dbx.etype](dbx.eprefix+'keydown',function(){self.keydown=true;},false);document[dbx.etype](dbx.eprefix+'keyup',function(){self.keydown=false;},false);};dbxGroup.prototype.addToggleBehavior=function(){var self=this;var button=arguments[0].appendChild(dbx.createElement('a'));button.appendChild(document.createTextNode('\u00a0'));button.style.cursor='pointer';button.href='javascript:void(null)';button.className='dbx-toggle dbx-toggle-open';button.setAttribute('title',this.vocab.toggle.replace('%toggle%',this.vocab.close));button.hasfocus=typeof window.opera!='undefined'||navigator.vendor=='Apple Computer, Inc.'?null:false;this.tooltip=null;button.onclick=function(){if(this.hasfocus===true||this.hasfocus===null){self.removeTooltip();self.toggleBoxState(this,true);}};button['onkey'+(typeof document.uniqueID!='undefined'||navigator.vendor=='Apple Computer, Inc.'?'down':'press')]=function(e){if(!e){e=window.event;}return self.keypress(e,this);};button.onfocus=function(){var len=self.buttons.length;for(var i=0;i<len; i++){self.buttons[i].className=self.buttons[i].className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/,'');}var isopen=(/dbx\-toggle\-open/.test(this.className));this.className+=' dbx-toggle-hilite-'+(isopen?'open':'closed');self.createTooltip(isopen,this);this.isactive=true;if(this.hasfocus!==null){this.hasfocus=true;}};button.onblur=function(){this.className=this.className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/,'');self.removeTooltip();if(this.hasfocus!==null){this.hasfocus=false;}};return button;};dbxGroup.prototype.toggleBoxState=function(button,regen){var isopen=(/dbx\-toggle\-open/.test(button.className));var parent=dbx.getTarget(null,'dbx\-box',button);dbx.box=parent;dbx.toggle=button;if(typeof dbx.container=='undefined'){dbx.group=dbx.getTarget(null,'dbx\-group',parent);}else{dbx.group=dbx.container;}if((!isopen&&(typeof dbx.onboxopen=='undefined'||dbx.onboxopen()))||(isopen&&(typeof dbx.onboxclose=='undefined'||dbx.onboxclose()))){button.className='dbx-toggle dbx-toggle-'+(isopen?'closed':'open');button.title=this.vocab.toggle.replace('%toggle%',isopen?this.vocab.open:this.vocab.close);if(typeof button.isactive!='undefined'){button.className+=' dbx-toggle-hilite-'+(isopen?'closed':'open')}parent.className=parent.className.replace(/[ ](dbx-box-)(open|closed)/,' $1'+(isopen?'closed':'open'));if(regen){this.getBoxOrder();}}};dbxGroup.prototype.shiftBoxPosition=function(e,anchor,positive){var parent=dbx.getTarget(null,'dbx\-box',anchor);dbx.group=this.container;dbx.box=parent;dbx.event=e;if(typeof dbx.onboxdrag=='undefined'||dbx.onboxdrag()){var positions=[];var len=this.boxes.length;for(var i=0;i<len; i++){positions[i]=[i,this.boxes[i][this.vertical?'offsetTop':'offsetLeft']];if(parent==this.boxes[i]){this.idref=i;}}positions.sort(this.compare);for(i=0;i<len; i++){if(positions[i][0]==this.idref){if((positive&&i < len - 2)||(!positive&&i > 0)){var sibling=this.boxes[positions[i+(positive?1:-1)][0]];if(this.resolution > 0){var visipos={'x':parent.offsetLeft,'y':parent.offsetTop};var siblingpos={'x':sibling.offsetLeft,'y':sibling.offsetTop};}var obj={'insert':(positive?sibling:parent),'before':(positive?parent:sibling)};this.container.insertBefore(obj.insert,obj.before);if(this.resolution > 0){var animators={'sibling':new dbxAnimator(this,sibling,siblingpos,this.resolution,true,anchor),'parent':new dbxAnimator(this,parent,visipos,this.resolution,true,anchor)};}else{anchor.focus();}break;}}}this.getBoxOrder();}};dbxGroup.prototype.compare=function(a,b){return a[1] - b[1];};dbxGroup.prototype.createTooltip=function(isopen,anchor){if(this.keydown){this.tooltip=this.container.appendChild(dbx.createElement('span'));this.tooltip.style.visibility='hidden';this.tooltip.className='dbx-tooltip';if(isopen!=null){this.tooltip.appendChild(document.createTextNode(this.vocab.kmove+this.vocab.ktoggle.replace('%toggle%',isopen?this.vocab.close:this.vocab.open)));}else{this.tooltip.appendChild(document.createTextNode(this.vocab.kmove));}var parent=dbx.getTarget(null,'dbx\-box',anchor);this.tooltip.style.left=parent.offsetLeft+'px';this.tooltip.style.top=parent.offsetTop+'px';var tooltip=this.tooltip;window.setTimeout(function(){if(tooltip!=null){tooltip.style.visibility='visible';}},500);}};dbxGroup.prototype.removeTooltip=function(){if(this.tooltip!=null){this.tooltip.parentNode.removeChild(this.tooltip); this.tooltip=null;}};dbxGroup.prototype.mousedown=function(e,box){var node=typeof e.target!='undefined'?e.target:e.srcElement;if(node.nodeName=='#text'){node=node.parentNode;}if(!/dbx\-(toggle|box|group)/i.test(node.className)){while(!/dbx\-(handle|box|group)/i.test(node.className)){node=node.parentNode;}}if(/dbx\-handle/i.test(node.className)){this.removeTooltip();this.released=false;this.initial={'x':e.clientX,'y':e.clientY};this.current={'x':0,'y':0};this.createCloneBox(box);if(typeof e.preventDefault!='undefined' ){e.preventDefault();}if(typeof document.onselectstart!='undefined'){document.onselectstart=function(){return false;}}}};dbxGroup.prototype.mousemove=function(e){if(this.dragok&&this.box!=null){this.positive=this.vertical?(e.clientY > this.current.y?true:false):(e.clientX > this.current.x?true:false);this.current={'x':e.clientX,'y':e.clientY};var overall={'x':this.current.x - this.initial.x,'y':this.current.y - this.initial.y};if(((overall.x>=0&&overall.x<=this.threshold)||(overall.x<=0&&overall.x>=0 - this.threshold))&&((overall.y>=0&&overall.y<=this.threshold)||(overall.y<=0&&overall.y>=0 - this.threshold))){this.current.x-=overall.x; this.current.y-=overall.y;}if(this.released||overall.x > this.threshold||overall.x < (0 - this.threshold)||overall.y > this.threshold||overall.y < (0 - this.threshold)){dbx.group=this.container;dbx.box=this.box;dbx.event=e;if(typeof dbx.onboxdrag=='undefined'||dbx.onboxdrag()){this.released=true;if(!this.restrict||!this.vertical){this.boxclone.style.left=(this.current.x - this.difference.x)+'px';}if(!this.restrict||this.vertical){this.boxclone.style.top=(this.current.y - this.difference.y)+'px';}this.moveOriginalToPosition(this.current.x,this.current.y);if(typeof e.preventDefault!='undefined' ){e.preventDefault();}}}}return true;};dbxGroup.prototype.mouseup=function(e){if(this.box!=null){this.moveOriginalToPosition(e.clientX,e.clientY);this.removeCloneBox();this.getBoxOrder();if(typeof document.onselectstart!='undefined'){document.onselectstart=function(){return true;}}}this.dragok=false;};dbxGroup.prototype.keypress=function(e,anchor){if(/^(3[7-9])|(40)$/.test(e.keyCode)){this.removeTooltip();if((this.vertical&&/^(38|40)$/.test(e.keyCode))||(!this.vertical&&/^(37|39)$/.test(e.keyCode))){this.shiftBoxPosition(e,anchor,/^[3][78]$/.test(e.keyCode)?false:true);if(typeof e.preventDefault!='undefined'){e.preventDefault();}else{return false;}typeof e.stopPropagation!='undefined'?e.stopPropagation():e.cancelBubble=true;this.keydown=false;}}return true;};dbxGroup.prototype.getBoxOrder=function(){this.order=[];var len=this.eles.length;for(var j=0; j<len; j++){if(/dbx\-box/i.test(this.eles[j].className)&&!/dbx\-(clone|dummy)/i.test(this.eles[j].className)){this.order.push(this.eles[j].className.split('dbxid')[1]+(/dbx\-box\-open/i.test(this.eles[j].className)?'+':'-'));}}dbx.savedata[this.gid]=this.order.join(',');dbx.setCookieState();};dbxGroup.prototype.createClone=function(){var clone=this.container.appendChild(arguments[0].cloneNode(true));clone.className+=' dbx-clone';clone.style.position='absolute';clone.style.visibility='hidden';clone.style.zIndex=arguments[1];clone.style.left=arguments[2].x+'px';clone.style.top=arguments[2].y+'px';clone.style.width=arguments[0].offsetWidth+'px';clone.style.height=arguments[0].offsetHeight+'px';return clone;};dbxGroup.prototype.createCloneBox=function(box){this.box=box;this.position={'x':this.box.offsetLeft,'y':this.box.offsetTop};this.difference={'x':(this.initial.x - this.position.x),'y':(this.initial.y - this.position.y)};this.boxclone=this.createClone(this.box,30000,this.position);this.boxclone.style.cursor='move';this.dragok=true;};dbxGroup.prototype.removeCloneBox=function(){this.container.removeChild(this.boxclone);this.box.style.visibility='visible';this.box=null;};dbxGroup.prototype.moveOriginalToPosition=function(clientX,clientY){var cloneprops={'xy':this.vertical?clientY - this.difference.y:clientX - this.difference.x,'wh':this.vertical?this.boxclone.offsetHeight:this.boxclone.offsetWidth};this.box.style.visibility='hidden';this.boxclone.style.visibility='visible';var len=this.boxes.length;for(var i=0;i<len; i++){var boxprops={'xy':this.vertical?this.boxes[i].offsetTop:this.boxes[i].offsetLeft,'wh':this.vertical?this.boxes[i].offsetHeight:this.boxes[i].offsetWidth};if((this.positive&&cloneprops.xy+cloneprops.wh > boxprops.xy&&cloneprops.xy < boxprops.xy)||(!this.positive&&cloneprops.xy < boxprops.xy&&cloneprops.xy+cloneprops.wh > boxprops.xy)){if(this.boxes[i]==this.box){return;}var sibling=this.box.nextSibling;while(sibling.className==null||!/dbx\-box/.test(sibling.className)){sibling=sibling.nextSibling;}if(this.boxes[i]==sibling){return;}if(this.resolution > 0){if(this.box[this.vertical?'offsetTop':'offsetLeft'] < boxprops.xy){var visibox=this.boxes[i].previousSibling;while(visibox.className==null||!/dbx\-box/.test(visibox.className)){visibox=visibox.previousSibling;}}else{visibox=this.boxes[i];}var visipos={'x':visibox.offsetLeft,'y':visibox.offsetTop};}var prepos={'x':this.box.offsetLeft,'y':this.box.offsetTop};this.container.insertBefore(this.box,this.boxes[i]);this.initial.x+=(this.box.offsetLeft - prepos.x);this.initial.y+=(this.box.offsetTop - prepos.y);if(this.resolution > 0&&visibox!=this.box){var animator=new dbxAnimator(this,visibox,visipos,this.resolution,false,null);}else{}break;}}};function dbxAnimator(caller,box,pos,res,kbd,anchor){this.caller=caller;this.box=box;this.timer=null;var before=pos[this.caller.vertical?'y':'x'];var after=this.box[this.caller.vertical?'offsetTop':'offsetLeft'];if(before!=after){if(dbx.running > this.caller.boxes.length - 1){return;}var clone=this.caller.createClone(this.box,29999,arguments[2]);clone.style.visibility='visible';this.box.style.visibility='hidden';this.animateClone(clone,before,after > before?after - before:0 - (before - after),this.caller.vertical?'top':'left',res,kbd,anchor);}};dbxAnimator.prototype.animateClone=function(clone,current,change,dir,res,kbd,anchor){var self=this;var count=0;dbx.running ++;this.timer=window.setInterval(function(){count ++;current+=change / res;clone.style[dir]=current+'px';if(count==res){window.clearTimeout(self.timer);self.timer=null;dbx.running --;self.caller.container.removeChild(clone);self.box.style.visibility='visible';if(kbd){if(anchor!=null&&anchor.parentNode.style.visibility!='hidden'){anchor.focus();}else if(self.caller.toggles){var button=self.caller.buttons[parseInt(self.box.className.split('dbxid')[1],10)];if(button!=null&&typeof button.isactive!='undefined'){button.focus();}}}}},20);};if(typeof window.attachEvent!='undefined'){window.attachEvent('onunload',function(){var ev=['mousedown','mousemove','mouseup','mouseout','click','keydown','keyup','focus','blur','selectstart','statechange','boxdrag','boxopen','boxclose'];var el=ev.length;var dl=document.all.length;for(var i=0;i<dl; i++){for(var j=0; j<el; j++){document.all[i]['on'+ev[j]]=null;}}});} \ No newline at end of file
diff --git a/wp-inst/wp-admin/edit-comments.php b/wp-inst/wp-admin/edit-comments.php
new file mode 100644
index 0000000..bcfd4c2
--- /dev/null
+++ b/wp-inst/wp-admin/edit-comments.php
@@ -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/wp-inst/wp-admin/edit-form-advanced.php b/wp-inst/wp-admin/edit-form-advanced.php
new file mode 100644
index 0000000..577cf77
--- /dev/null
+++ b/wp-inst/wp-admin/edit-form-advanced.php
@@ -0,0 +1,212 @@
+<?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->post_status . '" />';
+
+$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $post->to_ping) .'" />';
+
+if ('' != $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->post_status)) $post->post_status = 'draft';
+
+?>
+
+<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
+<input type="hidden" name="action" value="<?php echo $form_action ?>" />
+<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
+
+<?php echo $form_extra ?>
+<?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
+<script type="text/javascript">
+<!--
+function focusit() {
+ // focus on first input field
+ document.post.title.focus();
+}
+window.onload = focusit;
+//-->
+</script>
+<?php endif; ?>
+<div id="poststuff">
+
+<div id="moremeta">
+<div id="grabit" class="dbx-group">
+
+<fieldset id="commentstatusdiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
+<div class="dbx-content">
+<input name="advanced_view" type="hidden" value="1" />
+<label for="comment_status" class="selectit">
+<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
+<?php _e('Allow Comments') ?></label>
+<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
+</div>
+</fieldset>
+
+<fieldset id="passworddiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
+<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
+</fieldset>
+
+<fieldset id="slugdiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Post slug') ?></h3>
+<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
+</fieldset>
+
+<fieldset id="categorydiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
+<div class="dbx-content"><?php dropdown_categories(get_settings('default_category')); ?></div>
+</fieldset>
+
+<fieldset class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
+<div class="dbx-content"><?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->post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
+<?php endif; ?>
+ <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
+ <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
+</fieldset>
+
+<?php if ($user_level > 4) : ?>
+<fieldset class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
+<div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
+</fieldset>
+<?php endif; ?>
+
+<?php if ( $authors = get_editable_authors( $current_user->ID ) ) : // TODO: ROLE SYSTEM ?>
+<fieldset id="authordiv" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
+<div class="dbx-content">
+<select name="post_author_override" id="post_author_override">
+<?php
+foreach ($authors as $o) :
+$o = get_userdata( $o->ID );
+if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
+else $selected = '';
+echo "<option value='$o->ID' $selected>$o->display_name</option>";
+endforeach;
+?>
+</select>
+</div>
+</fieldset>
+<?php endif; ?>
+
+</div>
+</div>
+
+<fieldset id="titlediv">
+ <legend><?php _e('Title') ?></legend>
+ <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
+</fieldset>
+
+<fieldset id="postdiv">
+ <legend><?php _e('Post') ?></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 $post->post_content ?></textarea></div>
+</fieldset>
+<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 id="advancedstuff" class="dbx-group" >
+
+<fieldset id="postexcerpt" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
+<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="4" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
+</fieldset>
+
+<fieldset class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
+<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
+<?php
+if ('' != $pinged)
+ echo $pings;
+?>
+</div>
+</fieldset>
+
+<fieldset id="postcustom" class="dbx-box">
+<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
+<div id="postcustomstuff" class="dbx-content">
+<?php
+if($metadata = has_meta($post_ID)) {
+?>
+<?php
+ list_meta($metadata);
+?>
+<?php
+}
+ meta_form();
+?>
+</div>
+</fieldset>
+
+</div>
+
+<?php if ('edit' == $action) : ?>
+<p><input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), addslashes($post->post_title) ) . "')\""; ?> /></p>
+<?php endif; ?>
+
+</div>
+
+</div>
+
+</form> \ No newline at end of file
diff --git a/wp-inst/wp-admin/edit-form-comment.php b/wp-inst/wp-admin/edit-form-comment.php
new file mode 100644
index 0000000..9dd817d
--- /dev/null
+++ b/wp-inst/wp-admin/edit-form-comment.php
@@ -0,0 +1,89 @@
+<?php
+$submitbutton_text = __('Edit Comment &raquo;');
+$toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
+$form_action = 'editedcomment';
+$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID;
+?>
+
+<form name="post" action="post.php" method="post" id="post">
+<div class="wrap">
+<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
+<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
+
+<script type="text/javascript">
+function focusit() {
+ // focus on first input field
+ document.post.name.focus();
+}
+window.onload = focusit;
+</script>
+<fieldset id="namediv">
+ <legend><?php _e('Name:') ?></legend>
+ <div>
+ <input type="text" name="newcomment_author" size="22" value="<?php echo $comment->comment_author ?>" tabindex="1" id="name" />
+ </div>
+</fieldset>
+<fieldset id="emaildiv">
+ <legend><?php _e('E-mail:') ?></legend>
+ <div>
+ <input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email ?>" tabindex="2" id="email" />
+ </div>
+</fieldset>
+<fieldset id="uridiv">
+ <legend><?php _e('URI:') ?></legend>
+ <div>
+ <input type="text" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" />
+ </div>
+</fieldset>
+
+<fieldset style="clear: both;">
+ <legend><?php _e('Comment') ?></legend>
+<?php the_quicktags(); ?>
+<?php
+ $rows = get_settings('default_post_edit_rows');
+ if (($rows < 3) || ($rows > 100)) {
+ $rows = 10;
+ }
+?>
+<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo $comment->comment_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->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
+ <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
+ <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
+ </tr>
+
+<?php if ($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 $comment->comment_ID; ?>&amp;p=<?php echo $comment->comment_post_ID; ?>"><?php _e('Delete comment') ?></a></p></td>
+ </tr>
+</table>
+
+</div>
+
+</form>
diff --git a/wp-inst/wp-admin/edit-form.php b/wp-inst/wp-admin/edit-form.php
new file mode 100644
index 0000000..11d62d4
--- /dev/null
+++ b/wp-inst/wp-admin/edit-form.php
@@ -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 $post->post_title; ?>" id="title" /></div>
+ </fieldset>
+
+ <fieldset id="categorydiv">
+ <legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
+ <div><?php dropdown_categories($post->post_category); ?></div>
+ </fieldset>
+
+<br />
+<fieldset id="postdiv">
+ <legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
+<?php the_quicktags(); ?>
+<?php
+ $rows = get_settings('default_post_edit_rows');
+ if (($rows < 3) || ($rows > 100)) {
+ $rows = 10;
+ }
+?>
+<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div>
+</fieldset>
+
+
+<script type="text/javascript">
+<!--
+edCanvas = document.getElementById('content');
+//-->
+</script>
+
+<input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" />
+
+<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
+ <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
+
+<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
+ <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
+
+ <?php if ( 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/wp-inst/wp-admin/edit-page-form.php b/wp-inst/wp-admin/edit-page-form.php
new file mode 100644
index 0000000..a238423
--- /dev/null
+++ b/wp-inst/wp-admin/edit-page-form.php
@@ -0,0 +1,160 @@
+
+<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 $post->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($post->comment_status, 'open'); ?> />
+ <?php _e('Allow Comments') ?></label>
+ <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
+ </div>
+</fieldset>
+ <fieldset id="postpassworddiv">
+ <legend><?php _e('Page Password') ?></legend>
+ <div><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->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->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 $post->post_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($post->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->post_name ?>" /></td>
+ </tr>
+<?php if ( $authors = get_editable_authors( $current_user->ID ) ) : // TODO: ROLE SYSTEM ?>
+ <tr>
+ <th scope="row" width="30%"><?php _e('Page owner'); ?>:</th>
+ <td>
+ <select name="post_author" id="post_author">
+ <?php
+ foreach ($authors as $o) :
+ $o = get_userdata( $o->ID );
+ if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
+ else $selected = '';
+ echo "<option value='$o->ID' $selected>$o->user_login ($o->first_name $o->last_name)</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 $post->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."), $wpdb->escape($post->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/wp-inst/wp-admin/edit-pages.php b/wp-inst/wp-admin/edit-pages.php
new file mode 100644
index 0000000..6609e74
--- /dev/null
+++ b/wp-inst/wp-admin/edit-pages.php
@@ -0,0 +1,52 @@
+<?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'");
+// } FIXME
+
+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/wp-inst/wp-admin/edit.php b/wp-inst/wp-admin/edit.php
new file mode 100644
index 0000000..7f41629
--- /dev/null
+++ b/wp-inst/wp-admin/edit.php
@@ -0,0 +1,291 @@
+<?php
+require_once('admin.php');
+
+$title = __('Posts');
+$parent_file = 'edit.php';
+require_once('admin-header.php');
+
+$_GET['m'] = (int) $_GET['m'];
+
+get_currentuserinfo();
+
+$drafts = get_users_drafts( $user_ID );
+$other_drafts = get_others_drafts( $user_ID);
+
+if ($drafts || $other_drafts) {
+?>
+<div class="wrap">
+<?php if ($drafts) { ?>
+ <p><strong><?php _e('Your Drafts:') ?></strong>
+ <?php
+ $i = 0;
+ foreach ($drafts as $draft) {
+ if (0 != $i)
+ echo ', ';
+ $draft->post_title = stripslashes($draft->post_title);
+ if ($draft->post_title == '')
+ $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
+ echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
+ ++$i;
+ }
+ ?>
+ .</p>
+<?php } ?>
+
+<?php if ($other_drafts) { ?>
+ <p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
+ <?php
+ $i = 0;
+ foreach ($other_drafts as $draft) {
+ if (0 != $i)
+ echo ', ';
+ $draft->post_title = stripslashes($draft->post_title);
+ if ($draft->post_title == '')
+ $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
+ echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
+ ++$i;
+ }
+ ?>
+ .</p>
+
+<?php } ?>
+
+</div>
+<?php } ?>
+
+<div class="wrap">
+<h2>
+<?php
+$what_to_show = 'posts';
+$posts_per_page = 15;
+$posts_per_archive_page = -1;
+
+wp();
+
+if ( is_month() ) {
+ single_month_title(' ');
+} elseif ( is_search() ) {
+ printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
+} else {
+ if ( ! is_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/wp-inst/wp-admin/import-b2.php b/wp-inst/wp-admin/import-b2.php
new file mode 100644
index 0000000..9344025
--- /dev/null
+++ b/wp-inst/wp-admin/import-b2.php
@@ -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_once('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/wp-inst/wp-admin/import-blogger.php b/wp-inst/wp-admin/import-blogger.php
new file mode 100644
index 0000000..19a47fc
--- /dev/null
+++ b/wp-inst/wp-admin/import-blogger.php
@@ -0,0 +1,207 @@
+<?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_once('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($wpdb->escape($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_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 = $wpdb->escape($post_author);
+ $pass1 = $wpdb->escape('password');
+ $user_email = $wpdb->escape('user@wordpress.org');
+ $user_url = $wpdb->escape('');
+ $user_joindate = $wpdb->escape($user_joindate);
+ $result = $wpdb->query("
+ INSERT INTO $wpdb->users (
+ user_login,
+ user_pass,
+ user_email,
+ user_url,
+ user_registered,
+ user_level,
+ ) VALUES (
+ '$user_login',
+ '$pass1',
+ '$user_email',
+ '$user_url',
+ '$user_joindate',
+ '1',
+ )");
+
+ 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 = $wpdb->escape($post_content);
+ $post_content = str_replace('<br>', '<br />', $post_content); // the XHTML touch... ;)
+
+ $post_title = $wpdb->escape($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/wp-inst/wp-admin/import-greymatter.php b/wp-inst/wp-admin/import-greymatter.php
new file mode 100644
index 0000000..4d96a82
--- /dev/null
+++ b/wp-inst/wp-admin/import-greymatter.php
@@ -0,0 +1,315 @@
+<?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_once('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);
+
+ $s=$userdata[4];
+ $user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";
+
+ $user_login=$wpdb->escape($userdata[0]);
+ $pass1=$wpdb->escape($userdata[1]);
+ $user_nickname=$wpdb->escape($userdata[0]);
+ $user_email=$wpdb->escape($userdata[2]);
+ $user_url=$wpdb->escape($userdata[3]);
+ $user_joindate=$wpdb->escape($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_email,user_url,user_registered,user_level) VALUES ('$user_login','$pass1','$user_email','$user_url','$user_joindate','1')";
+ $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($wpdb->escape($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_joindate="1979-06-06 00:41:00";
+ $user_login=$wpdb->escape($post_author);
+ $pass1=$wpdb->escape("password");
+ $user_nickname=$wpdb->escape($post_author);
+ $user_email=$wpdb->escape("user@deleted.com");
+ $user_url=$wpdb->escape("");
+ $user_joindate=$wpdb->escape($user_joindate);
+ $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_email,user_url,user_registered,user_level) VALUES ('$user_login','$pass1','$user_email','$user_url','$user_joindate','0')";
+ $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=$wpdb->escape($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=$wpdb->escape($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=$wpdb->escape($commentinfo[0]);
+ $comment_author_email=$wpdb->escape($commentinfo[2]);
+ $comment_author_url=$wpdb->escape($commentinfo[3]);
+ $comment_author_IP=$wpdb->escape($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=$wpdb->escape($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/wp-inst/wp-admin/import-livejournal.php b/wp-inst/wp-admin/import-livejournal.php
new file mode 100644
index 0000000..ce76638
--- /dev/null
+++ b/wp-inst/wp-admin/import-livejournal.php
@@ -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_once('../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 = $wpdb->escape( 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[', ']]>'), '', $wpdb->escape( 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/wp-inst/wp-admin/import-mt.php b/wp-inst/wp-admin/import-mt.php
new file mode 100644
index 0000000..b520d4c
--- /dev/null
+++ b/wp-inst/wp-admin/import-mt.php
@@ -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_once('../wp-config.php');
+require_once('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 = $wpdb->escape(trim($excerpt[1]));
+ $post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
+
+ // We're going to put extended body into main body with a more tag
+ preg_match("|-----\nEXTENDED BODY:(.*)|s", $post, $extended);
+ $extended = trim($extended[1]);
+ if ('' != $extended) $extended = "\n<!--more-->\n$extended";
+ $post = preg_replace("|(-----\nEXTENDED BODY:.*)|s", '', $post);
+
+ // Now for the main body
+ preg_match("|-----\nBODY:(.*)|s", $post, $body);
+ $body = trim($body[1]);
+ $post_content = $wpdb->escape($body . $extended);
+ $post = preg_replace("|(-----\nBODY:.*)|s", '', $post);
+
+ // Grab the metadata from what's left
+ $metadata = explode("\n", $post);
+ foreach ($metadata as $line) {
+ preg_match("/^(.*?):(.*)/", $line, $token);
+ $key = trim($token[1]);
+ $value = trim($token[2]);
+ // Now we decide what it is and what to do with it
+ switch($key) {
+ case '':
+ break;
+ case 'AUTHOR':
+ $post_author = $value;
+ break;
+ case 'TITLE':
+ $post_title = $wpdb->escape($value);
+ 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[] = $wpdb->escape($value);
+ break;
+ case 'CATEGORY':
+ $post_categories[] = $wpdb->escape($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 = $wpdb->escape(trim($comment_author[1]));
+ $comment = preg_replace('|(\n?AUTHOR:.*)|', '', $comment);
+
+ preg_match("|EMAIL:(.*)|", $comment, $comment_email);
+ $comment_email = $wpdb->escape(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 = $wpdb->escape(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 = $wpdb->escape(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 = $wpdb->escape(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 = $wpdb->escape(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 = $wpdb->escape(trim($ping_title[1]));
+ $ping = preg_replace('|(\n?TITLE:.*)|', '', $ping);
+
+ $comment_content = $wpdb->escape(trim($ping));
+ $comment_content = str_replace('-----', '', $comment_content);
+
+ $comment_content = "<strong>$ping_title</strong>\n\n$comment_content";
+
+ // 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/wp-inst/wp-admin/import-rss.php b/wp-inst/wp-admin/import-rss.php
new file mode 100644
index 0000000..cb7b615
--- /dev/null
+++ b/wp-inst/wp-admin/import-rss.php
@@ -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_once('../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 = $wpdb->escape( 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 = $wpdb->escape( trim($guid[1]) );
+else $guid = '';
+
+preg_match('|<content:encoded>(.*?)</content:encoded>|is', $post, $content);
+$content = str_replace( array('<![CDATA[', ']]>'), '', $wpdb->escape( 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/wp-inst/wp-admin/import-textpattern.php b/wp-inst/wp-admin/import-textpattern.php
new file mode 100644
index 0000000..d2f8173
--- /dev/null
+++ b/wp-inst/wp-admin/import-textpattern.php
@@ -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_once('../wp-config.php');
+require_once('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 = $wpdb->escape($post['Body_html']);
+ $title = $wpdb->escape($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/wp-inst/wp-admin/index.php b/wp-inst/wp-admin/index.php
new file mode 100644
index 0000000..37dbef6
--- /dev/null
+++ b/wp-inst/wp-admin/index.php
@@ -0,0 +1,154 @@
+<?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>
+
+<?php
+if ( $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_approved = '0'") ) :
+?>
+<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s)'), number_format($numcomments) ); ?> &raquo;</a></strong></p>
+<?php endif; ?>
+</div>
+
+<?php endif; ?>
+
+<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>
+
+<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
+require('./admin-footer.php');
+?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/install-helper.php b/wp-inst/wp-admin/install-helper.php
new file mode 100644
index 0000000..86138db
--- /dev/null
+++ b/wp-inst/wp-admin/install-helper.php
@@ -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/wp-inst/wp-admin/install.php b/wp-inst/wp-admin/install.php
new file mode 100644
index 0000000..f5ad4b2
--- /dev/null
+++ b/wp-inst/wp-admin/install.php
@@ -0,0 +1,218 @@
+<?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, '".$wpdb->escape(__('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', '".$wpdb->escape(__('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', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt')");
+
+$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
+
+// Default comment
+$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.'))."')");
+
+// First Page
+
+$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static')");
+
+// Set up admin user
+$random_password = substr(md5(uniqid(microtime())), 0, 6);
+$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_email, user_level, user_registered) VALUES ( '1', 'admin', MD5('$random_password'), '$admin_email', '10', 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/wp-inst/wp-admin/link-add.php b/wp-inst/wp-admin/link-add.php
new file mode 100644
index 0000000..56f2d1e
--- /dev/null
+++ b/wp-inst/wp-admin/link-add.php
@@ -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/wp-inst/wp-admin/link-categories.php b/wp-inst/wp-admin/link-categories.php
new file mode 100644
index 0000000..86f3da3
--- /dev/null
+++ b/wp-inst/wp-admin/link-categories.php
@@ -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 = $_POST['text_before_link'];
+ $text_after_link = $_POST['text_after_link'];
+ $text_after_all = $_POST['text_after_all'];
+
+ $list_limit = $_POST['list_limit'];
+ if ($list_limit == '')
+ $list_limit = -1;
+
+ $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
+ " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" .
+ " VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" .
+ " '$show_rating', '$show_updated', '$sort_order', '$sort_desc', '$text_before_link', '$text_after_link', \n" .
+ " '$text_after_all', $list_limit)");
+
+ 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 = $_POST["text_before_link"];
+ $text_after_link = $_POST["text_after_link"];
+ $text_after_all = $_POST["text_after_all"];
+
+ $list_limit = $_POST["list_limit"];
+ if ($list_limit == '')
+ $list_limit = -1;
+
+ $wpdb->query("UPDATE $wpdb->linkcategories set
+ cat_name='$cat_name',
+ auto_toggle='$auto_toggle',
+ show_images='$show_images',
+ show_description='$show_description',
+ show_rating='$show_rating',
+ show_updated='$show_updated',
+ sort_order='$sort_order',
+ sort_desc='$sort_desc',
+ text_before_link='$text_before_link',
+ text_after_link='$text_after_link',
+ text_after_all='$text_after_all',
+ list_limit=$list_limit
+ WHERE cat_id=$cat_id
+ ");
+ } // end if save
+
+
+ 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/wp-inst/wp-admin/link-import.php b/wp-inst/wp-admin/link-import.php
new file mode 100644
index 0000000..698bd7f
--- /dev/null
+++ b/wp-inst/wp-admin/link-import.php
@@ -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]}', '".$wpdb->escape($names[$i])."', '', $cat_id, '".$wpdb->escape($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
+ $result = $wpdb->query($query);
+ echo sprintf(__("<p>Inserted <strong>%s</strong></p>"), $names[$i]);
+ }
+?>
+ <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
+<?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/wp-inst/wp-admin/link-manager.php b/wp-inst/wp-admin/link-manager.php
new file mode 100644
index 0000000..2f0a140
--- /dev/null
+++ b/wp-inst/wp-admin/link-manager.php
@@ -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>
+ <th scope="row"><?php _e('Visible:') ?></th>
+ <td><label>
+ <input type="radio" name="visible" <?php if ($link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
+<?php _e('Yes') ?></label><br /><label>
+<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked='checked'"; ?> value="N" />
+<?php _e('No') ?></label></td>
+ </tr>
+</table>
+</fieldset>
+<p class="submit"><input type="submit" name="submit" value="<?php _e('Save Changes &raquo;') ?>" />
+ <input type="hidden" name="action" value="editlink" />
+ <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
+ <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
+ <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /></p>
+ </form>
+</div>
+<?php
+ break;
+ } // end linkedit
+ case __("Show"):
+ {
+ if (!isset($cat_id) || ($cat_id == '')) {
+ if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
+ $cat_id = 'All';
+ }
+ $links_show_cat_id = $cat_id;
+ if (!isset($order_by) || ($order_by == '')) {
+ if (!isset($links_show_order) || ($links_show_order == ''))
+ $order_by = 'order_name';
+ }
+ $links_show_order = $order_by;
+ //break; fall through
+ } // end Show
+ case "popup":
+ {
+ $link_url = stripslashes($_GET["linkurl"]);
+ $link_name = stripslashes($_GET["name"]);
+ //break; fall through
+ }
+ default:
+ {
+ if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
+ $cat_id = $links_show_cat_id;
+
+ if (!isset($cat_id) || ($cat_id == '')) {
+ if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
+ $cat_id = 'All';
+ }
+ $links_show_cat_id = $cat_id;
+ if (isset($links_show_order) && ($links_show_order != ''))
+ $order_by = $links_show_order;
+
+ if (!isset($order_by) || ($order_by == ''))
+ $order_by = 'order_name';
+ $links_show_order = $order_by;
+
+ setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
+ setcookie('links_show_order_' . COOKIEHASH, $links_show_order, time()+600);
+ include_once ("./admin-header.php");
+ if ($user_level < 5) {
+ die(__("You do not have sufficient permissions to edit the links for this blog."));
+ }
+
+ switch ($order_by)
+ {
+ case 'order_id': $sqlorderby = 'id'; break;
+ case 'order_url': $sqlorderby = 'url'; break;
+ case 'order_desc': $sqlorderby = 'description'; break;
+ case 'order_owner': $sqlorderby = 'owner'; break;
+ case 'order_rating': $sqlorderby = 'rating'; break;
+ case 'order_name':
+ default: $sqlorderby = 'name'; break;
+ }
+
+ if ($action != "popup") {
+?>
+<script type="text/javascript">
+<!--
+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">
+ <form name="cats" method="post" action="">
+ <table width="75%" cellpadding="3" cellspacing="3">
+ <tr>
+ <td>
+ <?php _e('<strong>Show</strong> links in category:'); ?><br />
+ </td>
+ <td>
+ <?php _e('<strong>Order</strong> by:');?>
+ </td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>
+<?php
+ $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
+ echo " <select name=\"cat_id\">\n";
+ echo " <option value=\"All\"";
+ if ($cat_id == 'All')
+ echo " selected='selected'";
+ echo "> " . __('All') . "</option>\n";
+ foreach ($results as $row) {
+ echo " <option value=\"".$row->cat_id."\"";
+ if ($row->cat_id == $cat_id)
+ echo " selected='selected'";
+ echo ">".$row->cat_id.": ".wp_specialchars($row->cat_name);
+ if ($row->auto_toggle == 'Y')
+ echo ' (auto toggle)';
+ echo "</option>\n";
+ }
+ echo " </select>\n";
+?>
+ </td>
+ <td>
+ <select name="order_by">
+ <option value="order_id" <?php if ($order_by == 'order_id') echo " selected='selected'";?>><?php _e('Link ID') ?></option>
+ <option value="order_name" <?php if ($order_by == 'order_name') echo " selected='selected'";?>><?php _e('Name') ?></option>
+ <option value="order_url" <?php if ($order_by == 'order_url') echo " selected='selected'";?>><?php _e('URI') ?></option>
+ <option value="order_desc" <?php if ($order_by == 'order_desc') echo " selected='selected'";?>><?php _e('Description') ?></option>
+ <option value="order_owner" <?php if ($order_by == 'order_owner') echo " selected='selected'";?>><?php _e('Owner') ?></option>
+ <option value="order_rating" <?php if ($order_by == 'order_rating') echo " selected='selected'";?>><?php _e('Rating') ?></option>
+ </select>
+ </td>
+ <td>
+ <input type="submit" name="action" value="<?php _e('Show') ?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+
+</div>
+
+<form name="links" id="links" method="post" action="">
+<div class="wrap">
+
+ <input type="hidden" name="link_id" value="" />
+ <input type="hidden" name="action" value="" />
+ <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
+ <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
+ <table width="100%" cellpadding="3" cellspacing="3">
+ <tr>
+ <th width="15%"><?php _e('Name') ?></th>
+ <th><?php _e('URI') ?></th>
+ <th><?php _e('Category') ?></th>
+ <th><?php _e('rel') ?></th>
+ <th><?php _e('Image') ?></th>
+ <th><?php _e('Visible') ?></th>
+ <th colspan="2"><?php _e('Action') ?></th>
+ <th>&nbsp;</th>
+ </tr>
+<?php
+ $sql = "SELECT link_url, link_name, link_image, link_description, link_visible,
+ link_category AS cat_id, cat_name AS category, $wpdb->users.user_login, link_id,
+ link_rating, link_rel, $wpdb->users.user_level
+ FROM $wpdb->links
+ LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id
+ LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->links.link_owner ";
+
+ if (isset($cat_id) && ($cat_id != 'All')) {
+ $sql .= " WHERE link_category = $cat_id ";
+ }
+ $sql .= ' ORDER BY link_' . $sqlorderby;
+
+ // echo "$sql";
+ $links = $wpdb->get_results($sql);
+ if ($links) {
+ foreach ($links as $link) {
+ $link->link_name = wp_specialchars($link->link_name);
+ $link->link_category = wp_specialchars($link->link_category);
+ $link->link_description = wp_specialchars($link->link_description);
+ $link->link_url = wp_specialchars($link->link_url);
+ $short_url = str_replace('http://', '', $link->link_url);
+ $short_url = str_replace('www.', '', $short_url);
+ if ('/' == substr($short_url, -1))
+ $short_url = substr($short_url, 0, -1);
+ if (strlen($short_url) > 35)
+ $short_url = substr($short_url, 0, 32).'...';
+
+ $image = ($link->link_image != null) ? __('Yes') : __('No');
+ $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
+ ++$i;
+ $style = ($i % 2) ? ' class="alternate"' : '';
+?>
+ <tr valign="middle" <?php echo $style; ?>>
+ <td><strong><?php echo $link->link_name; ?></strong><br />
+<?php
+ echo sprintf(__('Description: %s'), $link->link_description) . "</td>";
+ echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>";
+ echo <<<LINKS
+ <td>$link->category</td>
+ <td>$link->link_rel</td>
+ <td align='center'>$image</td>
+ <td align='center'>$visible</td>
+LINKS;
+ $show_buttons = 1; // default
+
+ if ($link->user_level > $user_level) {
+ $show_buttons = 0;
+ }
+
+ if ($show_buttons) {
+ echo '<td><a href="link-manager.php?link_id=' . $link->link_id . '&amp;action=linkedit" class="edit">' . __('Edit') . '</a></td>';
+ echo '<td><a href="link-manager.php?link_id=' . $link->link_id . '&amp;action=Delete"' . " onclick=\"return confirm('" . __("You are about to delete this link.\\n \'Cancel\' to stop, \'OK\' to delete.") . "');" . '" class="delete">' . __('Delete') . '</a></td>';
+ echo '<td><input type="checkbox" name="linkcheck[]" value="' . $link->link_id . '" /></td>';
+ } else {
+ echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>\n";
+ }
+ echo "\n\t</tr>";
+ }
+ }
+?>
+</table>
+
+</div>
+
+<div class="wrap">
+ <table width="100%" cellpadding="3" cellspacing="3">
+ <tr><th colspan="4"><?php _e('Manage Multiple Links:') ?></th></tr>
+ <tr><td colspan="4"><?php _e('Use the checkboxes on the right to select multiple links and choose an action below:') ?></td></tr>
+ <tr>
+ <td>
+ <?php _e('Assign ownership to:'); ?>
+<?php
+ $results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level > 0 ORDER BY ID");
+ echo " <select name=\"newowner\" size=\"1\">\n";
+ foreach ($results as $row) {
+ echo " <option value=\"".$row->ID."\"";
+ echo ">".$row->user_login;
+ echo "</option>\n";
+ }
+ echo " </select>\n";
+?>
+ <input name="assign" type="submit" id="assign" value="<?php _e('Go') ?>" />
+ </td>
+ <td>
+ <input name="visibility" type="submit" id="visibility" value="<?php _e('Toggle Visibility') ?>" />
+ </td>
+ <td>
+ <?php _e('Move to category:'); category_dropdown('category'); ?> <input name="move" type="submit" id="move" value="<?php _e('Go') ?>" />
+ </td>
+ <td align="right">
+ <a href="#" onclick="checkAll(document.getElementById('links')); return false; "><?php _e('Toggle Checkboxes') ?></a>
+ </td>
+ </tr>
+</table>
+
+<?php
+ } // end if !popup
+?>
+</div>
+</form>
+
+
+<?php
+ break;
+ } // end default
+} // end case
+?>
+
+<?php include('admin-footer.php'); ?>
diff --git a/wp-inst/wp-admin/link-parse-opml.php b/wp-inst/wp-admin/link-parse-opml.php
new file mode 100644
index 0000000..8ec0465
--- /dev/null
+++ b/wp-inst/wp-admin/link-parse-opml.php
@@ -0,0 +1,65 @@
+<?php
+require_once('../wp-config.php');
+
+// columns we wish to find are: link_url, link_name, link_target, link_description
+// we need to map XML attribute names to our columns
+$opml_map = array('URL' => 'link_url',
+ 'HTMLURL' => 'link_url',
+ 'TEXT' => 'link_name',
+ 'TITLE' => 'link_name',
+ 'TARGET' => 'link_target',
+ 'DESCRIPTION' => 'link_description',
+ 'XMLURL' => 'link_rss'
+);
+
+$map = $opml_map;
+
+/**
+ ** startElement()
+ ** Callback function. Called at the start of a new xml tag.
+ **/
+function startElement($parser, $tagName, $attrs) {
+ global $updated_timestamp, $all_links, $map;
+ global $names, $urls, $targets, $descriptions, $feeds;
+
+ if ($tagName == 'OUTLINE') {
+ foreach (array_keys($map) as $key) {
+ if (isset($attrs[$key])) {
+ $$map[$key] = $attrs[$key];
+ }
+ }
+
+ //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
+
+ // save the data away.
+ $names[] = $link_name;
+ $urls[] = $link_url;
+ $targets[] = $link_target;
+ $feeds[] = $link_rss;
+ $descriptions[] = $link_description;
+ } // end if outline
+}
+
+/**
+ ** endElement()
+ ** Callback function. Called at the end of an xml tag.
+ **/
+function endElement($parser, $tagName) {
+ // nothing to do.
+}
+
+// Create an XML parser
+$xml_parser = xml_parser_create();
+
+// Set the functions to handle opening and closing tags
+xml_set_element_handler($xml_parser, "startElement", "endElement");
+
+if (!xml_parse($xml_parser, $opml, true)) {
+ echo(sprintf("XML error: %s at line %d",
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser)));
+}
+
+// Free up memory used by the XML parser
+xml_parser_free($xml_parser);
+?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/menu-header.php b/wp-inst/wp-admin/menu-header.php
new file mode 100644
index 0000000..b661146
--- /dev/null
+++ b/wp-inst/wp-admin/menu-header.php
@@ -0,0 +1,58 @@
+<ul id="adminmenu">
+<?php
+$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
+$self = preg_replace('|^.*/plugins/|i', '', $self);
+
+get_admin_page_parent();
+
+foreach ($menu as $item) {
+ $class = '';
+
+ // 0 = name, 1 = user_level, 2 = file
+ if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
+
+ if ($user_level >= $item[1]) {
+ if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
+ echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
+ else
+ echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
+ }
+}
+
+?>
+ <li class="last"><a href="<?php echo get_settings('siteurl')
+ ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php printf(__('Logout (%s)'), $user_identity) ?></a></li>
+</ul>
+
+<?php
+// Sub-menu
+if ( isset($submenu["$parent_file"]) ) :
+?>
+<ul id="adminmenu2">
+<?php
+foreach ($submenu["$parent_file"] as $item) :
+ if ($user_level < $item[1]) {
+ continue;
+ }
+
+if ( isset($submenu_file) ) {
+ if ( $submenu_file == $item[2] ) $class = ' class="current"';
+ else $class = '';
+} else if ( (isset($plugin_page) && $plugin_page == $item[2]) || (!isset($plugin_page) && $self == $item[2]) ) $class = ' class="current"';
+else $class = '';
+
+$menu_hook = get_plugin_page_hook($item[2], $parent_file);
+
+if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
+ if ( 'admin.php' == $pagenow )
+ echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
+ else
+ echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
+ } else {
+ echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
+ }
+endforeach;
+?>
+
+</ul>
+<?php endif; ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/menu.php b/wp-inst/wp-admin/menu.php
new file mode 100644
index 0000000..8055d38
--- /dev/null
+++ b/wp-inst/wp-admin/menu.php
@@ -0,0 +1,67 @@
+<?php
+// This array constructs the admin menu bar.
+//
+// Menu item name
+// The minimum level the user needs to access the item: between 0 and 10
+// The URL of the item's file
+$menu[0] = array(__('Dashboard'), 0, 'index.php');
+if( $wpblog == 'main' && $user_level == 10) {
+ $menu[1] = array(__('Site Admin'), 10, 'wpmu-admin.php' );
+}
+$menu[5] = array(__('Write'), 1, 'post.php');
+$menu[10] = array(__('Manage'), 1, 'edit.php');
+$menu[20] = array(__('Links'), 5, 'link-manager.php');
+$menu[25] = array(__('Presentation'), 8, 'themes.php');
+$menu[30] = array(__('Plugins'), 8, 'plugins.php');
+$menu[35] = array(__('Users'), 0, 'profile.php');
+$menu[40] = array(__('Options'), 6, 'options-general.php');
+
+if ( get_option('use_fileupload') )
+ $menu[45] = array(__('Upload'), get_settings('fileupload_minlevel'), 'upload.php');
+
+$submenu[ 'wpmu-admin.php' ][5] = array( 'Blogs', 10, 'wpmu-blogs.php' );
+$submenu[ 'wpmu-admin.php' ][10] = array( 'Users', 10, 'wpmu-users.php' );
+$submenu['post.php'][5] = array(__('Write Post'), 1, 'post.php');
+$submenu['post.php'][10] = array(__('Write Page'), 5, 'page-new.php');
+
+$submenu['edit.php'][5] = array(__('Posts'), 1, 'edit.php');
+$submenu['edit.php'][10] = array(__('Pages'), 5, 'edit-pages.php');
+$submenu['edit.php'][15] = array(__('Categories'), 1, 'categories.php');
+$submenu['edit.php'][20] = array(__('Comments'), 1, 'edit-comments.php');
+$referers = $wpdb->get_var( "SELECT sum( visitTimes ) FROM referer_visitLog WHERE blogID='".$wpblog."' AND dayofmonth='".date( 'j' )."'" );
+$submenu['edit.php'][21] = array(sprintf(__("Referers (%s)"), $referers ), 1, 'referers.php' );
+$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
+$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), $awaiting_mod), 1, 'moderation.php');
+$submenu['edit.php'][30] = array(__('Files'), 8, 'templates.php');
+
+$submenu['link-manager.php'][5] = array(__('Manage Links'), 5, 'link-manager.php');
+$submenu['link-manager.php'][10] = array(__('Add Link'), 5, 'link-add.php');
+$submenu['link-manager.php'][15] = array(__('Link Categories'), 5, 'link-categories.php');
+$submenu['link-manager.php'][20] = array(__('Import Links'), 5, 'link-import.php');
+
+$submenu['profile.php'][5] = array(__('Your Profile'), 0, 'profile.php');
+$submenu['profile.php'][10] = array(__('Authors &amp; Users'), 5, 'users.php');
+
+$submenu['options-general.php'][5] = array(__('General'), 6, 'options-general.php');
+$submenu['options-general.php'][10] = array(__('Writing'), 6, 'options-writing.php');
+$submenu['options-general.php'][15] = array(__('Reading'), 6, 'options-reading.php');
+$submenu['options-general.php'][20] = array(__('Discussion'), 6, 'options-discussion.php');
+$submenu['options-general.php'][30] = array(__('Miscellaneous'), 6, 'options-misc.php');
+
+$submenu['plugins.php'][5] = array(__('Plugins'), 8, 'plugins.php');
+
+$submenu['themes.php'][5] = array(__('Themes'), 8, 'themes.php');
+
+// Create list of page plugin hook names.
+foreach ($menu as $menu_page) {
+ $admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
+}
+
+do_action('admin_menu', '');
+ksort($menu); // make it all pretty
+
+if (! user_can_access_admin_page()) {
+ die( __('You do not have sufficient permissions to access this page.') );
+}
+
+?>
diff --git a/wp-inst/wp-admin/moderation.php b/wp-inst/wp-admin/moderation.php
new file mode 100644
index 0000000..3428bdf
--- /dev/null
+++ b/wp-inst/wp-admin/moderation.php
@@ -0,0 +1,220 @@
+<?php
+require_once('admin.php');
+
+$title = __('Moderate comments');
+$parent_file = 'edit.php';
+
+$wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+$comment = array();
+if (isset($_POST["comment"])) {
+ foreach ($_POST["comment"] as $k => $v) {
+ $comment[intval($k)] = $v;
+ }
+}
+
+switch($action) {
+
+case 'update':
+
+ if ($user_level < 3) {
+ die(__('<p>Your level is not high enough to moderate comments.</p>'));
+ }
+
+ $item_ignored = 0;
+ $item_deleted = 0;
+ $item_approved = 0;
+ $item_spam = 0;
+
+ foreach($comment as $key => $value) {
+ if ($feelinglucky && 'later' == $value)
+ $value = 'delete';
+ switch($value) {
+ case 'later':
+ // do nothing with that comment
+ // wp_set_comment_status($key, "hold");
+ ++$item_ignored;
+ break;
+ case 'delete':
+ wp_set_comment_status($key, 'delete');
+ ++$item_deleted;
+ break;
+ case 'spam':
+ wp_set_comment_status($key, 'spam');
+ ++$item_spam;
+ break;
+ case 'approve':
+ wp_set_comment_status($key, 'approve');
+ if ( get_settings('comments_notify') == true ) {
+ wp_notify_postauthor($key);
+ }
+ ++$item_approved;
+ break;
+ }
+ }
+
+ $file = basename(__FILE__);
+ header("Location: $file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam");
+ exit();
+
+break;
+
+default:
+
+require_once('admin-header.php');
+
+if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored']) ) {
+ echo "<div class='updated'>\n<p>";
+ $approved = (int) $_GET['approved'];
+ $deleted = (int) $_GET['deleted'];
+ $ignored = (int) $_GET['ignored'];
+ $spam = (int) $_GET['spam'];
+ if ($approved) {
+ if ('1' == $approved) {
+ echo __("1 comment approved <br />") . "\n";
+ } else {
+ echo sprintf(__("%s comments approved <br />"), $approved) . "\n";
+ }
+ }
+ if ($deleted) {
+ if ('1' == $deleted) {
+ echo __("1 comment deleted <br />") . "\n";
+ } else {
+ echo sprintf(__("%s comments deleted <br />"), $deleted) . "\n";
+ }
+ }
+ if ($spam) {
+ if ('1' == $spam) {
+ echo __("1 comment marked as spam <br />") . "\n";
+ } else {
+ echo sprintf(__("%s comments marked as spam <br />"), $spam) . "\n";
+ }
+ }
+ if ($ignored) {
+ if ('1' == $ignored) {
+ echo __("1 comment unchanged <br />") . "\n";
+ } else {
+ echo sprintf(__("%s comments unchanged <br />"), $ignored) . "\n";
+ }
+ }
+ echo "</p></div>\n";
+}
+
+?>
+
+<div class="wrap">
+
+<?php
+if ($user_level > 3)
+ $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");
+else
+ $comments = '';
+
+if ($comments) {
+ // list all comments that are waiting for approval
+ $file = basename(__FILE__);
+?>
+ <h2><?php _e('Moderation Queue') ?></h2>
+ <form name="approval" action="moderation.php" method="post">
+ <input type="hidden" name="action" value="update" />
+ <ol id="comments" class="commentlist">
+<?php
+$i = 0;
+ foreach($comments as $comment) {
+ ++$i;
+ $comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $comment->comment_date);
+ $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'");
+ if ($i % 2) $class = 'class="alternate"';
+ else $class = '';
+ echo "\n\t<li id='comment-$comment->comment_ID' $class>";
+ ?>
+ <p><strong><?php _e('Name:') ?></strong> <?php comment_author_link() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_email) { ?> | <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
+echo '<a href="post.php?action=editcomment&amp;comment='.$comment->comment_ID.'">' . __('Edit') . '</a> | ';?>
+<a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a> |
+<?php
+echo " <a href=\"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 just this comment') . "</a> | "; ?> <?php _e('Bulk action:') ?>
+ <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-approve" value="approve" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-approve"><?php _e('Approve') ?></label>
+ <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-spam" value="spam" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-spam"><?php _e('Spam') ?></label>
+ <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-delete" value="delete" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-delete"><?php _e('Delete') ?></label>
+ <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-nothing" value="later" checked="checked" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-nothing"><?php _e('Defer until later') ?></label>
+ </p>
+
+ </li>
+<?php
+ }
+?>
+ </ol>
+
+ <p class="submit"><input type="submit" name="submit" value="<?php _e('Moderate Comments &raquo;') ?>" /></p>
+<script type="text/javascript">
+// <![CDATA[
+function markAllForDelete() {
+ for (var i=0; i< document.approval.length; i++) {
+ if (document.approval[i].value == "delete") {
+ document.approval[i].checked = true;
+ }
+ }
+}
+function markAllForApprove() {
+ for (var i=0; i< document.approval.length; i++) {
+ if (document.approval[i].value == "approve") {
+ document.approval[i].checked = true;
+ }
+ }
+}
+function markAllForDefer() {
+ for (var i=0; i< document.approval.length; i++) {
+ if (document.approval[i].value == "later") {
+ document.approval[i].checked = true;
+ }
+ }
+}
+function markAllAsSpam() {
+ for (var i=0; i< document.approval.length; i++) {
+ if (document.approval[i].value == "spam") {
+ document.approval[i].checked = true;
+ }
+ }
+}
+document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark all for approval'); ?></a></li><li><a href="javascript:markAllAsSpam()"><?php _e('Mark all as spam'); ?></a></li><li><a href="javascript:markAllForDelete()"><?php _e('Mark all for deletion'); ?></a></li><li><a href="javascript:markAllForDefer()"><?php _e('Mark all for later'); ?></a></li></ul>');
+// ]]>
+</script>
+
+<noscript>
+ <p>
+ <input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can&#8217;t be undone.</strong>'); ?></label>
+ </p>
+</noscript>
+ </form>
+<?php
+} else {
+ // nothing to approve
+ echo __("<p>Currently there are no comments for you to moderate.</p>") . "\n";
+}
+?>
+
+</div>
+
+<?php
+
+break;
+}
+
+
+include('admin-footer.php') ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/options-discussion.php b/wp-inst/wp-admin/options-discussion.php
new file mode 100644
index 0000000..e3732ec
--- /dev/null
+++ b/wp-inst/wp-admin/options-discussion.php
@@ -0,0 +1,100 @@
+<?php
+require_once('admin.php');
+
+$title = __('Discussion Options');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+
+if ($action == 'retrospam') {
+ if ( $_GET['move'] == 'true' ) {
+ retrospam_mgr::move_spam( $_GET[ids] );
+ }
+ $retrospaminator = new retrospam_mgr();
+ $result = $retrospaminator->find_spam();
+ echo $retrospaminator->display_edit_form( $result );
+ include('./admin-footer.php');
+ exit;
+}
+?>
+
+<div class="wrap">
+ <h2><?php _e('Discussion Options') ?></h2>
+ <form name="form1" method="post" action="options.php">
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="page_options" value="'default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_whitelist','comment_max_links','moderation_keys','blacklist_keys','open_proxy_check'" />
+<fieldset class="options">
+ <legend><?php _e('Usual settings for an article: <em>(These settings may be overridden for individual articles.)</em>') ?></legend>
+ <ul>
+ <li>
+ <label for="default_pingback_flag">
+ <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_settings('default_pingback_flag')); ?> />
+ <?php _e('Attempt to notify any Weblogs linked to from the article (slows down posting.)') ?></label>
+ </li>
+ <li>
+ <label for="default_ping_status">
+ <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_settings('default_ping_status')); ?> />
+ <?php _e('Allow link notifications from other Weblogs (pingbacks and trackbacks.)') ?></label>
+ </li>
+ <li>
+ <label for="default_comment_status">
+ <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_settings('default_comment_status')); ?> />
+ <?php _e('Allow people to post comments on the article') ?></label>
+ </li>
+ </ul>
+</fieldset>
+<fieldset class="options">
+ <legend><?php _e('E-mail me whenever:') ?></legend>
+ <ul>
+ <li>
+ <label for="comments_notify">
+ <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_settings('comments_notify')); ?> />
+ <?php _e('Anyone posts a comment') ?> </label>
+ </li>
+ <li>
+ <label for="moderation_notify">
+ <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_settings('moderation_notify')); ?> />
+ <?php _e('A comment is held for moderation') ?> </label>
+ </li>
+ </ul>
+</fieldset>
+<fieldset class="options">
+ <legend><?php _e('Before a comment appears:') ?></legend>
+ <ul>
+ <li>
+ <label for="comment_moderation">
+ <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_settings('comment_moderation')); ?> />
+ <?php _e('An administrator must approve the comment (regardless of any matches below)') ?> </label>
+ </li>
+ <li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_settings('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li>
+ <li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_settings('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li>
+ </ul>
+</fieldset>
+<fieldset class="options">
+ <legend><?php _e('Comment Moderation') ?></legend>
+ <p><?php printf(__('Hold a comment in the queue if it contains more than %s links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_settings('comment_max_links'). '" />' ) ?></p>
+
+ <p><?php _e('When a comment contains any of these words in its content, name, URI, e-mail, or IP, hold it in the moderation queue: (Separate multiple words with new lines.) <a href="http://codex.wordpress.org/Spam_Words">Common spam words</a>.') ?></p>
+ <p>
+ <textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
+ </p>
+ <p>
+ <a id="retrospambutton" href="options-discussion.php?action=retrospam"><?php _e('Check past comments against moderation list'); ?></a>
+ </p>
+</fieldset>
+<fieldset class="options">
+ <legend><?php _e('Comment Blacklist') ?></legend>
+ <p><?php _e('This is a list of words that you want completely blacklisted from your blog. Be very careful what you add here, because if a comment matches something here it will be completely nuked and there will be no notification. Remember that partial words can match, so if there is any chance something here might match it would be better to put it in the moderation box above.') ?></p>
+ <p>
+ <textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
+ </p>
+ <p><label for="open_proxy_check">
+ <input name="open_proxy_check" type="checkbox" id="open_proxy_check" value="1" <?php checked('1', get_settings('open_proxy_check')); ?> />
+ <?php _e('Blacklist comments from open and insecure proxies.') ?></label></p>
+</fieldset>
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?>" />
+ </p>
+ </form>
+</div>
+<?php include('./admin-footer.php'); ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/options-general.php b/wp-inst/wp-admin/options-general.php
new file mode 100644
index 0000000..2a09684
--- /dev/null
+++ b/wp-inst/wp-admin/options-general.php
@@ -0,0 +1,91 @@
+<?php
+require_once('admin.php');
+
+$title = __('General Options');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+?>
+
+<div class="wrap">
+ <h2><?php _e('General Options') ?></h2>
+ <form name="form1" method="post" action="options.php">
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'blogname','blogdescription','admin_email','users_can_register','gmt_offset','date_format','time_format','start_of_week','comment_registration'" />
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th width="33%" scope="row"><?php _e('Weblog title:') ?></th>
+ <td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Tagline:') ?></th>
+ <td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php form_option('blogdescription'); ?>" size="45" />
+ <br />
+<?php _e('In a few words, explain what this weblog is about.') ?></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('E-mail address:') ?> </th>
+ <td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" size="40" class="code" />
+ <br />
+<?php _e('This address is used only for admin purposes.') ?></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Membership:') ?></th>
+ <td> <label for="users_can_register">
+ <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_settings('users_can_register')); ?> />
+ <?php _e('Anyone can register') ?></label><br />
+ <label for="comment_registration">
+ <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_settings('comment_registration')); ?> />
+ <?php _e('Users must be registered and logged in to comment') ?>
+ </label>
+</td>
+ </tr>
+ </table>
+ <fieldset class="options">
+ <legend><?php _e('Date and Time') ?></legend>
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr>
+ <th scope="row" width="33%"><?php _e('<abbr title="Coordinated Universal Time">UTC</abbr> time is:') ?> </th>
+ <td><code><?php echo gmdate('Y-m-d g:i:s a'); ?></code></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Times in the weblog should differ by:') ?> </th>
+ <td><input name="gmt_offset" type="text" id="gmt_offset" size="2" value="<?php form_option('gmt_offset'); ?>" />
+ <?php _e('hours') ?> </td>
+ </tr>
+ <tr>
+ <th scope="row">&nbsp;</th>
+ <td><?php _e('The following use the same syntax as the <a href="http://php.net/date">PHP <code>date()</code> function</a>. Save option to update sample output.') ?> </td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Default date format:') ?></th>
+ <td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
+<?php _e('Output:') ?> <strong><?php echo mysql2date(get_settings('date_format'), current_time('mysql')); ?></strong></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Default time format:') ?></th>
+ <td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
+<?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('time_format'), current_time('timestamp')); ?></strong></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Weeks in the calendar should start on:') ?></th>
+ <td><select name="start_of_week" id="start_of_week">
+ <?php
+for ($day_index = 0; $day_index <= 6; $day_index++) :
+ if ($day_index == get_settings('start_of_week')) $selected = " selected='selected'";
+ else $selected = '';
+echo "\n\t<option value='$day_index' $selected>$weekday[$day_index]</option>";
+endfor;
+?>
+</select></td>
+ </tr>
+
+</table>
+
+ </fieldset>
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+ </p>
+ </form>
+</div>
+<?php include("admin-footer.php") ?>
diff --git a/wp-inst/wp-admin/options-head.php b/wp-inst/wp-admin/options-head.php
new file mode 100644
index 0000000..7fc54d6
--- /dev/null
+++ b/wp-inst/wp-admin/options-head.php
@@ -0,0 +1,24 @@
+<?php
+
+$wpvarstoreset = array('action','standalone', 'option_group_id');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+?>
+
+<br clear="all" />
+
+<?php if (isset($_GET['updated'])) : ?>
+<div class="updated"><p><strong><?php _e('Options saved.') ?></strong></p></div>
+<?php endif; ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/options-misc.php b/wp-inst/wp-admin/options-misc.php
new file mode 100644
index 0000000..190192e
--- /dev/null
+++ b/wp-inst/wp-admin/options-misc.php
@@ -0,0 +1,46 @@
+<?php
+require_once('admin.php');
+
+$title = __('Miscellaneous Options');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+
+?>
+
+<div class="wrap">
+<h2><?php _e('Miscellaneous Options') ?></h2>
+<form name="miscoptions" method="post" action="options.php">
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="page_options" value="'hack_file','use_fileupload','fileupload_minlevel','use_geo_positions','use_linksupdate'" />
+ <fieldset class="options">
+ <legend>
+ <input name="use_fileupload" type="checkbox" id="use_fileupload" value="1" <?php checked('1', get_settings('use_fileupload')); ?> />
+ <label for="use_fileupload"><?php _e('Allow File Uploads') ?></label></legend>
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr>
+ <th scope="row"><?php _e('Minimum level to upload:') ?></th>
+ <td><select name="fileupload_minlevel" id="fileupload_minlevel">
+ <?php
+ for ($i = 1; $i < 11; $i++) {
+ if ($i == get_settings('fileupload_minlevel')) $selected = " selected='selected'";
+ else $selected = '';
+ echo "\n\t<option value='$i' $selected>$i</option>";
+ }
+ ?>
+ </select></td>
+ </tr>
+ </table>
+ </fieldset>
+ <p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_settings('use_linksupdate')); ?> />
+ <label for="use_linksupdate"><?php _e('Track Links&#8217; Update Times') ?></label></p>
+ <p>
+ <label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_settings('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label>
+ </p>
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+ </p>
+</form>
+</div>
+
+<?php include('./admin-footer.php'); ?>
diff --git a/wp-inst/wp-admin/options-permalink.php b/wp-inst/wp-admin/options-permalink.php
new file mode 100644
index 0000000..d080b4b
--- /dev/null
+++ b/wp-inst/wp-admin/options-permalink.php
@@ -0,0 +1,116 @@
+<?php
+require_once('admin.php');
+
+$title = __('Permalink Options');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+
+$home_path = get_home_path();
+
+if ( isset($_POST) ) {
+ if ( isset($_POST['permalink_structure']) ) {
+ $permalink_structure = $_POST['permalink_structure'];
+ if (! empty($permalink_structure) )
+ $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
+ $wp_rewrite->set_permalink_structure($permalink_structure);
+ }
+
+ if ( isset($_POST['category_base']) ) {
+ $category_base = $_POST['category_base'];
+ if (! empty($category_base) )
+ $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
+ $wp_rewrite->set_category_base($category_base);
+ }
+}
+
+$permalink_structure = get_settings('permalink_structure');
+$category_base = get_settings('category_base');
+
+generate_page_rewrite_rules();
+
+if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
+ $writable = true;
+else
+ $writable = false;
+
+if ($wp_rewrite->using_index_permalinks())
+ $usingpi = true;
+else
+ $usingpi = false;
+
+save_mod_rewrite_rules();
+?>
+
+<?php if (isset($_POST['submit'])) : ?>
+<div class="updated"><p><?php
+if ($writable)
+ _e('Permalink structure updated.');
+else
+ _e('You should update your .htaccess now.');
+?></p></div>
+<?php endif; ?>
+
+<div class="wrap">
+ <h2><?php _e('Edit Permalink Structure') ?></h2>
+ <p><?php _e('By default WordPress uses web URIs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URI structure for your permalinks and archives. This can improve the aesthetics, usability, and longevity of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
+
+<?php if ($is_apache) : ?>
+<dl>
+<dt><?php _e('Structure'); ?>: <code>/%year%/%monthnum%/%day%/%postname%/</code></dt>
+ <strong>
+ <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home') . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></dd>
+ </strong>
+ <dt><?php _e('Structure'); ?>: <code>/archives/%post_id%</code></dt>
+ <strong>
+ <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home'); ?>/archives/123</code></dd>
+ </strong>
+ <dt></dt>
+</dl>
+
+<p><?php _e('For the above to work you must have something called <code>mod_rewrite</code> installed on your server. (Ask your host.) If that isn&#8217;t available, you can prefix the structure with <code>/index.php/</code> . This is the recommend method if you are on any web server but Apache.'); ?></p>
+
+<?php else : ?>
+<dl>
+<dt><?php _e('Structure'); ?>: <code>/index.php/%year%/%monthnum%/%day%/%postname%/</code></dt>
+ <strong>
+ <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home') . '/index.php/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></dd>
+ </strong>
+ <dt><?php _e('Structure'); ?>: <code>/index.php/archives/%post_id%</code></dt>
+ <strong>
+ <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home'); ?>/index.php/archives/123</code></dd>
+ </strong>
+ <dt></dt>
+</dl>
+<?php endif; ?>
+
+ <form name="form" action="options-permalink.php" method="post">
+ <p><?php _e('Use the template tags above to create a virtual site structure:') ?></p>
+ <p>
+ <?php _e('Structure'); ?>: <input name="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo $permalink_structure; ?>" size="50" />
+ </p>
+<?php if ($is_apache) : ?>
+ <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/taxonomy/categorias</code> would make your category links like <code>http://example.org/taxonomy/categorias/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
+<?php else : ?>
+ <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/index.php/taxonomy/categorias</code> would make your category links like <code>http://example.org/index.php/taxonomy/categorias/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
+<?php endif; ?>
+ <p>
+ <?php _e('Category base'); ?>: <input name="category_base" type="text" class="code" value="<?php echo $category_base; ?>" size="30" />
+ </p>
+ <p class="submit">
+ <input type="submit" name="submit" value="<?php _e('Update Permalink Structure &raquo;') ?>" />
+ </p>
+ </form>
+<?php if ( $permalink_structure && !$usingpi && !$writable ) : ?>
+ <p><?php _e('If your <code>.htaccess</code> was <a href="http://codex.wordpress.org/Make_a_Directory_Writable">writable</a> we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
+<form action="options-permalink.php" method="post">
+ <p>
+<textarea rows="5" style="width: 98%;" name="rules"><?php echo $wp_rewrite->mod_rewrite_rules(); ?>
+</textarea>
+ </p>
+</form>
+<?php endif; ?>
+
+</div>
+
+<?php require('./admin-footer.php'); ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/options-reading.php b/wp-inst/wp-admin/options-reading.php
new file mode 100644
index 0000000..b9b4933
--- /dev/null
+++ b/wp-inst/wp-admin/options-reading.php
@@ -0,0 +1,63 @@
+<?php
+require_once('admin.php');
+
+$title = __('Reading Options');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+?>
+
+<div class="wrap">
+<h2><?php _e('Reading Options') ?></h2>
+<form name="form1" method="post" action="options.php">
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="page_options" value="'posts_per_page','what_to_show','posts_per_rss','rss_use_excerpt','blog_charset','gzipcompression' " />
+ <fieldset class="options">
+ <legend><?php _e('Blog Pages') ?></legend>
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th width="33%" scope="row"><?php _e('Show at most:') ?></th>
+ <td>
+ <input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" />
+ <select name="what_to_show" id="what_to_show" >
+ <option value="days" <?php selected('days', get_settings('what_to_show')); ?>><?php _e('days') ?></option>
+ <option value="posts" <?php selected('posts', get_settings('what_to_show')); ?>><?php _e('posts') ?></option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset class="options">
+ <legend><?php _e('Syndication Feeds') ?></legend>
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th width="33%" scope="row"><?php _e('Show the most recent:') ?></th>
+ <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('For each article, show:') ?> </th>
+ <td>
+ <label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_settings('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br />
+ <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_settings('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th width="33%" scope="row"><?php _e('Encoding for pages and feeds:') ?></th>
+ <td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" size="20" class="code" /><br />
+ <?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
+ </tr>
+ </table>
+ <p>
+ <label><input type="checkbox" name="gzipcompression" value="1" <?php checked('1', get_settings('gzipcompression')); ?> />
+ <?php _e('WordPress should compress articles (gzip) if browsers ask for them') ?></label>
+ </p>
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+ </p>
+</form>
+</div>
+<?php include('./admin-footer.php'); ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/options-writing.php b/wp-inst/wp-admin/options-writing.php
new file mode 100644
index 0000000..792e3be
--- /dev/null
+++ b/wp-inst/wp-admin/options-writing.php
@@ -0,0 +1,101 @@
+<?php
+require_once('admin.php');
+
+$title = __('Writing Options');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+?>
+
+<div class="wrap">
+ <h2><?php _e('Writing Options') ?></h2>
+ <form name="form1" method="post" action="options.php">
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','use_balanceTags','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category','default_email_category','new_users_can_blog'" />
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th width="33%" scope="row"> <?php _e('Size of the post box:') ?></th>
+ <td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
+ <?php _e('lines') ?></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Formatting:') ?></th>
+ <td> <label for="label">
+ <input name="use_smilies" type="checkbox" id="label" value="1" <?php checked('1', get_settings('use_smilies')); ?> />
+ <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label> <br /> <label for="label2">
+ <input name="use_balanceTags" type="checkbox" id="label2" value="1" <?php checked('1', get_settings('use_balanceTags')); ?> />
+ <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Default post category:') ?></th>
+ <td><select name="default_category" id="default_category">
+<?php
+$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
+foreach ($categories as $category) :
+if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'";
+else $selected = '';
+ echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
+endforeach;
+?>
+ </select></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Newly registered members:') ?></th>
+ <td> <label for="new_users_can_blog0"><input name="new_users_can_blog" id="new_users_can_blog0" type="radio" value="0" <?php checked('0', get_settings('new_users_can_blog')); ?> /> <?php _e('Cannot write articles') ?></label><br />
+<label for="new_users_can_blog1"><input name="new_users_can_blog" id="new_users_can_blog1" type="radio" value="1" <?php checked('1', get_settings('new_users_can_blog')); ?> /> <?php _e('May submit drafts for review') ?></label><br />
+<label for="new_users_can_blog2"><input name="new_users_can_blog" id="new_users_can_blog2" type="radio" value="2" <?php checked('2', get_settings('new_users_can_blog')); ?> /> <?php _e('May publish articles') ?></label><br /></td>
+ </tr>
+</table>
+
+<fieldset class="options">
+ <legend><?php _e('Writing by e-mail') ?></legend>
+ <p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <code>%s</code>, <code>%s</code>, <code>%s</code>.'), substr(md5(uniqid(microtime())),0,5), substr(md5(uniqid(microtime())),0,5), substr(md5(uniqid(microtime())),0,5)) ?></p>
+
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th scope="row"><?php _e('Mail server:') ?></th>
+ <td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
+ <label for="mailserver_port"><?php _e('Port:') ?></label>
+ <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
+ </td>
+ </tr>
+ <tr valign="top">
+ <th width="33%" scope="row"><?php _e('Login name:') ?></th>
+ <td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" size="40" /></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Password:') ?></th>
+ <td>
+ <input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" size="40" />
+ </td>
+ </tr>
+ <tr valign="top">
+ <th scope="row"><?php _e('Default post by mail category:') ?></th>
+ <td><select name="default_email_category" id="default_email_category">
+<?php
+//Alreay have $categories from default_category
+foreach ($categories as $category) :
+if ($category->cat_ID == get_settings('default_email_category')) $selected = " selected='selected'";
+else $selected = '';
+echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
+endforeach;
+?>
+ </select></td>
+ </tr>
+ </table>
+</fieldset>
+
+<fieldset class="options">
+ <legend><?php _e('Update Services') ?></legend>
+ <p><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service URIs with line breaks.') ?></p>
+
+ <textarea name="ping_sites" id="ping_sites" style="width: 98%;" rows="3" cols="50"><?php form_option('ping_sites'); ?></textarea>
+</fieldset>
+
+<p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+</p>
+</form>
+</div>
+
+<?php include('./admin-footer.php') ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/options.php b/wp-inst/wp-admin/options.php
new file mode 100644
index 0000000..c6158d3
--- /dev/null
+++ b/wp-inst/wp-admin/options.php
@@ -0,0 +1,123 @@
+<?php
+require_once('admin.php');
+
+$title = __('Options');
+$this_file = 'options.php';
+$parent_file = 'options-general.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"];
+ }
+ }
+}
+
+if ($user_level < 6)
+ die ( __('Cheatin&#8217; uh?') );
+
+switch($action) {
+
+case 'update':
+ $any_changed = 0;
+
+ if (!$_POST['page_options']) {
+ foreach ($_POST as $key => $value) {
+ $option_names[] = "'$key'";
+ }
+ $option_names = implode(',', $option_names);
+ } else {
+ $option_names = stripslashes($_POST['page_options']);
+ }
+
+ $options = $wpdb->get_results("SELECT $wpdb->options.option_id, option_name, option_type, option_value, option_admin_level FROM $wpdb->options WHERE option_name IN ($option_names)");
+
+ // Save for later.
+ $old_siteurl = get_settings('siteurl');
+ $old_home = get_settings('home');
+
+// HACK
+// Options that if not there have 0 value but need to be something like "closed"
+ $nonbools = array('default_ping_status', 'default_comment_status');
+ if ($options) {
+ $options = apply_filters( 'options_to_update' , $options );
+ foreach ($options as $option) {
+ // should we even bother checking?
+ if ($user_level >= $option->option_admin_level) {
+ $old_val = $option->option_value;
+ $new_val = trim($_POST[$option->option_name]);
+ if( in_array($option->option_name, $nonbools) && ( $new_val == '0' || $new_val == '') )
+ $new_val = 'closed';
+ if ($new_val !== $old_val) {
+ $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'");
+ $any_changed++;
+ }
+ }
+ }
+ unset($cache_settings); // so they will be re-read
+ get_settings('siteurl'); // make it happen now
+ } // end if options
+
+ if ($any_changed) {
+ // If siteurl or home changed, reset cookies.
+ if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) {
+ // If home changed, write rewrite rules to new location.
+ save_mod_rewrite_rules();
+ // Get currently logged in user and password.
+ get_currentuserinfo();
+ // Clear cookies for old paths.
+ wp_clearcookie();
+ // Set cookies for new paths.
+ wp_setcookie($user_login, $user_pass_md5, true, get_settings('home'), get_settings('siteurl'));
+ }
+
+ //$message = sprintf(__('%d setting(s) saved... '), $any_changed);
+ }
+
+ $referred = remove_query_arg('updated' , $_SERVER['HTTP_REFERER']);
+ $goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']);
+ $goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
+ wp_redirect($goback);
+ break;
+
+default:
+ include('admin-header.php'); ?>
+
+<div class="wrap">
+ <h2><?php _e('All options'); ?></h2>
+ <form name="form" action="options.php" method="post">
+ <input type="hidden" name="action" value="update" />
+ <table width="98%">
+<?php
+$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
+
+foreach ($options as $option) :
+ $value = wp_specialchars($option->option_value);
+ echo "
+<tr>
+ <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
+ <td><input type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "' /></td>
+ <td>$option->option_description</td>
+</tr>";
+endforeach;
+?>
+ </table>
+<p class="submit"><input type="submit" name="Update" value="<?php _e('Update Settings &raquo;') ?>" /></p>
+ </form>
+</div>
+
+
+<?php
+break;
+} // end switch
+
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/page-new.php b/wp-inst/wp-admin/page-new.php
new file mode 100644
index 0000000..b2432d8
--- /dev/null
+++ b/wp-inst/wp-admin/page-new.php
@@ -0,0 +1,26 @@
+<?php
+require_once('admin.php');
+$title = __('New Page');
+$parent_file = 'post.php';
+require_once('admin-header.php');
+
+get_currentuserinfo();
+?>
+
+<?php if ( isset($_GET['saved']) ) : ?>
+<div class="updated"><p><strong><?php _e('Page saved.') ?> <a href="edit-pages.php"><?php _e('Manage pages'); ?> &raquo;</a></strong></p></div>
+<?php endif; ?>
+
+<?php
+if ($user_level > 0) {
+ $action = 'post';
+ get_currentuserinfo();
+
+ $post = get_default_post_to_edit();
+ $post->post_status = 'static';
+
+ include('edit-page-form.php');
+}
+?>
+
+<?php include('admin-footer.php'); ?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/plugin-editor.php b/wp-inst/wp-admin/plugin-editor.php
new file mode 100644
index 0000000..16de1cf
--- /dev/null
+++ b/wp-inst/wp-admin/plugin-editor.php
@@ -0,0 +1,124 @@
+<?php
+require_once('admin.php');
+
+$title = __("Edit Plugins");
+$parent_file = 'plugins.php';
+
+$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+$plugins = get_plugins();
+$plugin_files = array_keys($plugins);
+
+if (empty($file)) {
+ $file = $plugin_files[0];
+}
+
+$file = validate_file_to_edit($file, $plugin_files);
+$real_file = get_real_file_to_edit("wp-content/plugins/$file");
+
+switch($action) {
+
+case 'update':
+
+ if ($user_level < 5) {
+ die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
+ }
+
+ $newcontent = stripslashes($_POST['newcontent']);
+ if (is_writeable($real_file)) {
+ $f = fopen($real_file, 'w+');
+ fwrite($f, $newcontent);
+ fclose($f);
+ header("Location: plugin-editor.php?file=$file&a=te");
+ } else {
+ header("Location: plugin-editor.php?file=$file");
+ }
+
+ exit();
+
+break;
+
+default:
+
+ require_once('admin-header.php');
+ if ($user_level <= 5) {
+ die(__('<p>You have do not have sufficient permissions to edit plugins for this blog.</p>'));
+ }
+
+ update_recently_edited("wp-content/plugins/$file");
+
+ if (!is_file($real_file))
+ $error = 1;
+
+ if (!$error) {
+ $f = fopen($real_file, 'r');
+ $content = fread($f, filesize($real_file));
+ $content = htmlspecialchars($content);
+ }
+
+ ?>
+<?php if (isset($_GET['a'])) : ?>
+ <div class="updated"><p><?php _e('File edited successfully.') ?></p></div>
+<?php endif; ?>
+ <div class="wrap">
+ <?php
+ if (is_writeable($real_file)) {
+ echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
+ } else {
+ echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), $file) . '</h2>';
+ }
+ ?>
+ <div id="templateside">
+<h3><?php _e('Plugin files') ?></h3>
+
+<?php
+if ($plugin_files) :
+?>
+ <ul>
+<?php foreach($plugin_files as $plugin_file) : ?>
+ <li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
+<?php endforeach; ?>
+ </ul>
+<?php endif; ?>
+</div>
+ <?php if (!$error) { ?>
+ <form name="template" id="template" action="plugin-editor.php" method="post">
+ <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="file" value="<?php echo $file ?>" />
+ </div>
+<?php if ( is_writeable($real_file) ) : ?>
+ <p class="submit">
+<?php
+ echo "<input type='submit' name='submit' value=' " . __('Update File') . " &raquo;' tabindex='2' />";
+?>
+</p>
+<?php else : ?>
+<p><em><?php _e('If this file was writable you could edit it.'); ?></em></p>
+<?php endif; ?>
+ </form>
+ <?php
+ } else {
+ echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
+ }
+ ?>
+</div>
+<?php
+break;
+}
+
+include("admin-footer.php") ?>
diff --git a/wp-inst/wp-admin/plugins.php b/wp-inst/wp-admin/plugins.php
new file mode 100644
index 0000000..3b0f997
--- /dev/null
+++ b/wp-inst/wp-admin/plugins.php
@@ -0,0 +1,120 @@
+<?php
+require_once('admin.php');
+
+if ( isset($_GET['action']) ) {
+ check_admin_referer();
+
+ if ('activate' == $_GET['action']) {
+ $current = get_settings('active_plugins');
+ if (!in_array($_GET['plugin'], $current)) {
+ $current[] = trim( $_GET['plugin'] );
+ sort($current);
+ update_option('active_plugins', $current);
+ include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] ));
+ do_action('activate_' . trim( $_GET['plugin'] ));
+ }
+ header('Location: plugins.php?activate=true');
+ } else if ('deactivate' == $_GET['action']) {
+ $current = get_settings('active_plugins');
+ array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
+ update_option('active_plugins', $current);
+ do_action('deactivate_' . trim( $_GET['plugin'] ));
+ header('Location: plugins.php?deactivate=true');
+ }
+}
+
+$title = __('Manage Plugins');
+require_once('admin-header.php');
+
+// Clean up options
+// If any plugins don't exist, axe 'em
+
+$check_plugins = get_settings('active_plugins');
+
+// Sanity check. If the active plugin list is not an array, make it an
+// empty array.
+if ( !is_array($check_plugins) ) {
+ $check_plugins = array();
+ update_option('active_plugins', $check_plugins);
+}
+
+// If a plugin file does not exist, remove it from the list of active
+// plugins.
+foreach ($check_plugins as $check_plugin) {
+ if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) {
+ $current = get_settings('active_plugins');
+ unset($current[$_GET['plugin']]);
+ update_option('active_plugins', $current);
+ }
+}
+?>
+
+<?php if (isset($_GET['activate'])) : ?>
+<div class="updated"><p><?php _e('Plugin <strong>activated</strong>.') ?></p>
+</div>
+<?php endif; ?>
+<?php if (isset($_GET['deactivate'])) : ?>
+<div class="updated"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p>
+</div>
+<?php endif; ?>
+
+<div class="wrap">
+<h2><?php _e('Plugin Management'); ?></h2>
+<p><?php _e('Plugins are files you usually download separately from WordPress that add functionality. To install a plugin you generally just need to put the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is installed, you may activate it or deactivate it here. If something goes wrong with a plugin and you can&#8217;t use WordPress, delete that plugin from the <code>wp-content/plugins</code> directory and it will be automatically deactivated.'); ?></p>
+<?php
+
+if ( get_settings('active_plugins') )
+ $current_plugins = get_settings('active_plugins');
+
+$plugins = get_plugins();
+
+if (empty($plugins)) {
+ _e("<p>Couldn't open plugins directory or there are no plugins available.</p>"); // TODO: make more helpful
+} else {
+?>
+<table width="100%" cellpadding="3" cellspacing="3">
+ <tr>
+ <th><?php _e('Plugin'); ?></th>
+ <th><?php _e('Version'); ?></th>
+ <th><?php _e('Author'); ?></th>
+ <th><?php _e('Description'); ?></th>
+ <th><?php _e('Action'); ?></th>
+ </tr>
+<?php
+ $style = '';
+ foreach($plugins as $plugin_file => $plugin_data) {
+ $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
+
+ if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) {
+ $action = "<a href='plugins.php?action=deactivate&amp;plugin=$plugin_file' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
+ $plugin_data['Title'] = "<strong>{$plugin_data['Title']}</strong>";
+ $style .= $style == 'alternate' ? ' active' : 'active';
+ } else {
+ $action = "<a href='plugins.php?action=activate&amp;plugin=$plugin_file' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
+ }
+ $plugin_data['Description'] = wp_kses($plugin_data['Description'], array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()) ); ;
+ if ($style != '') $style = 'class="' . $style . '"';
+ echo "
+ <tr $style>
+ <td class=\"name\">{$plugin_data['Title']}</td>
+ <td class=\"vers\">{$plugin_data['Version']}</td>
+ <td class=\"auth\">{$plugin_data['Author']}</td>
+ <td class=\"desc\">{$plugin_data['Description']}</td>
+ <td class=\"togl\">$action</td>
+ </tr>";
+ }
+?>
+
+</table>
+<?php
+}
+?>
+
+<h2><?php _e('Get More Plugins'); ?></h2>
+<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>. To install a plugin you generally just need to upload the plugin file into your <code>wp-content/plugins</code> directory. Once a plugin is uploaded, you may activate it here.'); ?></p>
+
+</div>
+
+<?php
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/post.php b/wp-inst/wp-admin/post.php
new file mode 100644
index 0000000..e29156b
--- /dev/null
+++ b/wp-inst/wp-admin/post.php
@@ -0,0 +1,410 @@
+<?php
+require_once('admin.php');
+
+$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder' );
+
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+if (isset($_POST['deletepost'])) {
+$action = "delete";
+}
+
+ // Fix submenu highlighting for pages.
+if (false !== strpos($_SERVER['HTTP_REFERER'], 'edit-pages.php')) $submenu_file = 'page-new.php';
+
+$editing = true;
+
+switch($action) {
+case 'post':
+
+ $post_ID = write_post();
+
+ // Redirect.
+ if (!empty($_POST['mode'])) {
+ switch($_POST['mode']) {
+ case 'bookmarklet':
+ $location = 'bookmarklet.php?a=b';
+ break;
+ case 'sidebar':
+ $location = 'sidebar.php?a=b';
+ break;
+ default:
+ $location = 'post.php';
+ break;
+ }
+ } else {
+ $location = 'post.php?posted=true';
+ }
+
+ if ( 'static' == $_POST['post_status'] )
+ $location = "page-new.php?saved=true";
+
+ if ( '' != $_POST['advanced'] || isset($_POST['save']) )
+ $location = "post.php?action=edit&post=$post_ID";
+
+ header("Location: $location");
+ exit();
+ break;
+
+case 'edit':
+ $title = __('Edit');
+
+ require_once('admin-header.php');
+
+ $post_ID = $p = (int) $_GET['post'];
+
+ if ( !current_user_can('edit_post', $post_ID) )
+ die ( __('You are not allowed to edit this post.') );
+
+ if ( !user_can_edit_post($user_ID, $post_ID) )
+ die ( __('You are not allowed to view other users\' private posts.') );
+
+ $post = get_post_to_edit($post_ID);
+
+ if ($post->post_status == 'static')
+ include('edit-page-form.php');
+ else
+ include('edit-form-advanced.php');
+
+ ?>
+ <div id='preview' class='wrap'>
+ <h2><?php _e('Post Preview (updated when post is saved)'); ?></h2>
+ <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), get_the_title()); ?>"><?php the_title(); ?></a></h3>
+ <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(','); ?> &#8212; <?php the_author() ?> @ <?php the_time() ?></div>
+
+ <div class="storycontent">
+ <?php
+ echo apply_filters('the_content', $post->post_content);
+ ?>
+ </div>
+ </div>
+ <?php
+ break;
+
+case 'editpost':
+ edit_post();
+
+ if ($_POST['save']) {
+ $location = $_SERVER['HTTP_REFERER'];
+ } elseif ($_POST['updatemeta']) {
+ $location = $_SERVER['HTTP_REFERER'] . '&message=2#postcustom';
+ } elseif ($_POST['deletemeta']) {
+ $location = $_SERVER['HTTP_REFERER'] . '&message=3#postcustom';
+ } elseif (isset($_POST['referredby']) && $_POST['referredby'] != $_SERVER['HTTP_REFERER']) {
+ $location = $_POST['referredby'];
+ if ( $_POST['referredby'] == 'redo' )
+ $location = get_permalink( $post_ID );
+ } else {
+ $location = 'post.php';
+ }
+ header ('Location: ' . $location); // Send user on their way while we keep working
+
+ exit();
+ break;
+
+case 'delete':
+ check_admin_referer();
+
+ $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
+
+ if (!user_can_delete_post($user_ID, $post_id)) {
+ die( __('You are not allowed to delete this post.') );
+ }
+
+ if (! wp_delete_post($post_id))
+ die( __('Error in deleting...') );
+
+ $sendback = $_SERVER['HTTP_REFERER'];
+ if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post.php';
+ $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
+ header ('Location: ' . $sendback);
+ break;
+
+case 'editcomment':
+ $title = __('Edit Comment');
+ $parent_file = 'edit.php';
+ require_once ('admin-header.php');
+
+ get_currentuserinfo();
+
+ $comment = (int) $_GET['comment'];
+
+ if ( ! $comment = get_comment($comment) )
+ die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
+
+ if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) )
+ die( __('You are not allowed to edit comments on this post.') );
+
+ $comment = get_comment_to_edit($comment);
+
+ include('edit-form-comment.php');
+
+ break;
+
+case 'confirmdeletecomment':
+
+ require_once('./admin-header.php');
+
+ $comment = (int) $_GET['comment'];
+ $p = (int) $_GET['p'];
+
+ if ( ! $comment = get_comment($comment) )
+ die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+
+ if ( !user_can_delete_post_comments($user_ID, $comment->comment_post_ID) )
+ die( __('You are not allowed to delete comments on this post.') );
+
+ echo "<div class='wrap'>\n";
+ echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";
+ echo "<table border='0'>\n";
+ echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n";
+ echo "<tr><td>" . __('E-mail:') . "</td><td>$comment->comment_author_email</td></tr>\n";
+ echo "<tr><td>". __('URL:') . "</td><td>$comment->comment_author_url</td></tr>\n";
+ echo "<tr><td>". __('Comment:') . "</td><td>$comment->comment_content</td></tr>\n";
+ echo "</table>\n";
+ echo "<p>" . __('Are you sure you want to do that?') . "</p>\n";
+
+ echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n";
+ echo "<input type='hidden' name='action' value='deletecomment' />\n";
+ echo "<input type='hidden' name='p' value='$p' />\n";
+ echo "<input type='hidden' name='comment' value='{$comment->comment_ID}' />\n";
+ echo "<input type='hidden' name='noredir' value='1' />\n";
+ echo "<input type='submit' value='" . __('Yes') . "' />";
+ echo "&nbsp;&nbsp;";
+ echo "<input type='button' value='" . __('No') . "' onclick='self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&amp;c=1#comments';' />\n";
+ echo "</form>\n";
+ echo "</div>\n";
+
+ break;
+
+case 'deletecomment':
+
+ check_admin_referer();
+
+ $comment = (int) $_GET['comment'];
+ $p = (int) $_GET['p'];
+ if (isset($_GET['noredir'])) {
+ $noredir = true;
+ } else {
+ $noredir = false;
+ }
+
+ $postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+
+ if ( ! $comment = get_comment($comment) )
+ die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
+
+ if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID']))
+ die( __('You are not allowed to edit comments on this post.') );
+
+ wp_set_comment_status($comment->comment_ID, "delete");
+ do_action('delete_comment', $comment->comment_ID);
+
+ if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) {
+ header('Location: ' . $_SERVER['HTTP_REFERER']);
+ } else {
+ header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
+ }
+
+ break;
+
+case 'unapprovecomment':
+
+ require_once('./admin-header.php');
+
+ check_admin_referer();
+
+ $comment = (int) $_GET['comment'];
+ $p = (int) $_GET['p'];
+ if (isset($_GET['noredir'])) {
+ $noredir = true;
+ } else {
+ $noredir = false;
+ }
+
+ if ( ! $comment = get_comment($comment) )
+ die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+
+ if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) )
+ die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
+
+ wp_set_comment_status($comment->comment_ID, "hold");
+
+ if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) {
+ header('Location: ' . $_SERVER['HTTP_REFERER']);
+ } else {
+ header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
+ }
+
+ break;
+
+case 'mailapprovecomment':
+
+ $comment = (int) $_GET['comment'];
+
+ if ( ! $comment = get_comment($comment) )
+ die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+
+ if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) )
+ die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
+
+ if ('1' != $comment->comment_approved) {
+ wp_set_comment_status($comment->comment_ID, 'approve');
+ if (true == get_option('comments_notify'))
+ wp_notify_postauthor($comment->comment_ID);
+ }
+
+ header('Location: ' . get_option('siteurl') . '/wp-admin/moderation.php?approved=1');
+
+ break;
+
+case 'approvecomment':
+
+ $comment = (int) $_GET['comment'];
+ $p = (int) $_GET['p'];
+ if (isset($_GET['noredir'])) {
+ $noredir = true;
+ } else {
+ $noredir = false;
+ }
+
+ if ( ! $comment = get_comment($comment) )
+ die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+
+ if ( !user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID']))
+ die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
+
+ wp_set_comment_status($comment->comment_ID, "approve");
+ if (get_settings("comments_notify") == true) {
+ wp_notify_postauthor($comment->comment_ID);
+ }
+
+
+ if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) {
+ header('Location: ' . $_SERVER['HTTP_REFERER']);
+ } else {
+ header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
+ }
+
+ break;
+
+case 'editedcomment':
+
+ edit_comment();
+
+ $referredby = $_POST['referredby'];
+ if (!empty($referredby)) {
+ header('Location: ' . $referredby);
+ } else {
+ header ("Location: edit.php?p=$comment_post_ID&c=1#comments");
+ }
+
+ break;
+
+default:
+ $title = __('Create New Post');
+ require_once ('./admin-header.php');
+?>
+<?php if ( isset($_GET['posted']) ) : ?>
+<div class="updated"><p><?php printf(__('Post saved. <a href="%s">View site &raquo;</a>'), get_bloginfo('home')); ?></p></div>
+<?php endif; ?>
+<?php
+ if ( user_can_create_draft($user_ID) ) {
+ $action = 'post';
+ get_currentuserinfo();
+ if ( $drafts = get_users_drafts( $user_ID ) ) {
+ ?>
+ <div class="wrap">
+ <p><strong><?php _e('Your Drafts:') ?></strong>
+ <?php
+ for ( $i = 0; $i < 15; $i++ ) {
+ $draft = $drafts[$i];
+ if ( 0 != $i )
+ echo ', ';
+ $draft->post_title = stripslashes($draft->post_title);
+ if ( empty($draft->post_title) )
+ $draft->post_title = sprintf(__('Post # %s'), $draft->ID);
+ echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
+ }
+ ?>
+ <?php if ( 15 < count($drafts) ) { ?>
+ , <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> &raquo;</a>
+ <?php } ?>
+ .</p>
+ </div>
+ <?php
+ }
+
+ $post = get_default_post_to_edit();
+
+ include('edit-form-advanced.php');
+?>
+<div class="wrap">
+<?php _e('<h3>WordPress bookmarklet</h3>
+<p>Right click on the following link and choose "Add to favorites" to create a posting shortcut.</p>') ?>
+<p>
+
+<?php
+$bookmarklet_height= (get_settings('use_trackback')) ? 480 : 440;
+
+if ($is_NS4 || $is_gecko) {
+?>
+<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}void(window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title),'<?php _e('WordPress bookmarklet') ?>','scrollbars=yes,width=600,height=460,left=100,top=150,status=yes'));"><?php printf(__('Press It - %s'), wp_specialchars(get_settings('blogname'))); ?></a>
+<?php
+} else if ($is_winIE) {
+?>
+<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+encodeURIComponent(Q)+'<?php echo $bookmarklet_tbpb ?>&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title),'bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>
+<script type="text/javascript">
+<!--
+function oneclickbookmarklet(blah) {
+window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");
+}
+// -->
+</script>
+<br />
+<br />
+<?php _e('One-click bookmarklet:') ?><br />
+<a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
+<?php
+} else if ($is_opera) {
+?>
+<a href="javascript:void(window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>
+<?php
+} else if ($is_macIE) {
+?>
+<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>
+<?php
+}
+?>
+</p>
+</div>
+<?php
+} else {
+?>
+<div class="wrap">
+<p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />
+You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
+When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_settings('admin_email')); ?>
+</p>
+</div>
+<?php
+}
+
+ break;
+} // end switch
+/* </Edit> */
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/profile.php b/wp-inst/wp-admin/profile.php
new file mode 100644
index 0000000..4fe4162
--- /dev/null
+++ b/wp-inst/wp-admin/profile.php
@@ -0,0 +1,281 @@
+<?php
+require_once('admin.php');
+
+$title = 'Profile';
+$parent_file = 'profile.php';
+
+$wpvarstoreset = array('action', 'profile', 'user');
+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');
+auth_redirect();
+switch($action) {
+
+case 'update':
+
+ get_currentuserinfo();
+
+ /* checking the nickname has been typed */
+ if (empty($_POST["newuser_nickname"])) {
+ die (__("<strong>ERROR</strong>: please enter your nickname (can be the same as your username)"));
+ return false;
+ }
+
+ /* if the ICQ UIN has been entered, check to see if it has only numbers */
+ if (!empty($_POST["newuser_icq"])) {
+ if ((ereg("^[0-9]+$",$_POST["newuser_icq"]))==false) {
+ die (__("<strong>ERROR</strong>: your ICQ UIN can only be a number, no letters allowed"));
+ return false;
+ }
+ }
+
+ /* checking e-mail address */
+ if (empty($_POST["newuser_email"])) {
+ die (__("<strong>ERROR</strong>: please type your e-mail address"));
+ return false;
+ } else if (!is_email($_POST["newuser_email"])) {
+ die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
+ return false;
+ }
+
+ $pass1 = $_POST["pass1"];
+ $pass2 = $_POST["pass2"];
+ do_action('check_passwords', array($user_login, &$pass1, &$pass2));
+
+ if ( '' == $pass1 ) {
+ if ( '' != $pass2 )
+ die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
+ $updatepassword = "";
+ } else {
+ if ('' == $pass2)
+ die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
+ if ( $pass1 != $pass2 )
+ die (__("<strong>ERROR</strong>: you typed two different passwords. Go back to correct that."));
+ $newuser_pass = $pass1;
+ $updatepassword = "user_pass=MD5('$newuser_pass'), ";
+ wp_clearcookie();
+ wp_setcookie($user_login, $newuser_pass);
+ }
+
+ $newuser_firstname = wp_specialchars($_POST['newuser_firstname']);
+ $newuser_lastname = wp_specialchars($_POST['newuser_lastname']);
+ $new_display_name = wp_specialchars($_POST['display_name']);
+ $newuser_nickname = $_POST['newuser_nickname'];
+ $newuser_nicename = sanitize_title($newuser_nickname);
+ $newuser_icq = wp_specialchars($_POST['newuser_icq']);
+ $newuser_aim = wp_specialchars($_POST['newuser_aim']);
+ $newuser_msn = wp_specialchars($_POST['newuser_msn']);
+ $newuser_yim = wp_specialchars($_POST['newuser_yim']);
+ $newuser_email = wp_specialchars($_POST['newuser_email']);
+ $newuser_url = wp_specialchars($_POST['newuser_url']);
+ $newuser_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $newuser_url) ? $newuser_url : 'http://' . $newuser_url;
+ $user_description = $_POST['user_description'];
+
+ $result = $wpdb->query("UPDATE $wpdb->users SET $updatepassword user_email='$newuser_email', user_url='$newuser_url', user_nicename = '$newuser_nicename', display_name = '$new_display_name' WHERE ID = $user_ID");
+
+ update_usermeta( $user_ID, 'first_name', $newuser_firstname );
+ update_usermeta( $user_ID, 'last_name', $newuser_lastname );
+ update_usermeta( $user_ID, 'nickname', $newuser_nickname );
+ update_usermeta( $user_ID, 'description', $user_description );
+ update_usermeta( $user_ID, 'icq', $newuser_icq );
+ update_usermeta( $user_ID, 'aim', $newuser_aim );
+ update_usermeta( $user_ID, 'msn', $newuser_msn );
+ update_usermeta( $user_ID, 'yim', $newuser_yim );
+
+ do_action('profile_update', $user_ID);
+
+ wp_redirect('profile.php?updated=true');
+break;
+
+case 'IErightclick':
+
+ $bookmarklet_height= 550;
+
+ ?>
+
+ <div class="menutop">&nbsp;IE one-click bookmarklet</div>
+
+ <table width="100%" cellpadding="20">
+ <tr><td>
+
+ <p>To have a one-click bookmarklet, just copy and paste this<br />into a new text file:</p>
+ <?php
+ $regedit = "REGEDIT4\r\n[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Post To &WP : ". get_settings('blogname') ."]\r\n@=\"javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open('". get_settings('siteurl') ."/wp-admin/bookmarklet.php?text='+escape(Q)+'".$bookmarklet_tbpb."&popupurl='+escape(doc.location.href)+'&popuptitle='+escape(doc.title),'bookmarklet','scrollbars=no,width=480,height=".$bookmarklet_height.",left=100,top=150,status=yes'));btw.focus();\"\r\n\"contexts\"=hex:31\"";
+ ?>
+ <pre style="margin: 20px; background-color: #cccccc; border: 1px dashed #333333; padding: 5px; font-size: 12px;"><?php echo $regedit; ?></pre>
+ <p>Save it as wordpress.reg, and double-click on this file in an Explorer<br />
+ window. Answer Yes to the question, and restart Internet Explorer.<br /><br />
+ That's it, you can now right-click in an IE window and select <br />
+ 'Post to WP' to make the bookmarklet appear. :)</p>
+
+ <p align="center">
+ <form>
+ <input class="search" type="button" value="1" name="Close this window" />
+ </form>
+ </p>
+ </td></tr>
+ </table>
+ <?php
+
+break;
+
+
+default:
+ $parent_file = 'profile.php';
+ include_once('admin-header.php');
+ $profiledata = get_userdata($user_ID);
+
+ $bookmarklet_height= 440;
+
+if (isset($updated)) { ?>
+<div class="updated">
+<p><strong><?php _e('Profile updated.') ?></strong></p>
+</div>
+<?php } ?>
+<div class="wrap">
+<h2><?php _e('Profile'); ?></h2>
+<form name="profile" id="profile" action="profile.php" method="post">
+ <p>
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
+ </p>
+
+ <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
+ <tr>
+ <th width="33%" scope="row"><?php _e('Username:') ?></th>
+ <td width="67%"><?php echo $profiledata->user_login; ?></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Level:') ?></th>
+ <td><?php echo $profiledata->user_level; ?></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Posts:') ?></th>
+ <td> <?php
+ $posts = get_usernumposts($user_ID);
+ echo $posts;
+ ?></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('First name:') ?></th>
+ <td><input type="text" name="newuser_firstname" id="newuser_firstname" value="<?php echo $profiledata->first_name ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Last name:') ?></th>
+ <td><input type="text" name="newuser_lastname" id="newuser_lastname2" value="<?php echo $profiledata->last_name ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Nickname:') ?></th>
+ <td><input type="text" name="newuser_nickname" id="newuser_nickname2" value="<?php echo $profiledata->nickname ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('How to display name:') ?> </th>
+ <td>
+ <select name="display_name">
+ <option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option>
+ <option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option>
+ <option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option>
+ <?php if ( !empty( $profiledata->first_name ) ) : ?>
+ <option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option>
+ <?php endif; ?>
+ <?php if ( !empty( $profiledata->last_name ) ) : ?>
+ <option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option>
+ <?php endif; ?>
+ <?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
+ <option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
+ <option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
+ <?php endif; ?>
+ </select> </td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('E-mail:') ?></th>
+ <td><input type="text" name="newuser_email" id="newuser_email2" value="<?php echo $profiledata->user_email ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Website:') ?></th>
+ <td><input type="text" name="newuser_url" id="newuser_url2" value="<?php echo $profiledata->user_url ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('ICQ:') ?></th>
+ <td><input type="text" name="newuser_icq" id="newuser_icq2" value="<?php if ($profiledata->icq > 0) { echo $profiledata->icq; } ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('AIM:') ?></th>
+ <td><input type="text" name="newuser_aim" id="newuser_aim2" value="<?php echo $profiledata->aim ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('MSN IM:') ?> </th>
+ <td><input type="text" name="newuser_msn" id="newuser_msn2" value="<?php echo $profiledata->msn ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Yahoo IM:') ?> </th>
+ <td> <input type="text" name="newuser_yim" id="newuser_yim2" value="<?php echo $profiledata->yim ?>" /> </td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Profile:') ?></th>
+ <td><textarea name="user_description" rows="5" id="textarea2" style="width: 99%; "><?php echo $profiledata->user_description ?></textarea></td>
+ </tr>
+<?php
+$show_password_fields = apply_filters('show_password_fields', true);
+if ( $show_password_fields ) :
+?>
+ <tr>
+ <th scope="row"><?php _e('New <strong>Password</strong> (Leave blank to stay the same.)') ?></th>
+ <td><input type="password" name="pass1" size="16" value="" />
+ <br />
+ <input type="password" name="pass2" size="16" value="" /></td>
+ </tr>
+<?php endif; ?>
+ </table>
+ <p class="submit">
+ <input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" />
+ </p>
+</form>
+</div>
+
+
+<?php if ($is_gecko && $profiledata->user_level != 0) { ?>
+<div class="wrap">
+ <script type="text/javascript">
+//<![CDATA[
+function addPanel()
+ {
+ if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))
+ window.sidebar.addPanel("WordPress Post: <?php echo get_settings('blogname'); ?>","<?php echo get_settings('siteurl'); ?>/wp-admin/sidebar.php","");
+ else
+ alert(<?php __("'No Sidebar found! You must use Mozilla 0.9.4 or later!'") ?>);
+ }
+//]]>
+</script>
+ <strong><?php _e('SideBar') ?></strong><br />
+ <?php _e('Add the <a href="#" onclick="addPanel()">WordPress Sidebar</a>!') ?>
+ <?php } elseif (($is_winIE) || ($is_macIE)) { ?>
+ <strong><?php _e('SideBar') ?></strong><br />
+ <?php __('Add this link to your favorites:') ?><br />
+<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo get_settings('siteurl');
+ ?>/wp-admin/sidebar.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'_search'))"><?php _e('WordPress Sidebar') ?></a>.
+
+</div>
+<?php } ?>
+</div>
+ <?php
+
+break;
+}
+
+/* </Profile | My Profile> */
+include('admin-footer.php');
+ ?>
diff --git a/wp-inst/wp-admin/quicktags.js b/wp-inst/wp-admin/quicktags.js
new file mode 100644
index 0000000..7f4d7a3
--- /dev/null
+++ b/wp-inst/wp-admin/quicktags.js
@@ -0,0 +1,389 @@
+// new edit toolbar used with permission
+// by Alex King
+// http://www.alexking.org/
+
+var edButtons = new Array();
+var edLinks = new Array();
+var edOpenTags = new Array();
+
+function edButton(id, display, tagStart, tagEnd, access, open) {
+ this.id = id; // used to name the toolbar button
+ this.display = display; // label on button
+ this.tagStart = tagStart; // open tag
+ this.tagEnd = tagEnd; // close tag
+ this.access = access; // access key
+ this.open = open; // set to -1 if tag does not need to be closed
+}
+
+function zeroise(number, threshold) {
+ // FIXME: or we could use an implementation of printf in js here
+ var str = number.toString();
+ if (number < 0) { str = str.substr(1, str.length) }
+ while (str.length < threshold) { str = "0" + str }
+ if (number < 0) { str = '-' + str }
+ return str;
+}
+
+var now = new Date();
+var datetime = now.getUTCFullYear() + '-' +
+zeroise(now.getUTCMonth() + 1, 2) + '-' +
+zeroise(now.getUTCDate(), 2) + 'T' +
+zeroise(now.getUTCHours(), 2) + ':' +
+zeroise(now.getUTCMinutes(), 2) + ':' +
+zeroise(now.getUTCSeconds() ,2) +
+'+00:00';
+
+edButtons[edButtons.length] =
+new edButton('ed_strong'
+,'b'
+,'<strong>'
+,'</strong>'
+,'b'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_em'
+,'i'
+,'<em>'
+,'</em>'
+,'i'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_link'
+,'link'
+,''
+,'</a>'
+,'a'
+); // special case
+
+edButtons[edButtons.length] =
+new edButton('ed_block'
+,'b-quote'
+,'\n\n<blockquote>'
+,'</blockquote>\n\n'
+,'q'
+);
+
+
+edButtons[edButtons.length] =
+new edButton('ed_del'
+,'del'
+,'<del datetime="' + datetime + '">'
+,'</del>'
+,'d'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_ins'
+,'ins'
+,'<ins datetime="' + datetime + '">'
+,'</ins>'
+,'s'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_img'
+,'img'
+,''
+,''
+,'m'
+,-1
+); // special case
+
+edButtons[edButtons.length] =
+new edButton('ed_ul'
+,'ul'
+,'<ul>\n'
+,'</ul>\n\n'
+,'u'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_ol'
+,'ol'
+,'<ol>\n'
+,'</ol>\n\n'
+,'o'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_li'
+,'li'
+,'\t<li>'
+,'</li>\n'
+,'l'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_code'
+,'code'
+,'<code>'
+,'</code>'
+,'c'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_more'
+,'more'
+,'<!--more-->'
+,''
+,'t'
+,-1
+);
+/*
+edButtons[edButtons.length] =
+new edButton('ed_next'
+,'page'
+,'<!--nextpage-->'
+,''
+,'p'
+,-1
+);
+*/
+function edLink() {
+ this.display = '';
+ this.URL = '';
+ this.newWin = 0;
+}
+
+edLinks[edLinks.length] = new edLink('WordPress'
+ ,'http://wordpress.org/'
+ );
+
+edLinks[edLinks.length] = new edLink('alexking.org'
+ ,'http://www.alexking.org/'
+ );
+
+function edShowButton(button, i) {
+ if (button.id == 'ed_img') {
+ document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />');
+ }
+ else if (button.id == 'ed_link') {
+ document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />');
+ }
+ else {
+ document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '" />');
+ }
+}
+
+function edShowLinks() {
+ var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>(Quick Links)</option>';
+ for (i = 0; i < edLinks.length; i++) {
+ tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>';
+ }
+ tempStr += '</select>';
+ document.write(tempStr);
+}
+
+function edAddTag(button) {
+ if (edButtons[button].tagEnd != '') {
+ edOpenTags[edOpenTags.length] = button;
+ document.getElementById(edButtons[button].id).value = '/' + document.getElementById(edButtons[button].id).value;
+ }
+}
+
+function edRemoveTag(button) {
+ for (i = 0; i < edOpenTags.length; i++) {
+ if (edOpenTags[i] == button) {
+ edOpenTags.splice(i, 1);
+ document.getElementById(edButtons[button].id).value = document.getElementById(edButtons[button].id).value.replace('/', '');
+ }
+ }
+}
+
+function edCheckOpenTags(button) {
+ var tag = 0;
+ for (i = 0; i < edOpenTags.length; i++) {
+ if (edOpenTags[i] == button) {
+ tag++;
+ }
+ }
+ if (tag > 0) {
+ return true; // tag found
+ }
+ else {
+ return false; // tag not found
+ }
+}
+
+function edCloseAllTags() {
+ var count = edOpenTags.length;
+ for (o = 0; o < count; o++) {
+ edInsertTag(edCanvas, edOpenTags[edOpenTags.length - 1]);
+ }
+}
+
+function edQuickLink(i, thisSelect) {
+ if (i > -1) {
+ var newWin = '';
+ if (edLinks[i].newWin == 1) {
+ newWin = ' target="_blank"';
+ }
+ var tempStr = '<a href="' + edLinks[i].URL + '"' + newWin + '>'
+ + edLinks[i].display
+ + '</a>';
+ thisSelect.selectedIndex = 0;
+ edInsertContent(edCanvas, tempStr);
+ }
+ else {
+ thisSelect.selectedIndex = 0;
+ }
+}
+
+function edSpell(myField) {
+ var word = '';
+ if (document.selection) {
+ myField.focus();
+ var sel = document.selection.createRange();
+ if (sel.text.length > 0) {
+ word = sel.text;
+ }
+ }
+ else if (myField.selectionStart || myField.selectionStart == '0') {
+ var startPos = myField.selectionStart;
+ var endPos = myField.selectionEnd;
+ if (startPos != endPos) {
+ word = myField.value.substring(startPos, endPos);
+ }
+ }
+ if (word == '') {
+ word = prompt('Enter a word to look up:', '');
+ }
+ if (word !== null && /^\w[\w ]*$/.test(word)) {
+ window.open('http://www.answers.com/' + escape(word));
+ }
+}
+
+function edToolbar() {
+ document.write('<div id="ed_toolbar">');
+ for (i = 0; i < edButtons.length; i++) {
+ edShowButton(edButtons[i], i);
+ }
+ document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="Dictionary lookup" value="lookup" />');
+ document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="Close all open tags" value="Close Tags" />');
+// edShowLinks(); // disabled by default
+ document.write('</div>');
+}
+
+// insertion code
+
+function edInsertTag(myField, i) {
+ //IE support
+ if (document.selection) {
+ myField.focus();
+ sel = document.selection.createRange();
+ if (sel.text.length > 0) {
+ sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
+ }
+ else {
+ if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
+ sel.text = edButtons[i].tagStart;
+ edAddTag(i);
+ }
+ else {
+ sel.text = edButtons[i].tagEnd;
+ edRemoveTag(i);
+ }
+ }
+ myField.focus();
+ }
+ //MOZILLA/NETSCAPE support
+ else if (myField.selectionStart || myField.selectionStart == '0') {
+ var startPos = myField.selectionStart;
+ var endPos = myField.selectionEnd;
+ var cursorPos = endPos;
+ var scrollTop = myField.scrollTop;
+
+ if (startPos != endPos) {
+ myField.value = myField.value.substring(0, startPos)
+ + edButtons[i].tagStart
+ + myField.value.substring(startPos, endPos)
+ + edButtons[i].tagEnd
+ + myField.value.substring(endPos, myField.value.length);
+ cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
+ }
+ else {
+ if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
+ myField.value = myField.value.substring(0, startPos)
+ + edButtons[i].tagStart
+ + myField.value.substring(endPos, myField.value.length);
+ edAddTag(i);
+ cursorPos = startPos + edButtons[i].tagStart.length;
+ }
+ else {
+ myField.value = myField.value.substring(0, startPos)
+ + edButtons[i].tagEnd
+ + myField.value.substring(endPos, myField.value.length);
+ edRemoveTag(i);
+ cursorPos = startPos + edButtons[i].tagEnd.length;
+ }
+ }
+ myField.focus();
+ myField.selectionStart = cursorPos;
+ myField.selectionEnd = cursorPos;
+ myField.scrollTop = scrollTop;
+ }
+ else {
+ if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
+ myField.value += edButtons[i].tagStart;
+ edAddTag(i);
+ }
+ else {
+ myField.value += edButtons[i].tagEnd;
+ edRemoveTag(i);
+ }
+ myField.focus();
+ }
+}
+
+function edInsertContent(myField, myValue) {
+ //IE support
+ if (document.selection) {
+ myField.focus();
+ sel = document.selection.createRange();
+ sel.text = myValue;
+ myField.focus();
+ }
+ //MOZILLA/NETSCAPE support
+ else if (myField.selectionStart || myField.selectionStart == '0') {
+ var startPos = myField.selectionStart;
+ var endPos = myField.selectionEnd;
+ myField.value = myField.value.substring(0, startPos)
+ + myValue
+ + myField.value.substring(endPos, myField.value.length);
+ myField.focus();
+ myField.selectionStart = startPos + myValue.length;
+ myField.selectionEnd = startPos + myValue.length;
+ } else {
+ myField.value += myValue;
+ myField.focus();
+ }
+}
+
+function edInsertLink(myField, i, defaultValue) {
+ if (!defaultValue) {
+ defaultValue = 'http://';
+ }
+ if (!edCheckOpenTags(i)) {
+ var URL = prompt('Enter the URL' ,defaultValue);
+ if (URL) {
+ edButtons[i].tagStart = '<a href="' + URL + '">';
+ edInsertTag(myField, i);
+ }
+ }
+ else {
+ edInsertTag(myField, i);
+ }
+}
+
+function edInsertImage(myField) {
+ var myValue = prompt('Enter the URL of the image', 'http://');
+ if (myValue) {
+ myValue = '<img src="'
+ + myValue
+ + '" alt="' + prompt('Enter a description of the image', '')
+ + '" />';
+ edInsertContent(myField, myValue);
+ }
+} \ No newline at end of file
diff --git a/wp-inst/wp-admin/referers.php b/wp-inst/wp-admin/referers.php
new file mode 100644
index 0000000..342d437
--- /dev/null
+++ b/wp-inst/wp-admin/referers.php
@@ -0,0 +1,431 @@
+<?php
+
+// $Id: referers.php,v 1.6 2005/01/25 11:35:39 donncha Exp $
+
+require_once('admin.php');
+$title = "Referers";
+$parent_file = 'edit.php';
+include( '../wp-config.php' );
+require_once("admin-header.php");
+
+$b2varstoreset = array('action','standalone', "day", "order", "num" );
+for ($i=0; $i<count($b2varstoreset); $i += 1) {
+ $b2var = $b2varstoreset[$i];
+ if (!isset($$b2var)) {
+ if (empty($HTTP_POST_VARS["$b2var"])) {
+ if (empty($HTTP_GET_VARS["$b2var"])) {
+ $$b2var = '';
+ } else {
+ $$b2var = $HTTP_GET_VARS["$b2var"];
+ }
+ } else {
+ $$b2var = $HTTP_POST_VARS["$b2var"];
+ }
+ }
+}
+
+function makeHiddenVals()
+{
+ $fields = array( "day", "order", "num", "more", "ignoreDIRECT", "visitID", "internal" );
+ reset( $fields );
+ while( list( $key, $field ) = each( $fields ) )
+ {
+ if( $field == 'action' )
+ {
+ $sep = '?';
+ }
+ else
+ {
+ $sep = '&';
+ }
+
+ global $$field;
+ if( $$field != '' )
+ $vals .= "<input type='hidden' name='".$field."' value='".$$field."'>\n";
+ }
+ return $vals;
+}
+
+function makeURL( $var, $val )
+{
+ $fields = array( "action", "day", "order", "num", "more", "ignoreDIRECT", "visitID", "internal" );
+ reset( $fields );
+ while( list( $key, $field ) = each( $fields ) )
+ {
+ if( $field == 'action' )
+ {
+ $sep = '?';
+ }
+ else
+ {
+ $sep = '&';
+ }
+ if( $field != $var )
+ {
+ global $$field;
+ if( $$field != '' )
+ $url .= $sep.$field."=".$$field;
+ }
+ else
+ {
+ $url .= $sep.$var."=".$val;
+ }
+ }
+ return $url;
+}
+
+if( $action == '' )
+{
+ $action = 'listday';
+ $day = date( 'j' );
+}
+
+print '<div class="wrap">';
+
+if( $action == 'Delete' )
+{
+ if( is_array( $del ) )
+ {
+ reset( $del );
+ while( list( $key, $val ) = each( $del ) )
+ {
+ $query = "DELETE FROM referer_visitLog
+ WHERE visitID = '".$val."'
+ AND blogID = '".$wpblog."'";
+ $result = $wpdb->query($query);
+ }
+ }
+ $action = "listday";
+}
+elseif( $action == 'deletedirect' )
+{
+ $query = "DELETE FROM referer_visitLog
+ WHERE dayofmonth='".$day."'
+ AND referingURL = 'DIRECT'
+ AND blogID = '".$wpblog."'";
+ $result = $wpdb->query($query);
+ printf ("Records deleted: %d\n", $wpdb->rows_affected);
+ $action = "listday";
+}
+elseif( $action == 'Add To Blacklist' )
+{
+ if( is_array( $del ) )
+ {
+ reset( $del );
+ while( list( $key, $val ) = each( $del ) )
+ {
+ $query = "SELECT referingURL
+ FROM referer_visitLog
+ WHERE visitID = '".$val."'
+ AND blogID = '".$wpblog."'";
+ $result=$wpdb->get_var( $query );
+ if( $result )
+ {
+ $query = "INSERT INTO referer_blacklist VALUES( NULL, '".$wpblog."', '".$result."', NOW() )";
+ $result = $wpdb->query($query);
+ }
+ }
+ }
+ $action = "listday";
+}
+elseif( $action == 'deleteblacklist' )
+{
+ if( is_array( $del ) )
+ {
+ reset( $del );
+ while( list( $key, $val ) = each( $del ) )
+ {
+ $query = "DELETE FROM referer_blacklist WHERE ID='".$val."' AND blogID = '".$wpblog."'";
+ $result = $wpdb->query($query);
+ }
+ }
+ $action = "blacklist";
+}
+
+switch( $action )
+{
+ case "blacklist":
+ $query = "SELECT * FROM referer_blacklist
+ WHERE blogID = '".$wpblog."'";
+ $result = $wpdb->get_results($query, ARRAY_A );
+ if( $result )
+ {
+ print "<div class='wrap'><h2>Referer Blacklist</h2>";
+ print "<form action='referers.php' method='post'>";
+ print "<input type='hidden' name='action' value='deleteblacklist'>";
+ print "<input type='submit' value='Delete'>";
+ print "<table>";
+ $c = 1;
+ while( list( $key, $row1 ) = each( $result ) )
+ {
+ if( substr( $row1[ 'URL' ], 0, 16 ) == 'http://www.google' )
+ {
+ $displayurl = "Google: ". substr( $row1[ 'URL' ], strpos( $row1[ 'URL' ], "search" )+6 );
+ }
+ elseif( strstr( $row1[ 'URL' ], 'search.yahoo' ) )
+ {
+ $displayurl = "Yahoo: ". substr( $row1[ 'URL' ], strpos( $row1[ 'URL' ], "p=" )+2 );
+ }
+ elseif( strpos( $row1[ 'URL' ], 'www.blueyonder.co.uk' ) )
+ {
+ $displayurl = "Blueyonder: ". substr( $row1[ 'URL' ], strpos( $row1[ 'URL' ], "q=" )+2 );
+ }
+ else
+ {
+ $displayurl = $row1[ 'URL' ];
+ }
+ print "<tr><td>$c</td><td><a href='".$row1[ 'URL' ]."'>".$displayurl."</a></td><td><input type='checkbox' name='del[]' value='".$row1['ID']."'></td></tr>\n";
+ $c++;
+ }
+ print "</table>";
+ print "</form>";
+ print "</div>";
+ }
+ else
+ {
+ print "No URLs in blacklist yet!";
+ }
+ break;
+ case "listday":
+
+ $query = "select visitTimes,referingURL,date_format( visitTime, '%k:%i' ) as visitTime2, visitURL, visitID from referer_visitLog where dayofmonth='".$day."'";
+ if( $wpblog != 'root' )
+ $query .= " and blogID='".$wpblog."'";
+
+ if( $internal == 'yes' )
+ $query .= " and referingURL NOT LIKE '".get_settings( "siteurl" )."%'";
+
+ if( $ignoreDIRECT == 'yes' )
+ $query .= " and referingURL != 'DIRECT'";
+
+ if( $order == '' || $order == 'time' )
+ {
+ $query .= " order by visitTime desc";
+ }
+ elseif( $order == 'hits' )
+ {
+ $query .= " order by visitTimes desc";
+ }
+ elseif( $order == 'url' )
+ {
+ $query .= " order by visitURL desc";
+ }
+ if( $num == '' )
+ {
+ $num = 0;
+ }
+ if( $more == '' || $more == '0' )
+ $more = '30';
+
+ $query .= " limit $num,$more";
+
+ $result = $wpdb->get_results($query, ARRAY_A );
+ $rows = $wpdb->num_rows;
+ if( $result )
+ {
+ // javascript from http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_10105441.html and
+ // http://members.aol.com/grassblad/html/chkAllBut.html
+ print "<script langage='javascript'>
+ <!--
+ function selectAll(cbList,bSelect) {
+ for (var i=0; i<cbList.length; i++)
+ cbList[i].selected = cbList[i].checked = bSelect
+ }
+
+ function reverseAll(cbList) {
+ for (var i=0; i<cbList.length; i++) {
+ cbList[i].checked = !(cbList[i].checked)
+ cbList[i].selected = !(cbList[i].selected)
+ }
+ }
+ //-->
+ </script>";
+ $c = $num+1;
+ $nav = "<br /><div align='center'>";
+ $nav .= "<a href='referers.php?action=month'>Month View</a> | ";
+ $nav .= "<a href='referers.php".makeURL( "num", 0 )."'>Top</a>";
+ if( $ignoreDIRECT == 'yes' )
+ {
+ $nav .= " | <a href='referers.php".makeURL( "ignoreDIRECT", 'no' )."'>Display DIRECT requests</a>";
+ }
+ else
+ {
+ $nav .= " | <a href='referers.php".makeURL( "ignoreDIRECT", 'yes' )."'>Hide DIRECT requests</a>";
+ }
+ if( $internal == 'yes' )
+ {
+ $nav .= " | <a href='referers.php".makeURL( "internal", 'no' )."'>Display internal requests</a>";
+ }
+ else
+ {
+ $nav .= " | <a href='referers.php".makeURL( "internal", 'yes' )."'>Hide internal requests</a>";
+ }
+
+ if( $num >= 10 )
+ {
+ if( $num > $more )
+ {
+ $nav .= " | <a href='referers.php".makeURL( "num", ( $num - $more ) )."'>Previous $more</a>";
+ }
+ }
+ else
+ {
+ $nav .= " | Previous";
+ }
+ if( $rows >= $more )
+ {
+ $nav .= " | <a href='referers.php".makeURL( "num", ($num + $more) )."'>Next $more</a>";
+ }
+ else
+ {
+ $nav .= " | Next";
+ }
+ $nav .= " | <a href='referers.php".makeURL( "more", ($more + 10) )."'>More Hits</a>";
+ $nav .= " | <a href='referers.php".makeURL( "more", ($more - 10) )."'>Less Hits</a>";
+ $nav .= "<br />";
+ print "<div class='wrap'><h2>Referers</h2>";
+ print $nav;
+ $today = date( 'd' );
+ if( $day > $today )
+ {
+ $month = date( 'F', mktime (0,0,0,date("m")-1,date("d"), date("Y")) );
+ }
+ else
+ {
+ $month = date( 'F' );
+ }
+ print "<form action='referers.php' name='deletedirect'>";
+ print "<input type='hidden' name='action' value='deletedirect'>";
+ print makeHiddenVals();
+ print "</form>";
+ print "<form action='referers.php' name='referers'>";
+ print makeHiddenVals();
+ //print "<input type='hidden' name='action' value='delete'>";
+ print "<table border=0 cellspacing=0 cellpadding=2>";
+ print "<caption> Referers For $day $month</caption>";
+ print "<tr><th>#</th><th>Refering URL</th>
+ <th><a href='referers.php".makeURL( "order", "hits" )."' title='order by hits'>Hits</a></th>
+ <th><a href='referers.php".makeURL( "order", "url" )."' title='order by entry page'>Entry Page</a></th>
+ <th><a href='referers.php".makeURL( "order", "time" )."' title='order by time'>Last</a></th>
+ <th>Selected</th>
+ </tr>
+ <tr><td colspan='6' align='right'><INPUT TYPE=button VALUE='Select All' ONCLICK='selectAll(this.form,true)'>
+ <INPUT class='edit' TYPE=button VALUE='Clear All' ONCLICK='selectAll(this.form,false)'>
+ <INPUT class='edit' TYPE=button VALUE='Reverse' ONCLICK='reverseAll(this.form)'>
+ &nbsp;|&nbsp;<input class='edit' type='submit' name='action' value='Delete' onclick='javascript:document.referers.submit()'>
+ &nbsp;|&nbsp;<input class='edit' type='submit' name='action' value='Add To Blacklist'>
+ &nbsp;|&nbsp;<input class='edit' type='button' name='action' value='Delete Direct Referers' onclick='javascript:document.deletedirect.submit()'></td></tr>\n";
+ while( list( $key, $row1 ) = each( $result ) )
+ {
+ if( $col == 'f5f5f5' )
+ {
+ $col = 'ffffff';
+ }
+ else
+ {
+ $col = 'f5f5f5';
+ }
+ if( $row1[ 'referingURL' ] != 'DIRECT' )
+ {
+ if( substr( $row1[ 'referingURL' ], 0, 17 ) == 'http://www.google' )
+ {
+ $args = parse_url( $row1[ 'referingURL' ] );
+ parse_str( $args[ 'query' ] );
+ $url = "<a href='".$row1[ 'referingURL' ]."' title='".$row1[ 'referingURL' ]."'>Google: ".stripslashes( htmlspecialchars( $q ) )."</a>";
+ }
+ elseif( strstr( $row1[ 'referingURL' ], 'search.yahoo' ) )
+ {
+ $args = parse_url( $row1[ 'referingURL' ] );
+ parse_str( $args[ 'query' ] );
+ $url = "<a href='".$row1[ 'referingURL' ]."' title='".$row1[ 'referingURL' ]."'>Yahoo: ".stripslashes( htmlspecialchars( $p ) )."</a>";
+ }
+ elseif( strpos( $row1[ 'referingURL' ], 'www.blueyonder.co.uk' ) )
+ {
+ $args = parse_url( $row1[ 'referingURL' ] );
+ parse_str( $args[ 'query' ] );
+ $url = "<a href='".$row1[ 'referingURL' ]."' title='".$row1[ 'referingURL' ]."'>Blueyonder: ".stripslashes( htmlspecialchars( $q ) )."</a>";
+ }
+ else
+ {
+ $url = "<a href='".$row1[ 'referingURL' ]."' title='".$row1[ 'referingURL' ]."'>".substr( $row1[ 'referingURL' ], 0, 40 )."</a>";
+ }
+ }
+ else
+ {
+ $url = 'DIRECT';
+ }
+ $visitID = $row1[ 'visitID' ];
+ print "<tr bgcolor='#$col'>
+ <td>".$c."</td>
+ <td>".$url."</td>
+ <td>".substr($row1[ 'visitTimes' ],0, 40 )."</td>
+ <td><a href='".$row1[ 'visitURL' ]."'>".substr($row1[ 'visitURL' ],0, 40 )."</a></td>
+ <td>".$row1[ 'visitTime2' ]."</td>
+ <td align='right'><input type=checkbox name='del[]' value='".$visitID."'></td>
+ </tr>";
+ $c++;
+
+ }
+ print "</table>";
+ print $nav;
+ print "</form>";
+ print "</div>";
+ }
+ break;
+ default:
+ $query = "select sum( visitTimes ) as c, dayofmonth from referer_visitLog ";
+ if( $wpblog != 'root' )
+ $query .= "where blogID='".$wpblog."' ";
+ $query .= "group by referer_visitLog.dayofmonth";
+ $result = $wpdb->get_results($query, ARRAY_A );
+ if( $result )
+ {
+ $c = 0;
+ $col = 'ccc';
+ print "<div class='wrap'><h2>Referers</h2>";
+ print "<table><td valign='top'>";
+ print "<table border=1 cellspacing=0 cellpadding=2>";
+ print "<tr><th>Day</th><th>Hits</th>";
+ while( list( $key, $row1 ) = each( $result ) )
+ {
+ if( $col == 'f5f5f5' )
+ {
+ $col = 'ffffff';
+ }
+ else
+ {
+ $col = 'f5f5f5';
+ }
+ print "<tr bgcolor='#";
+ if( $row1[ 'dayofmonth' ] == date( 'j' ) )
+ {
+ print "ffdddd";
+ }
+ else
+ {
+ print $col;
+ }
+ print "'><td><a href='referers.php?action=listday&day=".$row1[ 'dayofmonth' ]."'>".$row1[ 'dayofmonth']."</a></td><td>".$row1[ 'c']."</td></tr>";
+ $c++;
+ if( $c == '15' )
+ {
+ print "</table>";
+ print "</td><td valign='top'>";
+ print "<table border=1 cellspacing=0 cellpadding=2>";
+ print "<tr><th>Day</th><th>Hits</th>";
+ }
+
+ }
+ print "</table>";
+ print "</td></table>";
+ print "<br><a href='referers.php?action=blacklist'>View Blacklist</a>";
+ print "</div>";
+ }
+ else
+ {
+ print "There are no referers for your site! Wait until Google indexes you!";
+ }
+}
+print "</div>";
+include("admin-footer.php");
+?>
diff --git a/wp-inst/wp-admin/setup-config.php b/wp-inst/wp-admin/setup-config.php
new file mode 100644
index 0000000..da753c1
--- /dev/null
+++ b/wp-inst/wp-admin/setup-config.php
@@ -0,0 +1,156 @@
+<?php
+define('WP_INSTALLING', true);
+
+if (file_exists('../wp-config.php'))
+ die("The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.");
+
+if (!file_exists('../wp-config-sample.php'))
+ die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
+$configFile = file('../wp-config-sample.php');
+
+if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
+
+$step = 0;
+if(isset($_GET['step'])) $step = $_GET['step'];
+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>WordPress &rsaquo; Setup Configuration File</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/logo.png);
+ 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. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
+<ol>
+ <li>Database name</li>
+ <li>Database username</li>
+ <li>Database password</li>
+ <li>Database host</li>
+ <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
+</ol>
+<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
+<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready, <a href="setup-config.php?step=1">let&#8217;s go</a>! </p>
+<?php
+ break;
+
+ case 1:
+ ?>
+</p>
+<form method="post" action="setup-config.php?step=2">
+ <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
+ <table>
+ <tr>
+ <th scope="row">Database Name</th>
+ <td><input name="dbname" type="text" size="45" value="wordpress" /></td>
+ <td>The name of the database you want to run WP in. </td>
+ </tr>
+ <tr>
+ <th scope="row">User Name</th>
+ <td><input name="uname" type="text" size="45" value="username" /></td>
+ <td>Your MySQL username</td>
+ </tr>
+ <tr>
+ <th scope="row">Password</th>
+ <td><input name="pwd" type="text" size="45" value="password" /></td>
+ <td>...and MySQL password.</td>
+ </tr>
+ <tr>
+ <th scope="row">Database Host</th>
+ <td><input name="dbhost" type="text" size="45" value="localhost" /></td>
+ <td>99% chance you won't need to change this value.</td>
+ </tr>
+ <tr>
+ <th scope="row">Table Prefix</th>
+ <td><input name="prefix" type="text" id="prefix" value="wp_" size="45" /></td>
+ <td>If you want to run multiple WordPress installations in a single database, change this.</td>
+ </tr>
+ </table>
+ <input name="submit" type="submit" value="Submit" />
+</form>
+<?php
+ break;
+
+ case 2:
+ $dbname = $_POST['dbname'];
+ $uname = $_POST['uname'];
+ $passwrd = $_POST['pwd'];
+ $dbhost = $_POST['dbhost'];
+ $prefix = $_POST['prefix'];
+ if (empty($prefix)) $prefix = 'wp_';
+
+ // Test the db connection.
+ define('DB_NAME', $dbname);
+ define('DB_USER', $uname);
+ define('DB_PASSWORD', $passwrd);
+ define('DB_HOST', $dbhost);
+
+ // We'll fail here if the values are no good.
+ require_once('../wp-includes/wp-db.php');
+ $handle = fopen('../wp-config.php', 'w');
+
+ foreach ($configFile as $line_num => $line) {
+ switch (substr($line,0,16)) {
+ case "define('DB_NAME'":
+ fwrite($handle, str_replace("wordpress", $dbname, $line));
+ break;
+ case "define('DB_USER'":
+ fwrite($handle, str_replace("'username'", "'$uname'", $line));
+ break;
+ case "define('DB_PASSW":
+ fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
+ break;
+ case "define('DB_HOST'":
+ fwrite($handle, str_replace("localhost", $dbhost, $line));
+ break;
+ case '$table_prefix =':
+ fwrite($handle, str_replace('wp_', $prefix, $line));
+ break;
+ default:
+ fwrite($handle, $line);
+ }
+ }
+ fclose($handle);
+ chmod('../wp-config.php', 0666);
+?>
+<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
+<?php
+ break;
+
+}
+?>
+</body>
+</html>
diff --git a/wp-inst/wp-admin/sidebar.php b/wp-inst/wp-admin/sidebar.php
new file mode 100644
index 0000000..fa75f32
--- /dev/null
+++ b/wp-inst/wp-admin/sidebar.php
@@ -0,0 +1,81 @@
+<?php
+$mode = 'sidebar';
+
+require_once('admin.php');
+
+get_currentuserinfo();
+
+if ($user_level == 0)
+ die ("Cheatin' uh ?");
+
+if ('b' == $_GET['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>
+<title>WordPress &#8250; Posted</title>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
+<link rel="stylesheet" href="wp-admin.css" type="text/css" />
+</head>
+<body>
+ <p>Posted !</p>
+ <p><a href="sidebar.php">Click here</a> to post again.</p>
+</body>
+</html><?php
+
+} else {
+
+?><!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>WordPress &#8250; Sidebar</title>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
+<link rel="stylesheet" href="wp-admin.css" type="text/css" />
+<style type="text/css" media="screen">
+form {
+ padding: 3px;
+}
+.sidebar-categories {
+ display: block;
+ height: 6.6em;
+ overflow: auto;
+ background-color: #f4f4f4;
+}
+.sidebar-categories label {
+ font-size: 10px;
+ display: block;
+ width: 90%;
+}
+</style>
+</head>
+<body id="sidebar">
+<h1 id="wphead"><a href="http://wordpress.org" rel="external">WordPress</a></h1>
+<form name="post" action="post.php" method="POST">
+<div><input type="hidden" name="action" value="post" />
+<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
+<input type="hidden" name="mode" value="sidebar" />
+<p>Title:
+<input type="text" name="post_title" size="20" tabindex="1" style="width: 100%;" />
+</p>
+<p>Categories:
+<span class="sidebar-categories">
+<?php dropdown_categories(); ?>
+</span>
+</p>
+<p>
+Post:
+<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
+</p>
+<p>
+ <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
+ <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
+
+</p>
+</div>
+</form>
+
+</body>
+</html>
+<?php
+}
+?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/template-chooser.php b/wp-inst/wp-admin/template-chooser.php
new file mode 100644
index 0000000..a2e6819
--- /dev/null
+++ b/wp-inst/wp-admin/template-chooser.php
@@ -0,0 +1,202 @@
+<?php
+
+/* $Id: template-chooser.php,v 1.6 2005/02/24 13:46:48 donncha Exp $ */
+
+
+$title = "Choose a Template";
+$parent_file = 'edit.php';
+require_once('admin.php');
+
+$b2varstoreset = array('action','standalone','redirect','profile','error','warning','a','file', 'template', 'date' );
+for ($i=0; $i<count($b2varstoreset); $i += 1) {
+ $b2var = $b2varstoreset[$i];
+ if (!isset($$b2var)) {
+ if (empty($HTTP_POST_VARS["$b2var"])) {
+ if (empty($HTTP_GET_VARS["$b2var"])) {
+ $$b2var = '';
+ } else {
+ $$b2var = $HTTP_GET_VARS["$b2var"];
+ }
+ } else {
+ $$b2var = $HTTP_POST_VARS["$b2var"];
+ }
+ }
+}
+require_once("admin-header.php");
+print '<div class="wrap"> ';
+switch( $action )
+{
+ case "activate":
+ if ($dir = @opendir("../wp-content/sitetemplates/$template/templates/")) {
+ while ($file = readdir($dir))
+ {
+ if( $file != '.' && $file != '..' )
+ {
+ copy( "../wp-content/sitetemplates/$template/templates/$file", "../wp-content/blogs/$wpblog/templates/$file" );
+ }
+ }
+ closedir($dir);
+ // modify css file.
+ $cssfile = '';
+ $fp = fopen( "../wp-content/blogs/$wpblog/templates/wp-layout.css", "r" );
+ while (!feof ($fp))
+ {
+ $cssfile .= fgets($fp, 4096);
+ }
+ fclose ($fp);
+ $cssfile = str_replace( "BASE/", "BASE", $cssfile );
+ $cssfile = str_replace( "BASE", $base, $cssfile );
+ $fp = fopen( "../wp-content/blogs/".$wpblog."/templates/wp-layout.css", "w" );
+ fwrite( $fp, $cssfile );
+ fclose( $fp );
+ }
+ $wpsmarty->cache_dir = "../" . $wpsmarty->cache_dir;
+ $wpsmarty->clear_all_cache();
+ print "<div class='updated'>Theme $file activated.</div><br>";
+ break;
+ case "backup":
+ $today = date( "YmdHis" );
+ if ($dir = @opendir("../wp-content/blogs/".$wpblog."/templates/"))
+ {
+ while ($file = readdir($dir))
+ {
+ if( substr( $file, 0 , 6 ) != 'backup' && $file != '.' && $file != '..' )
+ {
+ $backupFiles[] = $file;
+ }
+ if( substr( $file, 0 , 6 ) == 'backup' )
+ {
+ $numBackups[ substr( $file, 0 , 21 ) ] = true;
+ }
+ }
+ closedir( $dir );
+
+ if( is_array( $backupFiles ) )
+ {
+ if( count( $numBackups ) < 5 )
+ {
+ while( list( $key, $val ) = each( $backupFiles ) )
+ {
+ copy( "../wp-content/blogs/".$wpblog."/templates/".$val, "../wp-content/blogs/".$wpblog."/templates/backup$today-$val" );
+ }
+ print "<div class='updated'>Created Backup: $today</div><br>";
+ }
+ else
+ {
+ print "<div class='updated'>Maximum number of backups already made. You must delete one backup to save another.</div><br>";
+ }
+ }
+ }
+ break;
+ case "delete":
+ if ($dir = @opendir("../wp-content/blogs/$wpblog/templates/"))
+ {
+ $deletedFiles = false;
+ while ($file = readdir($dir))
+ {
+ if( substr( $file, 0 , 20 ) == 'backup'.$date )
+ {
+ $deletedFiles = true;
+ unlink( "../wp-content/blogs/$wpblog/templates/$file" );
+ }
+ }
+ if( $deletedFiles )
+ {
+ print "<div class='updated'>Deleted backup: $date</div><br>";
+ }
+ }
+ break;
+ case "restore":
+ if ($dir = @opendir("../wp-content/blogs/$wpblog/templates/"))
+ {
+ while ($file = readdir($dir))
+ {
+ if( substr( $file, 0 , 20 ) == 'backup'.$date )
+ {
+ $restoreFiles[] = $file;
+ }
+ }
+ closedir( $dir );
+
+ if( is_array( $restoreFiles ) )
+ {
+ while( list( $key, $val ) = each( $restoreFiles ) )
+ {
+ copy( "../wp-content/blogs/$wpblog/templates/$val", "../wp-content/blogs/$wpblog/templates/" . substr( $val, 21 ) );
+ }
+ print "<div class='updated'>Restored backup: $date </div><br>";
+ }
+ }
+ break;
+ case "view":
+ if( is_file( "../wp-content/blogs/$wpblog/templates/backup".$date."-index.html" ) )
+ {
+ print "index.html backup from $date<br>";
+ print "<form><textarea style='font-size: 10px' rows=20 cols=80 readonly>";
+ readfile( "../wp-content/blogs/$wpblog/templates/backup".$date."-index.html" );
+ print "</textarea></form>";
+ }
+ break;
+ default:
+ break;
+}
+print "<script LANGUAGE='JavaScript'>
+<!--
+function confirmSubmit(msg)
+{
+ return confirm('Are you sure you want to '+msg);
+}
+// -->
+</script>";
+$siteurl = get_settings( 'siteurl' );
+$examplesdir = "../wp-content/sitetemplates";
+if ($dir = @opendir( $examplesdir ))
+{
+ $c = "col0";
+ $main = "<table class='templatelist'>\n";
+ $msg = "use this template?";
+ while ($file = readdir($dir))
+ {
+ if( $file != '.' && $file != '..' && $file != '.htaccess' && is_dir( "../wp-content/sitetemplates/".$file ) )
+ {
+ if( file_exists( "../wp-content/sitetemplates/" . $file . "/index.php" ) )
+ {
+ include( "../wp-content/sitetemplates/".$file . "/index.php" );
+ $main.= "<tr><td><a href='".$base."wp-inst/wp-content/sitetemplates/".$file."/screenshot.gif'><img style='border: 1px dashed #000' border=0 src='".$base."wp-inst/wp-content/sitetemplates/". $file ."/screenshot-sm.gif'></a></td><td>";
+ $main .= "$title - $when<br>";
+ $main .= "<a href='$url'>$author</a><br>";
+ $main .= $description;
+ $main .= "<br /><a onclick=\"return confirmSubmit('$msg')\" href='template-chooser.php?action=activate&template=$file'>Use This Theme</a>";
+ $main .= "</td></tr>\n";
+ }
+ }
+ }
+ $main .= "</table>";
+ closedir($dir);
+ print $main;
+ print "<p style='padding: 5px'><b>Warning!</b> By clicking on <em style='color: #00f'>Use This Theme</em> you will overwrite your current template. Backup your existing template if you want to use it in the future!</p>";
+}
+print "<a href='template-chooser.php?action=backup'>Backup</a> existing template? You can make a total of 5 backups.<br>";
+if ($dir = @opendir("../wp-content/blogs/$wpblog/templates/"))
+{
+ while ($file = readdir($dir))
+ {
+ if( substr( $file, 0 , 6 ) == 'backup' )
+ {
+ $backups[ substr( $file, 6, 14 ) ] = "backup";
+ }
+ }
+ if( is_array( $backups ) )
+ {
+ print "Backups:<br>\n";
+ print "<table>";
+ while( list( $key, $val ) = each( $backups ) )
+ {
+ print "<tr><td><b>$key</b>: </td><td><a onclick=\"return confirmSubmit('restore this backup?')\" href='template-chooser.php?action=restore&date=$key'>Restore</a></td><td><a onclick=\"return confirmSubmit('delete this backup?')\" href='template-chooser.php?action=delete&date=$key'>Delete</a></td><td><a href='template-chooser.php?action=view&date=$key'>View index.html</a></td></tr>\n";
+ }
+ print "</table>";
+ }
+}
+print "</div>";
+include("admin-footer.php");
+?>
diff --git a/wp-inst/wp-admin/templates.php b/wp-inst/wp-admin/templates.php
new file mode 100644
index 0000000..f32209c
--- /dev/null
+++ b/wp-inst/wp-admin/templates.php
@@ -0,0 +1,187 @@
+<?php
+
+/* $Id: templates.php,v 1.8 2005/03/12 20:18:49 donncha Exp $ */
+
+require_once('admin.php');
+$title = __("Template &amp; file editing");
+$parent_file = 'edit.php';
+
+
+if( isset( $_POST[ 'file' ] ) )
+ $file = $_POST[ 'file' ];
+
+if( isset( $_GET[ 'file' ] ) )
+ $file = $_GET[ 'file' ];
+
+if ($file=="")
+{
+ $file = "index.html";
+}
+
+$file = str_replace( '..', '', $file );
+
+if (substr($file,0,1) == "/")
+ $file = ".".$file;
+
+$file = stripslashes($file);
+if (':' == substr($file,1,1))
+ die ('Sorry, can&#8217;t call files with their real path.');
+
+if( $wpblog != '' )
+{
+ $templateDir = "../wp-content/blogs/".$wpblog."/templates/";
+ $filename = $templateDir . "$file";
+}
+else
+{
+ $templateDir = "../templates/";
+ $filename = "templates/$file";
+}
+if( $backup != '' && $backup >= 0 && $backup <= 5 && is_file( $filename . "." . $backup ) )
+{
+ $filename .= "." . $backup;
+}
+
+switch($_POST[ 'action' ]) {
+
+case 'update':
+
+ if ($user_level < 5) {
+ die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
+ }
+
+ $newcontent = stripslashes($_POST['newcontent']);
+ $f = fopen( $filename, "r" );
+ $content = fread( $f, filesize( $filename ) );
+ fclose( $f );
+ if( $content != $newcontent )
+ {
+ for( $t = 4; $t >= 1; $t -- )
+ {
+ if( is_file( $filename . "." . $t ) )
+ {
+ rename( $filename . "." . $t, $filename . "." . ( $t + 1 ) );
+ }
+ }
+ rename( $filename, $filename . ".1" );
+
+ $f = fopen( $filename, "w+" );
+ fwrite($f,$newcontent);
+ fclose($f);
+
+ $wpsmarty->cache_dir = "../" . $wpsmarty->cache_dir;
+ $wpsmarty->clear_all_cache();
+
+ header( "Location: templates.php?file=$file&a=te" );
+ }
+ else
+ {
+ header( "Location: templates.php?file=$file" );
+ }
+
+ exit();
+
+break;
+
+default:
+
+ require_once('admin-header.php');
+
+ if ($user_level <= 3) {
+ die('<p>You have no right to edit the template for this blog.<br>Ask for a promotion to your <a href="mailto:$admin_email">blog admin</a>. :)</p>');
+ }
+
+ if (!is_file($filename))
+ $error = 1;
+
+ if (!$error) {
+ $f = fopen($filename, 'r');
+ $content = fread($f, filesize($filename));
+ $content = htmlspecialchars($content);
+ }
+
+ ?>
+ <div class="wrap">
+ <?php
+ echo "<h2>Editing <strong>$file</strong></h2>";
+ if( $backup != '' )
+ echo ", backup <strong>$backup</strong>";
+ echo " $warning";
+ if ('te' == $a)
+ echo "<em>File edited successfully.</em>";
+
+ if (!$error) {
+ ?>
+ <form name="template" action="templates.php" method="post">
+ <textarea cols="80" rows="20" style="width:100%; font-family: 'Courier New', Courier, monopace; font-size:small;" name="newcontent" tabindex="1"><?php echo $content ?></textarea>
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="file" value="<?php echo $file ?>" />
+ <br />
+ <?php
+ if (is_writeable($filename)) {
+ echo "<input type=\"submit\" name=\"submit\" class=\"search\" value=\"update template !\" tabindex=\"2\" />";
+ } else {
+ echo "<input type=\"button\" name=\"oops\" class=\"search\" value=\"(you cannot update that file/template: must make it writable, e.g. CHMOD 666)\" tabindex=\"2\" />";
+ }
+ ?>
+ </form>
+ <?php
+ } else {
+ echo '<p>Oops, no such file exists! Double check the name and try again, merci.</p>';
+ }
+ ?>
+</div>
+<div class="wrap">
+ <p>To edit a file, type its name here:</p>
+ <form name="file" action="templates.php" method="get">
+ <input type="text" name="file" />
+ <input type="submit" name="submit" class="search" value="go" />
+ </form>
+ <p>Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don't have access to a text editor or FTP client.</p>
+ <b>You can also edit the following files.</b><br />
+ <br />
+ <?php
+ $templates = array (
+ "Main Page" => "index.html",
+ "Site Style Sheet" => "wp-layout.css",
+ "Posts" => "post.html",
+ "Comments" => "comments.html",
+ "Old Template" => "index.tpl",
+ "Old Style Sheet" => "site.css"
+ );
+ print "<table>";
+ print "<tr><th>File</th><th colspan='5'>Backups</th><th>Notes</th></tr>";
+ $notes = false;
+ reset( $templates );
+ foreach( $templates as $templateName => $templateFilename )
+ {
+ print "<tr><td><a href='templates.php?file=$templateFilename'><nobr>$templateName</nobr></a></td>";
+ for( $t = 1; $t <= 5 ; $t ++ )
+ {
+ if( is_file( $templateDir . $templateFilename . "." . $t ) )
+ {
+ print "<td><a href='templates.php?file=".$templateFilename."&backup=".$t."'>".$t."</a></td>";
+ }
+ else
+ {
+ print "<td>" . $t . "</td>";
+ }
+ }
+ if( $notes == false )
+ {
+ print "<td rowspan=10 valign='top' style='padding:10px'>";
+ $notes = true;
+ print "When you edit a file a backup is made of the old file.<br> Up to 5 backups are made before the oldest is lost. It's a FIFO queue so the newest backup is always <em>1</em> and the oldest being <em>5</em>. <br />
+ If the backup of a particular file exists it will be hyperlinked and clicking on that link will allow you to edit that file. Updating that backup template will restore the backup when saved and overwrite the template.<br />
+ (*) You probably don't want to edit the XML files unless you're absolutely sure you know what you're doing!<br />";
+ print "</td>";
+ }
+ print "</tr>\n";
+ }
+ print "</table> </div> ";
+
+break;
+}
+
+include("admin-footer.php");
+?>
diff --git a/wp-inst/wp-admin/theme-editor.php b/wp-inst/wp-admin/theme-editor.php
new file mode 100644
index 0000000..3ebf035
--- /dev/null
+++ b/wp-inst/wp-admin/theme-editor.php
@@ -0,0 +1,157 @@
+<?php
+require_once('admin.php');
+
+$title = __("Edit Themes");
+$parent_file = 'themes.php';
+
+$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+$themes = get_themes();
+
+if (empty($theme)) {
+ $theme = get_current_theme();
+} else {
+ $theme = stripslashes($theme);
+ }
+
+
+if ( ! isset($themes[$theme]) )
+ die(__('The requested theme does not exist.'));
+
+$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
+
+if (empty($file)) {
+ $file = $allowed_files[0];
+}
+
+$file = validate_file_to_edit($file, $allowed_files);
+$real_file = get_real_file_to_edit($file);
+
+switch($action) {
+
+case 'update':
+
+ if ($user_level < 5) {
+ die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
+ }
+
+ $newcontent = stripslashes($_POST['newcontent']);
+ $theme = urlencode($theme);
+ if (is_writeable($real_file)) {
+ $f = fopen($real_file, 'w+');
+ fwrite($f, $newcontent);
+ fclose($f);
+ header("Location: theme-editor.php?file=$file&theme=$theme&a=te");
+ } else {
+ header("Location: theme-editor.php?file=$file&theme=$theme");
+ }
+
+ exit();
+
+break;
+
+default:
+
+ require_once('admin-header.php');
+ if ($user_level <= 5) {
+ die(__('<p>You have do not have sufficient permissions to edit themes for this blog.</p>'));
+ }
+
+ update_recently_edited($file);
+
+ if (!is_file($real_file))
+ $error = 1;
+
+ if (!$error && filesize($real_file) > 0) {
+ $f = fopen($real_file, 'r');
+ $content = fread($f, filesize($real_file));
+ $content = htmlspecialchars($content);
+ }
+
+ ?>
+<?php if (isset($_GET['a'])) : ?>
+ <div class="updated"><p><?php _e('File edited successfully.') ?></p></div>
+<?php endif; ?>
+ <div class="wrap">
+ <form name="theme" action="theme-editor.php" method="post">
+ <?php _e('Select theme to edit:') ?>
+ <select name="theme" id="theme">
+ <?php
+ foreach ($themes as $a_theme) {
+ $theme_name = $a_theme['Name'];
+ if ($theme_name == $theme) $selected = " selected='selected'";
+ else $selected = '';
+ $theme_name = wp_specialchars($theme_name, true);
+ echo "\n\t<option value=\"$theme_name\" $selected>$theme_name</option>";
+ }
+?>
+ </select>
+ <input type="submit" name="Submit" value="<?php _e('Select') ?> &raquo;" />
+ </form>
+ </div>
+
+ <div class="wrap">
+ <?php
+ if (is_writeable($real_file)) {
+ echo '<h2>' . sprintf(__('Editing <code>%s</code>'), $file) . '</h2>';
+ } else {
+ echo '<h2>' . sprintf(__('Browsing <code>%s</code>'), $file) . '</h2>';
+ }
+ ?>
+ <div id="templateside">
+ <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
+
+<?php
+if ($allowed_files) :
+?>
+ <ul>
+<?php foreach($allowed_files as $allowed_file) : ?>
+ <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
+<?php endforeach; ?>
+ </ul>
+<?php endif; ?>
+</div>
+ <?php
+ if (!$error) {
+ ?>
+ <form name="template" id="template" action="theme-editor.php" method="post">
+ <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="file" value="<?php echo $file ?>" />
+ <input type="hidden" name="theme" value="<?php echo $theme ?>" />
+ </div>
+<?php if ( is_writeable($real_file) ) : ?>
+ <p class="submit">
+<?php
+ echo "<input type='submit' name='submit' value=' " . __('Update File') . " &raquo;' tabindex='2' />";
+?>
+</p>
+<?php else : ?>
+<p><em><?php _e('If this file was writable you could edit it.'); ?></em></p>
+<?php endif; ?>
+ </form>
+ <?php
+ } else {
+ echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
+ }
+ ?>
+</div>
+<?php
+break;
+}
+
+include("admin-footer.php") ?>
diff --git a/wp-inst/wp-admin/themes.php b/wp-inst/wp-admin/themes.php
new file mode 100644
index 0000000..7aed945
--- /dev/null
+++ b/wp-inst/wp-admin/themes.php
@@ -0,0 +1,172 @@
+<?php
+require_once('admin.php');
+
+if ( isset($_GET['action']) ) {
+ check_admin_referer();
+
+ if ('activate' == $_GET['action']) {
+ if (isset($_GET['template'])) {
+ update_option('template', $_GET['template']);
+ }
+
+ if (isset($_GET['stylesheet'])) {
+ update_option('stylesheet', $_GET['stylesheet']);
+ }
+
+ do_action('switch_theme', get_current_theme());
+
+ header('Location: themes.php?activated=true');
+ }
+ }
+
+$title = __('Manage Themes');
+$parent_file = 'themes.php';
+require_once('admin-header.php');
+?>
+<?php if ( ! validate_current_theme() ) : ?>
+<div class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
+<?php elseif ( isset($activated) ) : ?>
+<div class="updated"><p><?php _e('New theme activated'); ?></p></div>
+<?php endif; ?>
+
+<?php
+$themes = get_themes();
+$allowed_themes = get_site_settings( "allowed_themes" );
+if( $allowed_themes == false ) {
+ $allowed_themes = $themes;
+}
+
+$current_theme = get_current_theme();
+
+if( isset( $allowed_themes[ $current_theme ] ) == false ) {
+ $allowed_themes[ $current_theme ] = true;
+}
+
+$current_title = $themes[$current_theme]['Title'];
+$current_version = $themes[$current_theme]['Version'];
+$current_parent_theme = $themes[$current_theme]['Parent Theme'];
+$current_template_dir = $themes[$current_theme]['Template Dir'];
+$current_stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
+$current_template = $themes[$current_theme]['Template'];
+$current_stylesheet = $themes[$current_theme]['Stylesheet'];
+
+reset( $themes );
+while( list( $key, $val ) = each( $themes ) ) {
+ if( isset( $allowed_themes[ $key ] ) == false ) {
+ unset( $themes[ $key ] );
+ }
+}
+reset( $themes );
+?>
+
+<div class="wrap">
+<h2><?php _e('Current Theme'); ?></h2>
+<div id="currenttheme">
+<h3><?php printf(__('%1$s %2$s by %3$s'), $current_title, $current_version, $themes[$current_theme]['Author']) ; ?></h3>
+<p><?php echo $themes[$current_theme]['Description']; ?></p>
+<?php if ($current_parent_theme) { ?>
+ <p><?php printf(__('The active theme is <strong>%1$s</strong>. The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $current_theme, $current_template_dir, $current_stylesheet_dir, $current_theme, $current_parent_theme); ?></p>
+<?php } else { ?>
+ <p><?php printf(__('The active theme is <strong>%1$s</strong>. The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>.'), $current_theme, $current_template_dir, $current_stylesheet_dir); ?></p>
+<?php } ?>
+</div>
+
+<h2><?php _e('Themes Available'); ?></h2>
+<?php if ( 1 < count($themes) ) { ?>
+<table width="100%" cellpadding="3" cellspacing="3">
+ <tr>
+ <th><?php _e('Name'); ?></th>
+ <th><?php _e('Author'); ?></th>
+ <th><?php _e('Description'); ?></th>
+ <th></th>
+ </tr>
+<?php
+ $style = '';
+
+ $theme_names = array_keys($themes);
+ natcasesort($theme_names);
+
+ foreach ($theme_names as $theme_name) {
+ $template = $themes[$theme_name]['Template'];
+ $stylesheet = $themes[$theme_name]['Stylesheet'];
+ $title = $themes[$theme_name]['Title'];
+ $version = $themes[$theme_name]['Version'];
+ $description = $themes[$theme_name]['Description'];
+ $author = $themes[$theme_name]['Author'];
+
+ if ($template == $current_template && $stylesheet == $current_stylesheet) {
+ $action = '<strong>' . __('Active Theme') . '</strong>';
+ $current = true;
+ } else {
+ $action = "<a href='themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet' title='" . __('Select this theme') . "' class='edit'>" . __('Select') . '</a>';
+ $current = false;
+ }
+
+ $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate';
+ if ($current) $style .= $style == 'alternate' ? ' active' : 'active';
+ if ($style != '') $style = 'class="' . $style . '"';
+
+ echo "
+ <tr $style>";
+if ( $current )
+ echo "<td><strong>$title $version</strong></td>";
+else
+ echo "<td>$title $version</td>";
+echo "
+ <td class=\"auth\">$author</td>
+ <td class=\"desc\">$description</td>
+ <td class=\"togl\">$action</td>
+ </tr>";
+ }
+?>
+
+</table>
+<?php
+}
+?>
+
+<?php
+// List broken themes, if any.
+$broken_themes = get_broken_themes();
+if (count($broken_themes)) {
+?>
+
+<h2><?php _e('Broken Themes'); ?></h2>
+<p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
+
+<table width="100%" cellpadding="3" cellspacing="3">
+ <tr>
+ <th><?php _e('Name'); ?></th>
+ <th><?php _e('Description'); ?></th>
+ </tr>
+<?php
+ $theme = '';
+
+ $theme_names = array_keys($broken_themes);
+ natcasesort($theme_names);
+
+ foreach ($theme_names as $theme_name) {
+ $title = $broken_themes[$theme_name]['Title'];
+ $description = $broken_themes[$theme_name]['Description'];
+
+ $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
+ echo "
+ <tr $theme>
+ <td>$title</td>
+ <td>$description</td>
+ </tr>";
+ }
+?>
+</table>
+<?php
+}
+?>
+
+<h2><?php _e('Get More Themes'); ?></h2>
+<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you may activate it here.'); ?></p>
+
+</div>
+
+<?php
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/toggle.png b/wp-inst/wp-admin/toggle.png
new file mode 100644
index 0000000..e8e6cae
--- /dev/null
+++ b/wp-inst/wp-admin/toggle.png
Binary files differ
diff --git a/wp-inst/wp-admin/update-links.php b/wp-inst/wp-admin/update-links.php
new file mode 100644
index 0000000..a02474e
--- /dev/null
+++ b/wp-inst/wp-admin/update-links.php
@@ -0,0 +1,44 @@
+<?php
+require_once( dirname( dirname(__FILE__) ) . '/wp-config.php');
+require_once( ABSPATH . 'wp-includes/class-snoopy.php');
+
+if ( !get_option('use_linksupdate') )
+ die('Feature disabled.');
+
+$link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
+
+if ( !$link_uris )
+ die('No links');
+
+$link_uris = urlencode( join( $link_uris, "\n" ) );
+
+$query_string = "uris=$link_uris";
+
+$http_request = "POST /updated-batch/ HTTP/1.0\r\n";
+$http_request .= "Host: api.pingomatic.com\r\n";
+$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_settings('blog_charset')."\r\n";
+$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
+$http_request .= 'User-Agent: WordPress/' . $wp_version . "\r\n";
+$http_request .= "\r\n";
+$http_request .= $query_string;
+
+$response = '';
+if( false !== ( $fs = fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5) ) ) {
+ fwrite($fs, $http_request);
+ while ( !feof($fs) )
+ $response .= fgets($fs, 1160); // One TCP-IP packet
+ fclose($fs);
+
+ $response = explode("\r\n\r\n", $response, 2);
+ $body = trim( $response[1] );
+ $body = str_replace(array("\r\n", "\r"), "\n", $body);
+
+ $returns = explode("\n", $body);
+
+ foreach ($returns as $return) :
+ $time = $wpdb->escape( substr($return, 0, 19) );
+ $uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
+ $wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
+ endforeach;
+}
+?> \ No newline at end of file
diff --git a/wp-inst/wp-admin/upgrade-functions.php b/wp-inst/wp-admin/upgrade-functions.php
new file mode 100644
index 0000000..cc39422
--- /dev/null
+++ b/wp-inst/wp-admin/upgrade-functions.php
@@ -0,0 +1,753 @@
+<?php
+
+require_once(ABSPATH . '/wp-admin/admin-functions.php');
+require_once(ABSPATH . '/wp-admin/upgrade-schema.php');
+// Functions to be called in install and upgrade scripts
+function upgrade_all() {
+ populate_options();
+ upgrade_100();
+ upgrade_101();
+ upgrade_110();
+ upgrade_130();
+ upgrade_160();
+ save_mod_rewrite_rules();
+}
+
+function upgrade_100() {
+ global $wpdb;
+
+ // Get the title and ID of every post, post_name to check if it already has a value
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
+ if ($posts) {
+ foreach($posts as $post) {
+ if ('' == $post->post_name) {
+ $newtitle = sanitize_title($post->post_title);
+ $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
+ }
+ }
+ }
+
+ $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
+ foreach ($categories as $category) {
+ if ('' == $category->category_nicename) {
+ $newtitle = sanitize_title($category->cat_name);
+ $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
+ }
+ }
+
+
+ $wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
+ WHERE option_name LIKE 'links_rating_image%'
+ AND option_value LIKE 'wp-links/links-images/%'");
+
+ $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat");
+ if ($done_ids) :
+ foreach ($done_ids as $done_id) :
+ $done_posts[] = $done_id->post_id;
+ endforeach;
+ $catwhere = ' AND ID NOT IN (' . implode(',', $done_posts) . ')';
+ else:
+ $catwhere = '';
+ endif;
+
+ $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
+ if ($allposts) :
+ foreach ($allposts as $post) {
+ // Check to see if it's already been imported
+ $cat = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post->ID AND category_id = $post->post_category");
+ if (!$cat && 0 != $post->post_category) { // If there's no result
+ $wpdb->query("
+ INSERT INTO $wpdb->post2cat
+ (post_id, category_id)
+ VALUES
+ ('$post->ID', '$post->post_category')
+ ");
+ }
+ }
+ endif;
+}
+
+function upgrade_101() {
+ global $wpdb;
+
+ // Clean up indices, add a few
+ add_clean_index($wpdb->posts, 'post_name');
+ add_clean_index($wpdb->posts, 'post_status');
+ add_clean_index($wpdb->categories, 'category_nicename');
+ add_clean_index($wpdb->comments, 'comment_approved');
+ add_clean_index($wpdb->comments, 'comment_post_ID');
+ add_clean_index($wpdb->links , 'link_category');
+ add_clean_index($wpdb->links , 'link_visible');
+}
+
+
+function upgrade_110() {
+ global $wpdb;
+
+ // Set user_nicename.
+ // FIXME: user_nickname is no longer in the user table. Need to update and
+ // move this code to where the new usermeta table is setup.
+// $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
+// foreach ($users as $user) {
+// if ('' == $user->user_nicename) {
+// $newname = sanitize_title($user->user_nickname);
+// $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
+// }
+// }
+
+ $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
+ foreach ($users as $row) {
+ if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
+ $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
+ }
+ }
+
+
+ // Get the GMT offset, we'll use that later on
+ $all_options = get_alloptions_110();
+
+ $time_difference = $all_options->time_difference;
+
+ $server_time = time()+date('Z');
+ $weblogger_time = $server_time + $time_difference*3600;
+ $gmt_time = time();
+
+ $diff_gmt_server = ($gmt_time - $server_time) / 3600;
+ $diff_weblogger_server = ($weblogger_time - $server_time) / 3600;
+ $diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server;
+ $gmt_offset = -$diff_gmt_weblogger;
+
+ // Add a gmt_offset option, with value $gmt_offset
+ add_option('gmt_offset', $gmt_offset);
+
+ // Check if we already set the GMT fields (if we did, then
+ // MAX(post_date_gmt) can't be '0000-00-00 00:00:00'
+ // <michel_v> I just slapped myself silly for not thinking about it earlier
+ $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true;
+
+ if (!$got_gmt_fields) {
+
+ // Add or substract time to all dates, to get GMT dates
+ $add_hours = intval($diff_gmt_weblogger);
+ $add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours));
+ $wpdb->query("UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
+ $wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date");
+ $wpdb->query("UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");
+ $wpdb->query("UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
+ $wpdb->query("UPDATE $wpdb->users SET user_registered = DATE_ADD(user_registered, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");
+ }
+
+}
+
+function upgrade_130() {
+ global $wpdb, $table_prefix;
+
+ // Remove extraneous backslashes.
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
+ if ($posts) {
+ foreach($posts as $post) {
+ $post_content = addslashes(deslash($post->post_content));
+ $post_title = addslashes(deslash($post->post_title));
+ $post_excerpt = addslashes(deslash($post->post_excerpt));
+ if ( empty($post->guid) )
+ $guid = get_permalink($post->ID);
+ else
+ $guid = $post->guid;
+
+ $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
+ }
+ }
+
+ // Remove extraneous backslashes.
+ $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
+ if ($comments) {
+ foreach($comments as $comment) {
+ $comment_content = addslashes(deslash($comment->comment_content));
+ $comment_author = addslashes(deslash($comment->comment_author));
+ $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
+ }
+ }
+
+ // Remove extraneous backslashes.
+ $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
+ if ($links) {
+ foreach($links as $link) {
+ $link_name = addslashes(deslash($link->link_name));
+ $link_description = addslashes(deslash($link->link_description));
+ $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
+ }
+ }
+
+ // The "paged" option for what_to_show is no more.
+ if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
+ $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
+ }
+
+ $active_plugins = __get_option('active_plugins');
+
+ // If plugins are not stored in an array, they're stored in the old
+ // newline separated format. Convert to new format.
+ if ( !is_array( $active_plugins ) ) {
+ $active_plugins = explode("\n", trim($active_plugins));
+ update_option('active_plugins', $active_plugins);
+ }
+
+ // Obsolete tables
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiontypes');
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroups');
+ $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroup_options');
+
+ // Update comments table to use comment_type
+ $wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
+ $wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'");
+
+ // Some versions have multiple duplicate option_name rows with the same values
+ $options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name");
+ foreach ( $options as $option ) {
+ if ( 1 != $option->dupes ) { // Could this be done in the query?
+ $limit = $option->dupes - 1;
+ $dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit");
+ $dupe_ids = join($dupe_ids, ',');
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
+ }
+ }
+
+ make_site_theme();
+}
+
+function upgrade_160() {
+ global $wpdb, $table_prefix;
+ $users = $wpdb->get_results("SELECT * FROM $wpdb->users");
+ foreach ( $users as $user ) :
+ if ( !empty( $user->user_firstname ) )
+ update_usermeta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );
+ if ( !empty( $user->user_lastname ) )
+ update_usermeta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );
+ if ( !empty( $user->user_nickname ) )
+ update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
+ if ( !empty( $user->user_level ) )
+ update_usermeta( $user->ID, $table_prefix . 'user_level', $user->user_level );
+ if ( !empty( $user->user_icq ) )
+ update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
+ if ( !empty( $user->user_aim ) )
+ update_usermeta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );
+ if ( !empty( $user->user_msn ) )
+ update_usermeta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );
+ if ( !empty( $user->user_yim ) )
+ update_usermeta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );
+ if ( !empty( $user->user_description ) )
+ update_usermeta( $user->ID, 'description', $wpdb->escape($user->user_description) );
+
+ if ( !isset( $user->user_idmode ) ):
+ $idmode = $user->user_idmode;
+ if ($idmode == 'nickname') $id = $user->user_nickname;
+ if ($idmode == 'login') $id = $user->user_login;
+ if ($idmode == 'firstname') $id = $user->user_firstname;
+ if ($idmode == 'lastname') $id = $user->user_lastname;
+ if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
+ if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
+ if (!$idmode) $id = $user->user_nickname;
+ $id = $wpdb->escape( $id );
+ $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
+ endif;
+ endforeach;
+ $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
+ $wpdb->hide_errors();
+ foreach ( $old_user_fields as $old )
+ $wpdb->query("ALTER TABLE $wpdb->users DROP $old");
+ $wpdb->show_errors();
+}
+
+// The functions we use to actually do stuff
+
+// General
+function maybe_create_table($table_name, $create_ddl) {
+ global $wpdb;
+ foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+ if ($table == $table_name) {
+ return true;
+ }
+ }
+ //didn't find it try to create it.
+ $q = $wpdb->query($create_ddl);
+ // we cannot directly tell that whether this succeeded!
+ foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
+ if ($table == $table_name) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function drop_index($table, $index) {
+ global $wpdb;
+ $wpdb->hide_errors();
+ $wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`");
+ // Now we need to take out all the extra ones we may have created
+ for ($i = 0; $i < 25; $i++) {
+ $wpdb->query("ALTER TABLE `$table` DROP INDEX `{$index}_$i`");
+ }
+ $wpdb->show_errors();
+ return true;
+}
+
+function add_clean_index($table, $index) {
+ global $wpdb;
+ drop_index($table, $index);
+ $wpdb->query("ALTER TABLE `$table` ADD INDEX ( `$index` )");
+ return true;
+}
+
+/**
+ ** 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;
+}
+
+
+// get_alloptions as it was for 1.2.
+function get_alloptions_110() {
+ global $wpdb;
+ if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
+ foreach ($options as $option) {
+ // "When trying to design a foolproof system,
+ // never underestimate the ingenuity of the fools :)" -- Dougal
+ if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
+ if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
+ if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
+ $all_options->{$option->option_name} = stripslashes($option->option_value);
+ }
+ }
+ return $all_options;
+}
+
+// Version of get_option that is private to install/upgrade.
+function __get_option($setting) {
+ global $wpdb;
+
+ $option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
+
+ @ $kellogs = unserialize($option);
+ if ($kellogs !== FALSE)
+ return $kellogs;
+ else
+ return $option;
+}
+
+function deslash($content) {
+ // Note: \\\ inside a regex denotes a single backslash.
+
+ // Replace one or more backslashes followed by a single quote with
+ // a single quote.
+ $content = preg_replace("/\\\+'/", "'", $content);
+
+ // Replace one or more backslashes followed by a double quote with
+ // a double quote.
+ $content = preg_replace('/\\\+"/', '"', $content);
+
+ // Replace one or more backslashes with one backslash.
+ $content = preg_replace("/\\\+/", "\\", $content);
+
+ return $content;
+}
+
+function dbDelta($queries, $execute = true) {
+ global $wpdb;
+
+ // Seperate individual queries into an array
+ if( !is_array($queries) ) {
+ $queries = explode( ';', $queries );
+ if('' == $queries[count($queries) - 1]) array_pop($queries);
+ }
+
+ $cqueries = array(); // Creation Queries
+ $iqueries = array(); // Insertion Queries
+ $for_update = array();
+
+ // Create a tablename index for an array ($cqueries) of queries
+ foreach($queries as $qry) {
+ if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
+ $cqueries[strtolower($matches[1])] = $qry;
+ $for_update[$matches[1]] = 'Created table '.$matches[1];
+ }
+ else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
+ array_unshift($cqueries, $qry);
+ }
+ else if(preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) {
+ $iqueries[] = $qry;
+ }
+ else if(preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) {
+ $iqueries[] = $qry;
+ }
+ else {
+ // Unrecognized query type
+ }
+ }
+
+ // Check to see which tables and fields exist
+ if($tables = $wpdb->get_col('SHOW TABLES;')) {
+ // For every table in the database
+ foreach($tables as $table) {
+ // If a table query exists for the database table...
+ if( array_key_exists(strtolower($table), $cqueries) ) {
+ // Clear the field and index arrays
+ unset($cfields);
+ unset($indices);
+ // Get all of the field names in the query from between the parens
+ preg_match("|\((.*)\)|ms", $cqueries[strtolower($table)], $match2);
+ $qryline = trim($match2[1]);
+
+ // Separate field lines into an array
+ $flds = explode("\n", $qryline);
+
+ //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
+
+ // For every field line specified in the query
+ foreach($flds as $fld) {
+ // Extract the field name
+ preg_match("|^([^ ]*)|", trim($fld), $fvals);
+ $fieldname = $fvals[1];
+
+ // Verify the found field name
+ $validfield = true;
+ switch(strtolower($fieldname))
+ {
+ case '':
+ case 'primary':
+ case 'index':
+ case 'fulltext':
+ case 'unique':
+ case 'key':
+ $validfield = false;
+ $indices[] = trim(trim($fld), ", \n");
+ break;
+ }
+ $fld = trim($fld);
+
+ // If it's a valid field, add it to the field array
+ if($validfield) {
+ $cfields[strtolower($fieldname)] = trim($fld, ", \n");
+ }
+ }
+
+ // Fetch the table column structure from the database
+ $tablefields = $wpdb->get_results("DESCRIBE {$table};");
+
+ // For every field in the table
+ foreach($tablefields as $tablefield) {
+ // If the table field exists in the field array...
+ if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
+ // Get the field type from the query
+ preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches);
+ $fieldtype = $matches[1];
+
+ // Is actual field type different from the field type in query?
+ if($tablefield->Type != $fieldtype) {
+ // Add a query to change the column type
+ $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
+ $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
+ }
+
+ // Get the default value from the array
+ //echo "{$cfields[strtolower($tablefield->Field)]}<br>";
+ if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
+ $default_value = $matches[1];
+ if($tablefield->Default != $default_value)
+ {
+ // Add a query to change the column's default value
+ $cqueries[] = "ALTER TABLE {$table} ALTER COLUMN {$tablefield->Field} SET DEFAULT '{$default_value}'";
+ $for_update[$table.'.'.$tablefield->Field] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}";
+ }
+ }
+
+ // Remove the field from the array (so it's not added)
+ unset($cfields[strtolower($tablefield->Field)]);
+ }
+ else {
+ // This field exists in the table, but not in the creation queries?
+ }
+ }
+
+ // For every remaining field specified for the table
+ foreach($cfields as $fieldname => $fielddef) {
+ // Push a query line into $cqueries that adds the field to that table
+ $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
+ $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
+ }
+
+ // Index stuff goes here
+ // Fetch the table index structure from the database
+ $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
+
+ if($tableindices) {
+ // Clear the index array
+ unset($index_ary);
+
+ // For every index in the table
+ foreach($tableindices as $tableindex) {
+ // Add the index to the index data array
+ $keyname = $tableindex->Key_name;
+ $index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part);
+ $index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0)?true:false;
+ }
+
+ // For each actual index in the index array
+ foreach($index_ary as $index_name => $index_data) {
+ // Build a create string to compare to the query
+ $index_string = '';
+ if($index_name == 'PRIMARY') {
+ $index_string .= 'PRIMARY ';
+ }
+ else if($index_data['unique']) {
+ $index_string .= 'UNIQUE ';
+ }
+ $index_string .= 'KEY ';
+ if($index_name != 'PRIMARY') {
+ $index_string .= $index_name;
+ }
+ $index_columns = '';
+ // For each column in the index
+ foreach($index_data['columns'] as $column_data) {
+ if($index_columns != '') $index_columns .= ',';
+ // Add the field to the column list string
+ $index_columns .= $column_data['fieldname'];
+ if($column_data['subpart'] != '') {
+ $index_columns .= '('.$column_data['subpart'].')';
+ }
+ }
+ // Add the column list to the index create string
+ $index_string .= ' ('.$index_columns.')';
+
+ if(!(($aindex = array_search($index_string, $indices)) === false)) {
+ unset($indices[$aindex]);
+ //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br/>Found index:".$index_string."</pre>\n";
+ }
+ //else echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br/><b>Did not find index:</b>".$index_string."<br/>".print_r($indices, true)."</pre>\n";
+ }
+ }
+
+ // For every remaining index specified for the table
+ foreach($indices as $index) {
+ // Push a query line into $cqueries that adds the index to that table
+ $cqueries[] = "ALTER TABLE {$table} ADD $index";
+ $for_update[$table.'.'.$fieldname] = 'Added index '.$table.' '.$index;
+ }
+
+ // Remove the original table creation query from processing
+ unset($cqueries[strtolower($table)]);
+ unset($for_update[strtolower($table)]);
+ } else {
+ // This table exists in the database, but not in the creation queries?
+ }
+ }
+ }
+
+ $allqueries = array_merge($cqueries, $iqueries);
+ if($execute) {
+ foreach($allqueries as $query) {
+ //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
+ $wpdb->query($query);
+ }
+ }
+
+ return $for_update;
+}
+
+function make_db_current() {
+ global $wp_queries;
+
+ $alterations = dbDelta($wp_queries);
+ echo "<ol>\n";
+ foreach($alterations as $alteration) echo "<li>$alteration</li>\n";
+ echo "</ol>\n";
+}
+
+function make_db_current_silent() {
+ global $wp_queries;
+
+ $alterations = dbDelta($wp_queries);
+}
+
+function make_site_theme_from_oldschool($theme_name, $template) {
+ $home_path = get_home_path();
+ $site_dir = ABSPATH . "wp-content/themes/$template";
+
+ if (! file_exists("$home_path/index.php"))
+ return false;
+
+ // Copy files from the old locations to the site theme.
+ // TODO: This does not copy arbitarary include dependencies. Only the
+ // standard WP files are copied.
+ $files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php');
+
+ foreach ($files as $oldfile => $newfile) {
+ if ($oldfile == 'index.php')
+ $oldpath = $home_path;
+ else
+ $oldpath = ABSPATH;
+
+ if ($oldfile == 'index.php') { // Check to make sure it's not a new index
+ $index = implode('', file("$oldpath/$oldfile"));
+ if ( strstr( $index, 'WP_USE_THEMES' ) ) {
+ if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
+ return false;
+ continue; // Don't copy anything
+ }
+ }
+
+ if (! @copy("$oldpath/$oldfile", "$site_dir/$newfile"))
+ return false;
+
+ chmod("$site_dir/$newfile", 0777);
+
+ // Update the blog header include in each file.
+ $lines = explode("\n", implode('', file("$site_dir/$newfile")));
+ if ($lines) {
+ $f = fopen("$site_dir/$newfile", 'w');
+
+ foreach ($lines as $line) {
+ if (preg_match('/require.*wp-blog-header/', $line))
+ $line = '//' . $line;
+
+ // Update stylesheet references.
+ $line = str_replace("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);
+
+ // Update comments template inclusion.
+ $line = str_replace("<?php include(ABSPATH . 'wp-comments.php'); ?>", "<?php comments_template(); ?>", $line);
+
+ fwrite($f, "{$line}\n");
+ }
+ fclose($f);
+ }
+ }
+
+ // Add a theme header.
+ $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the upgrade.\nVersion: 1.0\nAuthor: Moi\n*/\n";
+
+ $stylelines = file_get_contents("$site_dir/style.css");
+ if ($stylelines) {
+ $f = fopen("$site_dir/style.css", 'w');
+
+ fwrite($f, $header);
+ fwrite($f, $stylelines);
+ fclose($f);
+ }
+
+ return true;
+}
+
+function make_site_theme_from_default($theme_name, $template) {
+ $site_dir = ABSPATH . "wp-content/themes/$template";
+ $default_dir = ABSPATH . 'wp-content/themes/default';
+
+ // Copy files from the default theme to the site theme.
+ //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
+
+ $theme_dir = @ dir("$default_dir");
+ if ($theme_dir) {
+ while(($theme_file = $theme_dir->read()) !== false) {
+ if (is_dir("$default_dir/$theme_file"))
+ continue;
+ if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
+ return;
+ chmod("$site_dir/$theme_file", 0777);
+ }
+ }
+
+ // Rewrite the theme header.
+ $stylelines = explode("\n", implode('', file("$site_dir/style.css")));
+ if ($stylelines) {
+ $f = fopen("$site_dir/style.css", 'w');
+
+ foreach ($stylelines as $line) {
+ if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
+ elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
+ elseif (strstr($line, "Description:")) $line = "Description: Your theme";
+ elseif (strstr($line, "Version:")) $line = "Version: 1";
+ elseif (strstr($line, "Author:")) $line = "Author: You";
+ fwrite($f, "{$line}\n");
+ }
+ fclose($f);
+ }
+
+ // Copy the images.
+ umask(0);
+ if (! mkdir("$site_dir/images", 0777)) {
+ return false;
+ }
+
+ $images_dir = @ dir("$default_dir/images");
+ if ($images_dir) {
+ while(($image = $images_dir->read()) !== false) {
+ if (is_dir("$default_dir/images/$image"))
+ continue;
+ if (! @copy("$default_dir/images/$image", "$site_dir/images/$image"))
+ return;
+ chmod("$site_dir/images/$image", 0777);
+ }
+ }
+}
+
+// Create a site theme from the default theme.
+function make_site_theme() {
+ return true;
+ // Name the theme after the blog.
+ $theme_name = __get_option('blogname');
+ $template = sanitize_title($theme_name);
+ $site_dir = ABSPATH . "wp-content/themes/$template";
+
+ // If the theme already exists, nothing to do.
+ if ( is_dir($site_dir)) {
+ return false;
+ }
+
+ // We must be able to write to the themes dir.
+ if (! is_writable(ABSPATH . "wp-content/themes")) {
+ return false;
+ }
+
+ umask(0);
+ if (! mkdir($site_dir, 0777)) {
+ return false;
+ }
+
+ if (file_exists(ABSPATH . 'wp-layout.css')) {
+ if (! make_site_theme_from_oldschool($theme_name, $template)) {
+ // TODO: rm -rf the site theme directory.
+ return false;
+ }
+ } else {
+ if (! make_site_theme_from_default($theme_name, $template))
+ // TODO: rm -rf the site theme directory.
+ return false;
+ }
+
+ // Make the new site theme active.
+ $current_template = __get_option('template');
+ if ($current_template == 'default') {
+ update_option('template', $template);
+ update_option('stylesheet', $template);
+ }
+ return $template;
+}
+?>
diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php
new file mode 100644
index 0000000..261a350
--- /dev/null
+++ b/wp-inst/wp-admin/upgrade-schema.php
@@ -0,0 +1,295 @@
+<?php
+// Here we keep the DB structure and option values
+
+$wp_queries="CREATE TABLE $wpdb->categories (
+ cat_ID bigint(20) NOT NULL auto_increment,
+ cat_name varchar(55) NOT NULL default '',
+ category_nicename varchar(200) NOT NULL default '',
+ category_description longtext NOT NULL,
+ category_parent bigint(20) NOT NULL default '0',
+ PRIMARY KEY (cat_ID),
+ KEY category_nicename (category_nicename)
+);
+CREATE TABLE $wpdb->comments (
+ comment_ID bigint(20) unsigned NOT NULL auto_increment,
+ comment_post_ID int(11) NOT NULL default '0',
+ comment_author tinytext NOT NULL,
+ comment_author_email varchar(100) NOT NULL default '',
+ comment_author_url varchar(200) NOT NULL default '',
+ comment_author_IP varchar(100) NOT NULL default '',
+ comment_date datetime NOT NULL default '0000-00-00 00:00:00',
+ comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
+ comment_content text NOT NULL,
+ comment_karma int(11) NOT NULL default '0',
+ comment_approved enum('0','1','spam') NOT NULL default '1',
+ comment_agent varchar(255) NOT NULL default '',
+ comment_type varchar(20) NOT NULL default '',
+ comment_parent bigint(20) NOT NULL default '0',
+ user_id bigint(20) NOT NULL default '0',
+ PRIMARY KEY (comment_ID),
+ KEY comment_approved (comment_approved),
+ KEY comment_post_ID (comment_post_ID)
+);
+CREATE TABLE $wpdb->linkcategories (
+ cat_id bigint(20) NOT NULL auto_increment,
+ cat_name tinytext NOT NULL,
+ auto_toggle enum('Y','N') NOT NULL default 'N',
+ show_images enum('Y','N') NOT NULL default 'Y',
+ show_description enum('Y','N') NOT NULL default 'N',
+ show_rating enum('Y','N') NOT NULL default 'Y',
+ show_updated enum('Y','N') NOT NULL default 'Y',
+ sort_order varchar(64) NOT NULL default 'rand',
+ sort_desc enum('Y','N') NOT NULL default 'N',
+ text_before_link varchar(128) NOT NULL default '<li>',
+ text_after_link varchar(128) NOT NULL default '<br />',
+ text_after_all varchar(128) NOT NULL default '</li>',
+ list_limit int(11) NOT NULL default '-1',
+ PRIMARY KEY (cat_id)
+);
+CREATE TABLE $wpdb->links (
+ link_id bigint(20) NOT NULL auto_increment,
+ link_url varchar(255) NOT NULL default '',
+ 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(11) NOT NULL default '1',
+ link_rating int(11) 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,
+ link_rss varchar(255) NOT NULL default '',
+ PRIMARY KEY (link_id),
+ KEY link_category (link_category),
+ KEY link_visible (link_visible)
+);
+CREATE TABLE $wpdb->options (
+ option_id bigint(20) NOT NULL auto_increment,
+ blog_id int(11) NOT NULL default '0',
+ option_name varchar(64) NOT NULL default '',
+ option_can_override enum('Y','N') NOT NULL default 'Y',
+ option_type int(11) NOT NULL default '1',
+ option_value longtext NOT NULL,
+ option_width int(11) NOT NULL default '20',
+ option_height int(11) NOT NULL default '8',
+ option_description tinytext NOT NULL,
+ option_admin_level int(11) NOT NULL default '1',
+ autoload enum('yes','no') NOT NULL default 'yes',
+ PRIMARY KEY (option_id,blog_id,option_name),
+ KEY option_name (option_name)
+);
+CREATE TABLE $wpdb->post2cat (
+ rel_id bigint(20) NOT NULL auto_increment,
+ post_id bigint(20) NOT NULL default '0',
+ category_id bigint(20) NOT NULL default '0',
+ PRIMARY KEY (rel_id),
+ KEY post_id (post_id,category_id)
+);
+CREATE TABLE $wpdb->postmeta (
+ meta_id bigint(20) NOT NULL auto_increment,
+ post_id bigint(20) NOT NULL default '0',
+ meta_key varchar(255) default NULL,
+ meta_value longtext,
+ PRIMARY KEY (meta_id),
+ KEY post_id (post_id),
+ KEY meta_key (meta_key)
+);
+CREATE TABLE $wpdb->posts (
+ ID bigint(20) unsigned NOT NULL auto_increment,
+ post_author bigint(20) NOT NULL default '0',
+ post_date datetime NOT NULL default '0000-00-00 00:00:00',
+ post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
+ post_content longtext NOT NULL,
+ post_title text NOT NULL,
+ post_category int(4) NOT NULL default '0',
+ post_excerpt text NOT NULL,
+ post_status enum('publish','draft','private','static','object') NOT NULL default 'publish',
+ comment_status enum('open','closed','registered_only') NOT NULL default 'open',
+ ping_status enum('open','closed') NOT NULL default 'open',
+ post_password varchar(20) NOT NULL default '',
+ post_name varchar(200) NOT NULL default '',
+ to_ping text NOT NULL,
+ pinged text NOT NULL,
+ post_modified datetime NOT NULL default '0000-00-00 00:00:00',
+ post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
+ post_content_filtered text NOT NULL,
+ post_parent bigint(20) NOT NULL default '0',
+ guid varchar(255) NOT NULL default '',
+ menu_order int(11) NOT NULL default '0',
+ PRIMARY KEY (ID),
+ KEY post_name (post_name)
+);
+CREATE TABLE $wpdb->users (
+ ID bigint(20) unsigned NOT NULL auto_increment,
+ user_login varchar(60) NOT NULL default '',
+ user_pass varchar(64) NOT NULL default '',
+ user_nicename varchar(50) NOT NULL default '',
+ user_email varchar(100) NOT NULL default '',
+ user_url varchar(100) NOT NULL default '',
+ user_registered datetime NOT NULL default '0000-00-00 00:00:00',
+ user_level int(2) unsigned NOT NULL default '0',
+ user_activation_key varchar(60) NOT NULL default '',
+ user_status int(11) NOT NULL default '0',
+ display_name varchar(250) NOT NULL default '',
+ PRIMARY KEY (ID),
+ UNIQUE KEY user_login (user_login)
+);
+CREATE TABLE $wpdb->usermeta (
+ umeta_id bigint(20) NOT NULL auto_increment,
+ user_id bigint(20) NOT NULL default '0',
+ meta_key varchar(255) default NULL,
+ meta_value longtext,
+ PRIMARY KEY (umeta_id),
+ KEY user_id (user_id),
+ KEY meta_key (meta_key)
+);
+CREATE TABLE $wpdb->blogs (
+ blog_id bigint(20) NOT NULL auto_increment,
+ site_id bigint(20) NOT NULL default '0',
+ blogname varchar(50) NOT NULL default '',
+ registered datetime NOT NULL default '0000-00-00 00:00:00',
+ last_updated datetime NOT NULL default '0000-00-00 00:00:00',
+ is_public enum('yes','no') NOT NULL default 'yes',
+ PRIMARY KEY (blog_id),
+ KEY site_id (site_id),
+ KEY blogname (blogname)
+);
+CREATE TABLE $wpdb->site (
+ id bigint(20) NOT NULL auto_increment,
+ domain varchar(255) NOT NULL default '',
+ path varchar(255) NOT NULL default '',
+ PRIMARY KEY (id),
+ KEY domain (domain),
+ KEY path (path)
+);
+CREATE TABLE $wpdb->sitemeta (
+ meta_id bigint(20) NOT NULL auto_increment,
+ site_id bigint(20) NOT NULL default '0',
+ meta_key varchar(255) default NULL,
+ meta_value longtext,
+ PRIMARY KEY (meta_id),
+ KEY meta_key (meta_key),
+ KEY site_id (site_id)
+);
+CREATE TABLE `referer_blacklist` (
+ `ID` int(11) NOT NULL auto_increment,
+ `blogID` varchar(32) NOT NULL default '',
+ `URL` varchar(250) NOT NULL default '',
+ `t` timestamp(14) NOT NULL,
+ PRIMARY KEY (`ID`),
+ KEY `blogID` (`blogID`,`URL`),
+ KEY `URL` (`URL`)
+);
+CREATE TABLE `referer_visitLog` (
+`blogID` char( 32 ) default NULL ,
+`visitID` int( 11 ) NOT NULL AUTO_INCREMENT ,
+`visitTime` timestamp( 14 ) NOT NULL ,
+`visitURL` char( 250 ) default NULL ,
+`referingURL` char( 250 ) default NULL ,
+`baseDomain` char( 250 ) default NULL ,
+`refpost` int( 11 ) NOT NULL default '0',
+`visitTimes` int( 10 ) NOT NULL default '0',
+`dayofmonth` smallint( 2 ) NOT NULL default '0',
+PRIMARY KEY ( `visitID` ) ,
+KEY `blogID` ( `blogID` ) ,
+KEY `refpost` ( `refpost` ) ,
+KEY `dayofmonth` ( `dayofmonth` )
+);
+CREATE TABLE `wp_linkclicks` (
+ `blogID` varchar(11) default NULL,
+ `link_id` int(11) NOT NULL auto_increment,
+ `link_url` text NOT NULL,
+ `link_clicks` int(11) NOT NULL default '0',
+ `link_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `link_title` text NOT NULL,
+ UNIQUE KEY `link_id` (`link_id`),
+ KEY `blogID` (`blogID`)
+);
+";
+
+function populate_options() {
+ global $wpdb, $wpblog;
+
+ $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+ add_option('siteurl', $guessurl, __('WordPress web address'));
+ add_option('blogname', __('My Weblog'), __('Blog title'));
+ add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
+ add_option('new_users_can_blog', 0);
+ add_option('users_can_register', 0);
+ add_option('admin_email', 'you@example.com');
+ add_option('start_of_week', 1);
+ add_option('use_balanceTags', 1);
+ add_option('use_smilies', 1);
+ add_option('require_name_email', 1);
+ add_option('comments_notify', 1);
+ add_option('posts_per_rss', 10);
+ add_option('rss_excerpt_length', 50);
+ add_option('rss_use_excerpt', 0);
+ add_option('use_fileupload', 1);
+ add_option('fileupload_realpath', ABSPATH . 'wp-content/blogs.dir/'.$wpdb->blogid.'/files');
+ add_option('fileupload_url', get_option('siteurl') . '/files');
+ add_option('fileupload_allowedtypes', 'jpg jpeg gif png');
+ add_option('fileupload_maxk', 300);
+ add_option('fileupload_minlevel', 6);
+ add_option('mailserver_url', 'mail.example.com');
+ add_option('mailserver_login', 'login@example.com');
+ add_option('mailserver_pass', 'password');
+ add_option('mailserver_port', 110);
+ add_option('default_category', 1);
+ add_option('default_comment_status', 'open');
+ add_option('default_ping_status', 'open');
+ add_option('default_pingback_flag', 1);
+ add_option('default_post_edit_rows', 9);
+ add_option('posts_per_page', 10);
+ add_option('what_to_show', 'posts');
+ add_option('date_format', __('F j, Y'));
+ add_option('time_format', __('g:i a'));
+ add_option('links_updated_date_format', __('F j, Y g:i a'));
+ add_option('links_recently_updated_prepend', '<em>');
+ add_option('links_recently_updated_append', '</em>');
+ add_option('links_recently_updated_time', 120);
+ add_option('comment_moderation', 1);
+ add_option('moderation_notify', 0);
+ add_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/');
+ add_option('gzipcompression', 0);
+ add_option('hack_file', 0);
+ add_option('blog_charset', 'UTF-8');
+ add_option('moderation_keys');
+ add_option('active_plugins');
+ add_option('home');
+ add_option('category_base');
+ add_option('ping_sites', 'http://rpc.pingomatic.com/');
+ add_option('advanced_edit', 0);
+ add_option('comment_max_links', 2);
+ // 1.5
+ add_option('default_email_category', 1, __('Posts by email go to this category'));
+ add_option('recently_edited');
+ add_option('use_linksupdate', 0);
+ add_option('template', 'default');
+ add_option('stylesheet', 'default');
+ add_option('comment_whitelist', 1);
+ add_option('page_uris');
+ add_option('blacklist_keys');
+ add_option('comment_registration', 0);
+ add_option('open_proxy_check', 1);
+ add_option('rss_language', 'en');
+ add_option('html_type', 'text/html');
+ // 1.5.1
+ add_option('use_trackback', 0);
+
+ // Delete unused options
+ $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url');
+ foreach ($unusedoptions as $option) :
+ delete_option($option);
+ endforeach;
+
+ // Set up a few options not to load by default
+ $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
+ foreach ($fatoptions as $fatoption) :
+ $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
+ endforeach;
+}
+
+?>
diff --git a/wp-inst/wp-admin/upgrade.php b/wp-inst/wp-admin/upgrade.php
new file mode 100644
index 0000000..c4a176c
--- /dev/null
+++ b/wp-inst/wp-admin/upgrade.php
@@ -0,0 +1,95 @@
+<?php
+define('WP_INSTALLING', true);
+if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
+require('../wp-config.php');
+timer_start();
+require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
+
+$step = $_GET['step'];
+if (!$step) $step = 0;
+?>
+<!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>WordPress &rsaquo; Upgrade</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style media="screen" type="text/css">
+ <!--
+ html {
+ background: #eee;
+ }
+ body {
+ background: #fff;
+ color: #000;
+ font-family: Georgia, "Times New Roman", Times, serif;
+ margin-left: 20%;
+ margin-right: 20%;
+ padding: .2em 2em;
+ }
+
+ h1 {
+ color: #006;
+ font-size: 18px;
+ font-weight: lighter;
+ }
+
+ h2 {
+ font-size: 16px;
+ }
+
+ p, li, dt {
+ line-height: 140%;
+ padding-bottom: 2px;
+ }
+
+ ul, ol {
+ padding: 5px 5px 5px 20px;
+ }
+ #logo {
+ margin-bottom: 2em;
+ }
+.step a, .step input {
+ font-size: 2em;
+}
+.step, th {
+ text-align: right;
+}
+#footer {
+text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic;
+}
+ -->
+ </style>
+</head>
+<body>
+<h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1>
+<?php
+switch($step) {
+
+ case 0:
+?>
+<p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.'); ?></p>
+ <h2 class="step"><a href="upgrade.php?step=1"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
+<?php
+ break;
+
+ case 1:
+ make_db_current_silent();
+ upgrade_all();
+?>
+<h2><?php _e('Step 1'); ?></h2>
+ <p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"), __get_option('home')); ?></p>
+
+<!--
+<pre>
+<?php printf(__('%s queries'), $wpdb->num_queries); ?>
+
+<?php printf(__('%s seconds'), timer_stop(0)); ?>
+</pre>
+-->
+
+<?php
+ break;
+}
+?>
+</body>
+</html>
diff --git a/wp-inst/wp-admin/upload.php b/wp-inst/wp-admin/upload.php
new file mode 100644
index 0000000..61c8f21
--- /dev/null
+++ b/wp-inst/wp-admin/upload.php
@@ -0,0 +1,235 @@
+<?php
+require_once('admin.php');
+
+$title = 'Upload Image or File';
+
+require_once('admin-header.php');
+
+if ($user_level == 0) //Checks to see if user has logged in
+ die (__("Cheatin' uh ?"));
+
+if (!get_settings('use_fileupload')) //Checks if file upload is enabled in the config
+ die (__("The admin disabled this function"));
+
+if ( !get_settings('fileupload_minlevel') )
+ die (__("You are not allowed to upload files"));
+
+$allowed_types = explode(' ', "jpg jpeg png gif");
+
+if ($_POST['submit']) {
+ $action = 'upload';
+} else {
+ $action = '';
+}
+
+if (!is_writable(get_settings('fileupload_realpath')))
+ $action = 'not-writable';
+$action = apply_filters('fileupload_init',$action);
+?>
+
+<div class="wrap">
+
+<?php
+switch ($action) {
+case 'not-writable':
+?>
+<p><?php printf(__("It doesn't look like you can use the file upload feature at this time because the directory you have specified (<code>%s</code>) doesn't appear to be writable by WordPress. Check the permissions on the directory and for typos."), get_settings('fileupload_realpath')) ?></p>
+
+<?php
+break;
+case '':
+ foreach ($allowed_types as $type) {
+ $type_tags[] = "<code>$type</code>";
+ }
+ $i = implode(', ', $type_tags);
+?>
+<p><?php printf(__('You can upload files with the extension %1$s as long as they are no larger than %2$s <abbr title="Kilobytes">KB</abbr>. If you&#8217;re an admin you can configure these values under <a href="%3$s">options</a>.'), $i, get_settings('fileupload_maxk'), 'options-misc.php') ?></p>
+ <form action="upload.php" method="post" enctype="multipart/form-data">
+ <p>
+ <label for="img1"><?php _e('File:') ?></label>
+ <br />
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_settings('fileupload_maxk') * 1024 ?>" />
+ <input type="file" name="img1" id="img1" size="35" class="uploadform" /></p>
+ <p>
+ <label for="imgdesc"><?php _e('Description:') ?></label><br />
+ <input type="text" name="imgdesc" id="imgdesc" size="30" class="uploadform" />
+ </p>
+
+ <p><?php _e('Create a thumbnail?') ?></p>
+ <p>
+ <label for="thumbsize_no">
+ <input type="radio" name="thumbsize" value="none" checked="checked" id="thumbsize_no" />
+ <?php _e('No thanks') ?></label>
+ <br />
+ <label for="thumbsize_small">
+<input type="radio" name="thumbsize" value="small" id="thumbsize_small" />
+<?php _e('Small (200px largest side)') ?></label>
+ <br />
+ <label for="thumbsize_large">
+<input type="radio" name="thumbsize" value="large" id="thumbsize_large" />
+<?php _e('Large (400px largest side)') ?></label>
+ <br />
+ <label for="thumbsize_custom">
+ <input type="radio" name="thumbsize" value="custom" id="thumbsize_custom" />
+<?php _e('Custom size') ?></label>
+ :
+ <input type="text" name="imgthumbsizecustom" size="4" />
+ <?php _e('px (largest side)') ?> </p>
+ <p><input type="submit" name="submit" value="<?php _e('Upload File') ?>" /></p>
+ </form>
+</div><?php
+break;
+case 'upload':
+
+ $imgalt = basename( (isset($_POST['imgalt'])) ? $_POST['imgalt'] : '' );
+
+ $img1_name = (strlen($imgalt)) ? $imgalt : basename( $_FILES['img1']['name'] );
+ $img1_name = preg_replace('/[^a-z0-9_.]/i', '', $img1_name);
+ $img1_size = $_POST['img1_size'] ? intval($_POST['img1_size']) : intval($_FILES['img1']['size']);
+
+ $img1_type = (strlen($imgalt)) ? $_POST['img1_type'] : $_FILES['img1']['type'];
+ $imgdesc = htmlentities2($_POST['imgdesc']);
+
+ $pi = pathinfo($img1_name);
+ $imgtype = strtolower($pi['extension']);
+
+ if (in_array($imgtype, $allowed_types) == false)
+ die(sprintf(__('File %1$s of type %2$s is not allowed.') , $img1_name, $imgtype));
+
+ if (strlen($imgalt)) {
+ $pathtofile = get_settings('fileupload_realpath')."/".$imgalt;
+ $img1 = $_POST['img1'];
+ } else {
+ $pathtofile = get_settings('fileupload_realpath')."/".$img1_name;
+ $img1 = $_FILES['img1']['tmp_name'];
+ }
+ // do_action rather than apply_filters - becuase there's nothing we can change at this point
+ do_action('fileupload_pre',array('filename'=>$pathtofile, 'filesize'=>$img1_size, 'fullpath'=>$pathtofile));
+
+ // makes sure not to upload duplicates, rename duplicates
+ $i = 1;
+ $pathtofile2 = $pathtofile;
+ $tmppathtofile = $pathtofile2;
+ $img2_name = $img1_name;
+
+ while ( file_exists($pathtofile2) ) {
+ $pos = strpos( strtolower($tmppathtofile), '.' . trim($imgtype) );
+ $pathtofile_start = substr($tmppathtofile, 0, $pos);
+ $pathtofile2 = $pathtofile_start.'_'.zeroise($i++, 2).'.'.trim($imgtype);
+ $img2_name = explode('/', $pathtofile2);
+ $img2_name = $img2_name[count($img2_name)-1];
+ }
+
+ if (file_exists($pathtofile) && !strlen($imgalt)) {
+ $i = explode(' ', get_settings('fileupload_allowedtypes'));
+ $i = implode(', ',array_slice($i, 1, count($i)-2));
+ $moved = move_uploaded_file($img1, $pathtofile2);
+ // if move_uploaded_file() fails, try copy()
+ if (!$moved) {
+ $moved = copy($img1, $pathtofile2);
+ }
+ if (!$moved) {
+ die(sprintf(__("Couldn't upload your file to %s."), $pathtofile2));
+ } else {
+ chmod($pathtofile2, 0666);
+ @unlink($img1);
+ }
+
+ //
+
+ // duplicate-renaming function contributed by Gary Lawrence Murphy
+ ?>
+ <p><strong><?php __('Duplicate File?') ?></strong></p>
+ <p><b><em><?php printf(__("The filename '%s' already exists!"), $img1_name); ?></em></b></p>
+ <p> <?php printf(__("Filename '%1\$s' moved to '%2\$s'"), $img1, "$pathtofile2 - $img2_name") ?></p>
+ <p><?php _e('Confirm or rename:') ?></p>
+ <form action="upload.php" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_settings('fileupload_maxk') *1024 ?>" />
+ <input type="hidden" name="img1_type" value="<?php echo $img1_type;?>" />
+ <input type="hidden" name="img1_name" value="<?php echo $img2_name;?>" />
+ <input type="hidden" name="img1_size" value="<?php echo $img1_size;?>" />
+ <input type="hidden" name="img1" value="<?php echo $pathtofile2;?>" />
+ <input type="hidden" name="thumbsize" value="<?php echo $_REQUEST['thumbsize'];?>" />
+ <input type="hidden" name="imgthumbsizecustom" value="<?php echo $_REQUEST['imgthumbsizecustom'];?>" />
+ <?php _e('Alternate name:') ?><br /><input type="text" name="imgalt" size="30" class="uploadform" value="<?php echo $img2_name;?>" /><br />
+ <br />
+ <?php _e('Description:') ?><br /><input type="text" name="imgdesc" size="30" class="uploadform" value="<?php echo $imgdesc;?>" />
+ <br />
+ <input type="submit" name="submit" value="<?php _e('Rename') ?>" class="search" />
+ </form>
+</div>
+<?php
+
+require('admin-footer.php');
+die();
+
+ }
+
+ if (!strlen($imgalt)) {
+ @$moved = move_uploaded_file($img1, $pathtofile); //Path to your images directory, chmod the dir to 777
+ // move_uploaded_file() can fail if open_basedir in PHP.INI doesn't
+ // include your tmp directory. Try copy instead?
+ if(!$moved) {
+ $moved = copy($img1, $pathtofile);
+ }
+ // Still couldn't get it. Give up.
+ if (!$moved) {
+ die(sprintf(__("Couldn't upload your file to %s."), $pathtofile));
+ } else {
+ chmod($pathtofile, 0666);
+ @unlink($img1);
+ }
+
+ } else {
+ rename($img1, $pathtofile)
+ or die(sprintf(__("Couldn't upload your file to %s."), $pathtofile));
+ }
+
+ if($_POST['thumbsize'] != 'none' ) {
+ if($_POST['thumbsize'] == 'small') {
+ $max_side = 200;
+ }
+ elseif($_POST['thumbsize'] == 'large') {
+ $max_side = 400;
+ }
+ elseif($_POST['thumbsize'] == 'custom') {
+ $max_side = intval($_POST['imgthumbsizecustom']);
+ }
+
+ $result = wp_create_thumbnail($pathtofile, $max_side, NULL);
+ if($result != 1) {
+ print $result;
+ }
+ }
+
+// Defined as a filter - because we might want to change the name
+$img1_name = apply_filters('fileupload_post',$img1_name);
+if ( ereg('image/',$img1_type) )
+ $piece_of_code = "<img src='" . get_settings('fileupload_url') ."/$img1_name' alt='$imgdesc' />";
+else
+ $piece_of_code = "<a href='". get_settings('fileupload_url') . "/$img1_name' title='$imgdesc'>$imgdesc</a>";
+
+$piece_of_code = htmlspecialchars( $piece_of_code );
+?>
+
+<h3><?php _e('File uploaded!') ?></h3>
+<p><?php printf(__("Your file <code>%s</code> was uploaded successfully!"), $img1_name); ?></p>
+<p><?php _e('Here&#8217;s the code to display it:') ?></p>
+<p><code><?php echo $piece_of_code; ?></code>
+</p>
+<p><strong><?php _e('Image Details') ?></strong>: <br />
+Name:
+<?php echo $img1_name; ?>
+<br />
+<?php _e('Size:') ?>
+<?php echo round($img1_size / 1024, 2); ?> <?php _e('<abbr title="Kilobyte">KB</abbr>') ?><br />
+<?php _e('Type:') ?>
+<?php echo $img1_type; ?>
+</p>
+</div>
+<p><a href="upload.php"><?php _e('Upload another') ?></a></p>
+<?php
+break;
+}
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/user-edit.php b/wp-inst/wp-admin/user-edit.php
new file mode 100644
index 0000000..adac5a0
--- /dev/null
+++ b/wp-inst/wp-admin/user-edit.php
@@ -0,0 +1,216 @@
+<?php
+require_once('admin.php');
+
+$title = __('Edit User');
+$parent_file = 'profile.php';
+$submenu_file = 'users.php';
+
+$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
+for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+}
+
+switch ($action) {
+case 'update':
+
+get_currentuserinfo();
+$edituser = get_userdata($user_id);
+if ($edituser->user_level >= $user_level) die( __('You do not have permission to edit this user.') );
+
+/* checking the nickname has been typed */
+if (empty($_POST["new_nickname"])) {
+ die (__("<strong>ERROR</strong>: please enter your nickname (can be the same as your username)"));
+ return false;
+}
+
+$new_user_login = wp_specialchars($_POST['new_user_login']);
+$pass1 = $_POST['pass1'];
+$pass2 = $_POST['pass2'];
+do_action('check_passwords', array($new_user_login, &$pass1, &$pass2));
+
+if ( '' == $pass1 ) {
+ if ( '' != $pass2 )
+ die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
+ $updatepassword = '';
+} else {
+ if ( '' == $pass2)
+ die (__("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice."));
+ if ( $pass1 != $pass2 )
+ die (__("<strong>ERROR</strong>: you typed two different passwords. Go back to correct that."));
+ $new_pass = $pass1;
+ $updatepassword = "user_pass=MD5('$new_pass'), ";
+}
+
+$new_firstname = wp_specialchars($_POST['new_firstname']);
+$new_lastname = wp_specialchars($_POST['new_lastname']);
+$new_nickname = $_POST['new_nickname'];
+$new_nicename = sanitize_title($new_nickname, $user_id);
+$new_icq = wp_specialchars($_POST['new_icq']);
+$new_aim = wp_specialchars($_POST['new_aim']);
+$new_msn = wp_specialchars($_POST['new_msn']);
+$new_yim = wp_specialchars($_POST['new_yim']);
+$new_email = wp_specialchars($_POST['new_email']);
+$new_url = wp_specialchars($_POST['new_url']);
+$new_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $new_url) ? $new_url : 'http://' . $new_url;
+$display_name = wp_specialchars($_POST['display_name']);
+$new_description = $_POST['new_description'];
+
+$result = $wpdb->query("UPDATE $wpdb->users SET user_login = '$new_user_login', $updatepassword user_email='$new_email', user_url='$new_url', user_nicename = '$new_nicename', display_name = '$display_name' WHERE ID = '$user_id'");
+
+update_usermeta( $user_id, 'first_name', $new_firstname );
+update_usermeta( $user_id, 'last_name', $new_lastname );
+update_usermeta( $user_id, 'nickname', $new_nickname );
+update_usermeta( $user_id, 'description', $new_description );
+update_usermeta( $user_id, 'icq', $new_icq );
+update_usermeta( $user_id, 'aim', $new_aim );
+update_usermeta( $user_id, 'msn', $new_msn );
+update_usermeta( $user_id, 'yim', $new_yim );
+
+header("Location: user-edit.php?user_id=$user_id&updated=true");
+
+break;
+
+case 'switchposts':
+
+check_admin_referer();
+
+/* TODO: Switch all posts from one user to another user */
+
+break;
+
+default:
+include ('admin-header.php');
+
+$edituser = get_userdata($user_id);
+
+if ($edituser->user_level >= $user_level) die( __('You do not have permission to edit this user.') );
+?>
+
+<?php if ( isset($_GET['updated']) ) : ?>
+<div class="updated">
+ <p><strong><?php _e('User updated.') ?></strong></p>
+</div>
+<?php endif; ?>
+
+<div class="wrap">
+<h2><?php _e('Edit User'); ?></h2>
+<form name="edituser" id="edituser" action="user-edit.php" method="post">
+<table width="99%" border="0" cellspacing="2" cellpadding="3">
+ <tr>
+ <th width="33%" scope="row"><?php _e('Username:') ?></th>
+ <td width="73%"><input type="text" name="new_user_login" id="new_user_login" value="<?php echo $edituser->user_login; ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Level:') ?></th>
+ <td><?php echo $edituser->user_level; ?></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Posts:') ?></th>
+ <td><?php echo get_usernumposts($edituser->ID); ?></td>
+ </tr>
+<?php if ( '0000-00-00 00:00:00' != $edituser->user_registered ) { ?>
+ <tr>
+ <th scope="row"><?php _e('Registered on:') ?></th>
+ <td><?php echo substr($edituser->user_registered, 0, 11); ?></td>
+ </tr>
+<?php } ?>
+ <tr>
+ <th scope="row"><?php _e('First name:') ?></th>
+ <td><input type="text" name="new_firstname" id="new_firstname" value="<?php echo $edituser->first_name ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Last name:') ?></th>
+ <td><input type="text" name="new_lastname" id="new_lastname2" value="<?php echo $edituser->last_name ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Profile:') ?></th>
+ <td><textarea name="new_description" rows="5" id="new_description" style="width: 99%; "><?php echo $edituser->user_description ?></textarea></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Nickname:') ?></th>
+ <td><input type="text" name="new_nickname" id="new_nickname" value="<?php echo $edituser->nickname ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('E-mail:') ?></th>
+ <td><input type="text" name="new_email" id="new_email" value="<?php echo $edituser->user_email ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Website:') ?></th>
+ <td><input type="text" name="new_url" id="new_url" value="<?php echo $edituser->user_url ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('ICQ:') ?></th>
+ <td><input type="text" name="new_icq" id="new_icq" value="<?php if ($edituser->icq > 0) { echo $edituser->icq; } ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('AIM:') ?></th>
+ <td><input type="text" name="new_aim" id="new_aim" value="<?php echo $edituser->aim ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('MSN IM:') ?>
+ </th>
+ <td><input type="text" name="new_msn" id="new_msn" value="<?php echo $edituser->msn ?>" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Yahoo IM:') ?>
+ </th>
+ <td><input type="text" name="new_yim" id="new_yim" value="<?php echo $edituser->yim ?>" />
+ </td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Identity on blog:') ?>
+ </th>
+ <td> <select name="display_name">
+ <option value="<?php echo $edituser->display_name; ?>"><?php echo $edituser->display_name; ?></option>
+ <option value="<?php echo $edituser->nickname ?>"><?php echo $edituser->nickname ?></option>
+ <option value="<?php echo $edituser->user_login ?>"><?php echo $edituser->user_login ?></option>
+ <?php if ( !empty( $edituser->first_name ) ) : ?>
+ <option value="<?php echo $edituser->first_name ?>"><?php echo $edituser->first_name ?></option>
+ <?php endif; ?>
+ <?php if ( !empty( $edituser->last_name ) ) : ?>
+ <option value="<?php echo $edituser->last_name ?>"><?php echo $edituser->last_name ?></option>
+ <?php endif; ?>
+ <?php if ( !empty( $edituser->first_name ) && !empty( $edituser->last_name ) ) : ?>
+ <option value="<?php echo $edituser->first_name." ".$edituser->last_name ?>"><?php echo $edituser->first_name." ".$edituser->last_name ?></option>
+ <option value="<?php echo $edituser->last_name." ".$edituser->first_name ?>"><?php echo $edituser->last_name." ".$edituser->first_name ?></option>
+ <?php endif; ?>
+ </select>
+ </td>
+ </tr>
+<?php
+$show_password_fields = apply_filters('show_password_fields', true);
+if ( $show_password_fields ) :
+?>
+ <tr>
+ <th scope="row"><?php _e('New <strong>Password</strong> (Leave blank to stay the same.)') ?></th>
+ <td><input type="password" name="pass1" size="16" value="" />
+ <br />
+ <input type="password" name="pass2" size="16" value="" /></td>
+ </tr>
+<?php endif; ?>
+</table>
+ <p class="submit">
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
+ <input type="submit" value="<?php _e('Update User &raquo;') ?>" name="submit" />
+ </p>
+</form>
+</div>
+
+<?php
+break;
+}
+
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/users.php b/wp-inst/wp-admin/users.php
new file mode 100644
index 0000000..296c6a8
--- /dev/null
+++ b/wp-inst/wp-admin/users.php
@@ -0,0 +1,290 @@
+<?php
+require_once('admin.php');
+require_once( ABSPATH . WPINC . '/registration-functions.php');
+
+$title = __('Users');
+$parent_file = 'profile.php';
+
+$action = $_REQUEST['action'];
+
+switch ($action) {
+case 'adduser':
+ check_admin_referer();
+
+ $user_login = wp_specialchars(trim($_POST['user_login']));
+ $pass1 = $_POST['pass1'];
+ $pass2 = $_POST['pass2'];
+ $user_email = wp_specialchars(trim($_POST['email']));
+ $user_firstname = wp_specialchars(trim($_POST['firstname']));
+ $user_lastname = wp_specialchars(trim($_POST['lastname']));
+ $user_uri = wp_specialchars(trim($_POST['uri']));
+
+ /* checking that username has been typed */
+ if ($user_login == '')
+ die (__('<strong>ERROR</strong>: Please enter a username.'));
+
+ /* checking the password has been typed twice */
+ do_action('check_passwords', array($user_login, &$pass1, &$pass2));
+ if ($pass1 == '' || $pass2 == '')
+ die (__('<strong>ERROR</strong>: Please enter your password twice.'));
+
+ /* checking the password has been typed twice the same */
+ if ($pass1 != $pass2)
+ die (__('<strong>ERROR</strong>: Please type the same password in the two password fields.'));
+
+ $user_nickname = $user_login;
+
+ if ( username_exists( $user_login ) )
+ die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
+
+ /* checking e-mail address */
+ if (empty($user_email)) {
+ die (__("<strong>ERROR</strong>: please type an e-mail address"));
+ return false;
+ } else if (!is_email($user_email)) {
+ die (__("<strong>ERROR</strong>: the email address isn't correct"));
+ return false;
+ }
+
+ $user_ID = create_user( $user_login, $pass1, $user_email, 0 );
+
+ update_usermeta( $user_ID, 'first_name', $user_firstname);
+ update_usermeta( $user_ID, 'last_name', $user_lastname);
+ update_usermeta( $user_ID, 'first_name', $user_firstname);
+
+ $stars = '';
+ for ($i = 0; $i < strlen($pass1); $i = $i + 1)
+ $stars .= '*';
+
+ $user_login = stripslashes($user_login);
+ $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n";
+ $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
+ $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
+
+ @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
+ header('Location: users.php');
+break;
+
+case 'promote':
+ check_admin_referer();
+
+ if (empty($_GET['prom'])) {
+ header('Location: users.php');
+ }
+
+ $id = (int) $_GET['id'];
+ $prom = $_GET['prom'];
+
+ $user_data = get_userdata($id);
+
+ $usertopromote_level = $user_data->user_level;
+
+ if ( $user_level <= $usertopromote_level )
+ die(__('Can&#8217;t change the level of a user whose level is higher than yours.'));
+
+ if ('up' == $prom) {
+ $new_level = $usertopromote_level + 1;
+ } elseif ('down' == $prom) {
+ $new_level = $usertopromote_level - 1;
+ }
+ update_usermeta( $id, $wpdb->prefix . 'user_level', $new_level);
+
+ header('Location: users.php');
+
+break;
+
+case 'delete':
+
+ check_admin_referer();
+
+ $id = (int) $_GET['id'];
+
+ if (!$id) {
+ header('Location: users.php');
+ }
+
+ $user_data = get_userdata($id);
+ $usertodelete_level = $user_data->user_level;
+
+ if ($user_level <= $usertodelete_level)
+ die(__('Can&#8217;t delete a user whose level is higher than yours.'));
+
+ wp_delete_user($id);
+
+ header('Location: users.php?deleted=true');
+
+break;
+
+default:
+
+ include ('admin-header.php');
+ ?>
+
+<?php if (isset($_GET['deleted'])) : ?>
+<div class="updated"><p><?php _e('User deleted.') ?></p></div>
+<?php endif; ?>
+<div class="wrap">
+ <h2><?php _e('Authors') ?></h2>
+ <table cellpadding="3" cellspacing="3" width="100%">
+ <tr>
+ <th><?php _e('ID') ?></th>
+ <th><?php _e('Nickname') ?></th>
+ <th><?php _e('Name') ?></th>
+ <th><?php _e('E-mail') ?></th>
+ <th><?php _e('Website') ?></th>
+ <th><?php _e('Level') ?></th>
+ <th><?php _e('Posts') ?></th>
+ <th>&nbsp;</th>
+ </tr>
+ <?php
+ $authors =
+ $users = get_author_user_ids();
+ $style = '';
+ foreach ($users as $user) {
+ $user_data = get_userdata($user);
+ $email = $user_data->user_email;
+ $url = $user_data->user_url;
+ $short_url = str_replace('http://', '', $url);
+ $short_url = str_replace('www.', '', $short_url);
+ if ('/' == substr($short_url, -1))
+ $short_url = substr($short_url, 0, -1);
+ if (strlen($short_url) > 35)
+ $short_url = substr($short_url, 0, 32).'...';
+ $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
+ $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user' and post_status = 'publish'");
+ if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>";
+ echo "
+<tr $style>
+ <td align='center'>$user_data->ID</td>
+ <td><strong>$user_data->user_login</strong></td>
+ <td>$user_data->first_name $user_data->last_name</td>
+ <td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
+ <td><a href='$url' title='website: $url'>$short_url</a></td>
+ <td align='center'>";
+ if (($user_level >= 2) and ($user_level > $user_data->user_level) and ($user_data->user_level > 0))
+ echo " <a href=\"users.php?action=promote&amp;id=".$user_data->ID."&amp;prom=down\">-</a> ";
+ echo $user_data->user_level;
+ if (($user_level >= 2) and ($user_level > ($user_data->user_level + 1)))
+ echo " <a href=\"users.php?action=promote&amp;id=".$user_data->ID."&amp;prom=up\">+</a> ";
+ echo "</td><td align='right'>$numposts</td>";
+ echo '<td>';
+ if (($user_level >= 2) and ($user_level > $user_data->user_level))
+ echo "<a href='user-edit.php?user_id=$user_data->ID' class='edit'>".__('Edit')."</a>";
+ echo '</td>';
+ echo '</tr>';
+ }
+
+ ?>
+
+ </table>
+</div>
+
+<?php
+$users = get_nonauthor_user_ids();
+if ($users) {
+?>
+<div class="wrap">
+ <h2><?php _e('Registered Users') ?></h2>
+ <table cellpadding="3" cellspacing="3" width="100%">
+ <tr>
+ <th><?php _e('ID') ?></th>
+ <th><?php _e('Nickname') ?></th>
+ <th><?php _e('Name') ?></th>
+ <th><?php _e('E-mail') ?></th>
+ <th><?php _e('Website') ?></th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+<?php
+$style = '';
+foreach ($users as $user) {
+ $user_data = get_userdata($user);
+ $email = $user_data->user_email;
+ $url = $user_data->user_url;
+ $short_url = str_replace('http://', '', $url);
+ $short_url = str_replace('www.', '', $short_url);
+ if ('/' == substr($short_url, -1))
+ $short_url = substr($short_url, 0, -1);
+ if (strlen($short_url) > 35)
+ $short_url = substr($short_url, 0, 32).'...';
+ $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
+echo "\n<tr $style>
+<td align='center'>$user_data->ID</td>
+<td><strong>$user_data->user_login</strong></td>
+<td>$user_data->first_name $user_data->last_name</td>
+<td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
+<td><a href='$url' title='website: $url'>$short_url</a></td>
+<td align='center'>";
+
+ if ($user_level >= 6)
+ echo "<a href='users.php?action=promote&amp;id=$user_data->ID&amp;prom=up' class='edit'>". __('Promote') . '</a>';
+ echo "</td>\n";
+ echo '<td>';
+ if (($user_level >= 6) and ($user_level > $user_data->user_level))
+ echo "<a href='user-edit.php?user_id=$user_data->ID' class='edit'>".__('Edit')."</a>";
+ echo '</td><td>';
+ if ($user_level >= 6)
+ echo "<a href='users.php?action=delete&amp;id=$user_data->ID' class='delete' onclick='return confirm(\"" . __('You are about to delete this user \n OK to delete, Cancel to stop.') . "\")'>" . __('Delete'). '</a>';
+ echo '</td></tr>';
+
+}
+
+?>
+
+ </table>
+ <p><?php _e('Deleting a user also deletes all posts made by that user.') ?></p>
+</div>
+
+ <?php
+ } ?>
+<div class="wrap">
+<h2><?php _e('Add New User') ?></h2>
+<?php printf(__('<p>Users can <a href="%s/wp-register.php">register themselves</a> or you can manually create users here.</p>'), get_settings('siteurl')); ?>
+<form action="" method="post" name="adduser" id="adduser">
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
+ <tr>
+ <th scope="row" width="33%"><?php _e('Nickname') ?>
+ <input name="action" type="hidden" id="action" value="adduser" /></th>
+ <td width="66%"><input name="user_login" type="text" id="user_login" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('First Name') ?> </th>
+ <td><input name="firstname" type="text" id="firstname" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Last Name') ?> </th>
+ <td><input name="lastname" type="text" id="lastname" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('E-mail') ?></th>
+ <td><input name="email" type="text" id="email" /></td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e('Website') ?></th>
+ <td><input name="uri" type="text" id="uri" /></td>
+ </tr>
+<?php
+$show_password_fields = apply_filters('show_password_fields', true);
+if ( $show_password_fields ) :
+?>
+ <tr>
+ <th scope="row"><?php _e('Password (twice)') ?> </th>
+ <td><input name="pass1" type="password" id="pass1" />
+ <br />
+ <input name="pass2" type="password" id="pass2" /></td>
+ </tr>
+<?php endif; ?>
+ </table>
+ <p class="submit">
+ <input name="adduser" type="submit" id="adduser" value="<?php _e('Add User') ?> &raquo;" />
+ </p>
+ </form>
+</div>
+ <?php
+
+break;
+}
+
+include('admin-footer.php');
+?>
diff --git a/wp-inst/wp-admin/wp-admin.css b/wp-inst/wp-admin/wp-admin.css
new file mode 100644
index 0000000..d2e47c1
--- /dev/null
+++ b/wp-inst/wp-admin/wp-admin.css
@@ -0,0 +1,682 @@
+* html #poststuff {
+ height: 100%; /* kill peekaboo bug in IE */
+}
+
+a {
+ border-bottom: 1px solid #69c;
+ color: #00019b;
+ text-decoration: none;
+}
+
+a.delete:hover {
+ background: #c00;
+ color: #fff;
+}
+
+#planetnews ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+#planetnews li {
+ width: 17%;
+ margin: 1%;
+ float: left;
+}
+
+#planetnews li a {
+ display: block;
+ padding: .5em;
+ background: #ddd;
+ height: 6em;
+ overflow: hidden;
+}
+
+a.edit, a.delete, a.edit:hover, a.delete:hover {
+ border-bottom: none;
+ display: block;
+ padding: 5px 0;
+ text-align: center;
+}
+
+a.edit:hover {
+ background: #ccc;
+ color: #036;
+}
+
+a:visited {
+ color: #006;
+}
+
+a:hover {
+ border-bottom: 1px solid #3a75ae;
+ color: #069;
+}
+
+body {
+ background: #fff;
+ color: #000;
+ margin: 0;
+ padding: 0;
+}
+
+body, td {
+ font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
+}
+
+fieldset {
+ border: none;
+ padding: 3px;
+}
+
+fieldset label.selectit {
+ background: #f0f0f0;
+ display: block;
+ font-size: 11px;
+ padding: 0 2px;
+}
+
+fieldset label.selectit:hover {
+ background: #dadada;
+}
+
+fieldset legend {
+ padding: .1em .3em;
+}
+
+fieldset span.cat-nest {
+ display: block;
+ margin-left: 10px;
+}
+
+fieldset.options {
+ padding: 1em;
+}
+
+fieldset.options legend {
+ font-size: 16px;
+}
+
+form, label input {
+ margin: 0;
+ padding: 0;
+}
+
+h2 {
+ border-bottom: 2px solid #69c;
+ color: #333;
+ font: normal 22px/18px serif;
+ margin: 5px 10px;
+}
+
+img, #footer a {
+ border: 0;
+}
+
+input:focus, textarea:focus, label:focus {
+ background: #fff;
+ border: 1px solid #686868;
+}
+
+label {
+ cursor: pointer;
+}
+
+li, dd {
+ margin-bottom: 6px;
+}
+
+p, li, dl, dd, dt {
+ line-height: 130%;
+}
+
+textarea, input, select {
+ background: #f4f4f4;
+ border: 1px solid #b2b2b2;
+ color: #000;
+ font: 13px Verdana, Arial, Helvetica, sans-serif;
+ margin: 1px;
+ padding: 3px;
+}
+
+.alignleft {
+ float: left
+}
+
+.alignright {
+ float: right;
+}
+
+.alternate {
+ background: #eee;
+}
+
+.anchors {
+ margin: 10px 20px 10px 20px;
+}
+
+.checkbox {
+ background: #fff;
+ border: none;
+ margin: 0;
+ padding: 0;
+}
+
+.code {
+ font-family: "Courier New", Courier, monospace;
+}
+
+.commentlist li {
+ border-bottom: 1px solid #369;
+ padding: .3em 1em;
+}
+
+.ed_button {
+ padding: 1px;
+}
+
+.hidden {
+ display: none;
+}
+
+.navigation {
+ display: block;
+ text-align: center;
+ margin-top: 10px;
+ margin-bottom: 30px;
+}
+
+.post-categories {
+ display: inline;
+ margin: 0;
+ padding: 0;
+}
+
+.post-categories li, #ed_toolbar {
+ display: inline;
+}
+
+.quicktags, .search {
+ background: #ccc;
+ color: #000;
+ font: 12px Georgia, "Times New Roman", Times, serif;
+}
+
+.submit input, .submit input:focus, .button {
+ background: url(../wp-images/fade-butt.png);
+ border: 3px double #999;
+ border-left-color: #ccc;
+ border-top-color: #ccc;
+ color: #333;
+ padding: 0.25em;
+}
+
+.submit input:active, .button:active {
+ background: #f4f4f4;
+ border: 3px double #ccc;
+ border-left-color: #999;
+ border-top-color: #999;
+}
+
+.submit, .editform th, #postcustomsubmit {
+ text-align: right;
+}
+
+.unapproved {
+ color: #888;
+}
+
+.unapproved a:link {
+ color: #b9bcff;
+}
+
+.unapproved a:visited {
+ color: #696dff;
+}
+
+.unapproved a:hover {
+ color: #009ef0;
+}
+
+.updated {
+ background: #f0f8ff;
+ border: 1px solid #69c;
+ margin: 1em 5% 10px;
+ padding: 0 1em 0 1em;
+}
+
+.wrap {
+ background: #fff;
+ border: 1px solid #ccc;
+ clear: both;
+ margin: 15px 5%;
+ padding: .5em 1em;
+}
+
+.wrap h2 {
+ margin: 6px 0;
+}
+
+#adminmenu {
+ background: #fff;
+ border-bottom: 2px solid #707070;
+ margin: 0;
+ padding: .2em;
+}
+
+#adminmenu .current, #adminmenu2 .current {
+ font-weight: bold;
+}
+
+#adminmenu a {
+ border: 1px solid #fff;
+ color: #333;
+ font-size: 16px;
+ font-weight: normal;
+ margin: 0;
+ padding: 3px 5px;
+ text-decoration: none;
+}
+
+#adminmenu a:hover, .current {
+ background: #ccc;
+ border: 1px solid #9d9d9d;
+ color: #171717;
+}
+
+#adminmenu li, #adminmenu2 li {
+ display: inline;
+ line-height: 200%;
+ list-style: none;
+ text-align: center;
+}
+
+#adminmenu2 {
+ background: #a3a3a3;
+ border-bottom: none;
+ margin: 0;
+ padding: 3px 2em 0;
+}
+
+#adminmenu2 .current {
+ background: #f2f2f2;
+ border-top: 1px solid #9a9a9a;
+ border-right: 2px solid #4f4f4f;
+ color: #000;
+}
+
+#adminmenu2 a {
+ border: none;
+ color: #fff;
+ font-size: 12px;
+ padding: .3em .4em .33em;
+}
+
+#adminmenu2 a:hover {
+ background: #f0f0f0;
+ color: #393939;
+}
+
+#adminmenu2 li {
+ line-height: 170%;
+}
+
+
+#categorydiv input, #poststatusdiv input, #commentstatusdiv input, #pingstatusdiv input {
+ border: none;
+}
+
+#content, #titlediv input, #quicktags {
+ margin-left: 2%;
+ width: 97%;
+}
+
+#deletepost:hover {
+ background: #ce0000;
+ color: #fff;
+}
+
+#quicktags #ed_strong {
+ font-weight: bold;
+}
+
+#quicktags #ed_link {
+ color: blue;
+ text-decoration: underline;
+}
+
+#quicktags #ed_del {
+ text-decoration: line-through;
+}
+
+#quicktags #ed_em {
+ font-style: italic;
+}
+
+#quicktags #ed_code {
+ font-family: "Courier New", Courier, mono;
+}
+
+#excerpt {
+ height: 1.8em;
+ width: 98%;
+}
+
+#footer {
+ text-align: center;
+}
+
+#login {
+ background: #fff;
+ border: 2px solid #a2a2a2;
+ margin: 5em auto;
+ padding: 1.5em;
+ width: 25em;
+}
+
+#login #login_error {
+ background: #c00;
+ border: 1px solid #a40000;
+ color: #fff;
+ font-size: 16px;
+ font-weight: bold;
+ padding: .5em;
+ text-align: center;
+}
+
+#login h1 {
+ background: url(../wp-images/wp-small.png) no-repeat;
+ margin-top: 0;
+}
+
+#login h1 a {
+ display: block;
+ text-indent: -1000px;
+}
+
+#login input {
+ padding: 3px;
+}
+
+#login ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+#login ul li {
+ display: inline;
+ margin-left: 1.4em;
+ text-align: center;
+}
+
+
+#postcustom .updatemeta, #postcustom .deletemeta {
+ margin: auto;
+ width: 5em;
+}
+
+#postcustom table {
+ border: 1px solid #ccc;
+ margin: .5em;
+ width: 98%;
+}
+
+#postcustom table input, #postcustom table textarea {
+ width: 95%;
+}
+
+#poststuff {
+ margin-right: 16em;
+}
+
+#profile {
+ margin: 10px;
+}
+
+#profile .left {
+ border-right: 1px dashed #ccc;
+ float: left;
+ margin-right: 5px;
+ padding-right: 5px;
+}
+
+#profile label {
+ float: left;
+ padding-right: 3px;
+ text-align: right;
+ width: 85px;
+}
+
+#profile p {
+ margin: 0 0 4px 0;
+}
+
+#save {
+ width: 15em;
+}
+
+#template div {
+ margin-right: 190px;
+}
+
+#template textarea {
+ font: small 'Courier New', Courier, monospace;
+ width: 99%;
+}
+
+#templateside {
+ float: right;
+ width: 170px;
+}
+
+#templateside h3, #postcustom p {
+ margin: 0;
+}
+
+#templateside ol, #templateside ul {
+ list-style: none;
+ margin: .5em;
+ padding: 0;
+}
+
+#wphead {
+ background: url(../wp-images/header-shadow.png) #f2f2f2 repeat-x bottom;
+ padding: 1px 5px 11px;
+}
+
+#wphead h1 {
+ font-size: 2.5em;
+ font-weight: normal;
+ letter-spacing: -.05em;
+ margin: 0;
+ font-family: Georgia, "Times New Roman", Times, serif
+}
+
+#wphead h1 span {
+ font-size: .4em;
+ letter-spacing: 0;
+}
+
+#zeitgeist {
+ background: #eee;
+ border: 1px solid #69c;
+ float: right;
+ font-size: 90%;
+ margin-bottom: .5em;
+ margin-left: 1em;
+ margin-top: .5em;
+ padding: 1em;
+ width: 27%;
+}
+
+#zeitgeist h2, fieldset legend a {
+ border-bottom: none;
+}
+
+#zeitgeist h3 {
+ border-bottom: 1px solid #ccc;
+ font-size: 16px;
+ margin: 1em 0 0;
+}
+
+#zeitgeist h3 cite {
+ font-size: 12px;
+ font-style: normal;
+}
+
+#zeitgeist li, #zeitgeist p {
+ margin: .2em 0;
+}
+
+#zeitgeist ul {
+ margin: 0 0 .3em .6em;
+ padding: 0 0 0 .6em;
+}
+
+.active td {
+ background: #BEB;
+}
+.active .name {
+ background: #9C9;
+}
+.alternate.active td {
+ background: #ADA;
+}
+.alternate.active .name {
+ background: #8B8;
+}
+
+/* Box stuff */
+.dbx-clone {
+ position:absolute;
+ visibility:hidden;
+}
+.dbx-clone, .dbx-clone .dbx-handle-cursor {
+ cursor:move !important;
+}
+.dbx-dummy {
+ display:block;
+ width:0;
+ height:0;
+ overflow:hidden;
+}
+.dbx-group, .dbx-box, .dbx-handle {
+ position:relative;
+ display:block;
+}
+
+
+/****************************************************************
+ avoid padding, margins or borders on dbx-box,
+ to reduce visual discrepancies between it and the clone.
+ overall, dbx-box is best left as visually unstyled as possible
+*****************************************************************/
+.dbx-box {
+ margin:0;
+ padding:0;
+ border:none;
+}
+
+/* Can change this */
+#moremeta fieldset, #advancedstuff fieldset {
+ margin-bottom: 1em;
+}
+#moremeta fieldset div {
+ margin-left: 5px;
+}
+#moremeta {
+ line-height: 130%;
+ margin-right: 15px;
+ position: absolute;
+ right: 5%;
+ width: 14.5em;
+ border-left: 1px solid #dfe8f1;
+}
+
+#slugdiv input, #passworddiv input, #authordiv select {
+ margin-top: .5em;
+ width: 95%;
+}
+
+#moremeta h3, #advancedstuff h3 {
+ padding: 3px;
+ font-weight: normal;
+ font-size: 13px;
+}
+
+#advancedstuff div {
+ margin-top: .5em;
+ margin-left: 2%;
+}
+
+/* default box styles */
+.dbx-box {
+}
+
+/* box when toggle is open */
+.dbx-box-open {
+}
+
+/* box when toggle is closed */
+.dbx-box-closed {
+}
+
+/* toggle state of inner content area */
+.dbx-box-open .dbx-content {
+ display:block;
+}
+.dbx-box-closed .dbx-content {
+ display:none;
+}
+
+/* handles */
+.dbx-handle {
+ background-color: #dfe8f1;
+ margin: 0;
+ padding: 0;
+}
+
+/* handle cursors */
+.dbx-handle-cursor {
+ cursor:move;
+}
+
+/* toggle images */
+a.dbx-toggle, a.dbx-toggle:visited {
+ display:block;
+ width: 12px;
+ height: 12px;
+ overflow: hidden;
+ background-image: url( toggle.png );
+ position: absolute;
+ top: .3em;
+ right: .3em;
+ border-bottom: 0;
+ background-position: 0 0;
+}
+
+a.dbx-toggle-open, a.dbx-toggle-open:visited {
+ background-position: 0;
+}
+
+a.dbx-toggle-closed, a.dbx-toggle-closed:visited {
+ background-position: -12px 0;
+}
+
+a.dbx-toggle-hilite-open, a.dbx-toggle-hilite-open:visited {
+ background-position: 0;
+}
+
+a.dbx-toggle-hilite-closed, a.dbx-toggle-hilite-closed:visited {
+ background-position: -12px 0;
+}
+
+/* additional clone styles */
+.dbx-clone {
+ opacity: 0.8;
+ -moz-opacity: 0.8;
+ -khtml-opacity: 0.8;
+ filter: alpha(opacity=80);
+} \ No newline at end of file
diff --git a/wp-inst/wp-admin/wpmu-admin.php b/wp-inst/wp-admin/wpmu-admin.php
new file mode 100644
index 0000000..0ba4b7e
--- /dev/null
+++ b/wp-inst/wp-admin/wpmu-admin.php
@@ -0,0 +1,33 @@
+<?php
+require_once('admin.php');
+
+$title = __('WPMU Admin');
+$parent_file = 'wpmu-admin.php';
+require_once('admin-header.php');
+if( $wpblog != 'main' || $user_level < 10) {
+ die( __('<p>You do not have permission to access this page.</p>') );
+}
+if (isset($_GET['updated'])) {
+ ?><div class="updated"><p><strong><?php _e('Options saved.') ?></strong></p></div><?php
+}
+?>
+<div class="wrap">
+<?php
+
+do_action( "wpmuadminresult", "" );
+
+switch( $_GET[ 'action' ] ) {
+ default:
+ // print some global stats.
+ $stats = get_sitestats();
+ print "<h2>Site Stats</h2>
+ There are currently ".$stats[ 'blogs' ]." <a href='wpmu-blogs.php'>blogs</a> running on this server and ".$stats[ 'users' ]." <a href='wpmu-users.php'>users</a>.</p><br /><br />
+ ";
+
+ do_action( "wpmuadmindefaultpage", "" );
+ break;
+}
+
+?>
+</div>
+<?php include('admin-footer.php'); ?>
diff --git a/wp-inst/wp-admin/wpmu-blogs.php b/wp-inst/wp-admin/wpmu-blogs.php
new file mode 100644
index 0000000..1caa46f
--- /dev/null
+++ b/wp-inst/wp-admin/wpmu-blogs.php
@@ -0,0 +1,304 @@
+<?php
+require_once('admin.php');
+
+$title = __('WPMU Admin');
+$parent_file = 'wpmu-admin.php';
+require_once('admin-header.php');
+if( $wpblog != 'main' || $user_level < 10) {
+ die( __('<p>You do not have permission to access this page.</p>') );
+}
+if (isset($_GET['updated'])) {
+ ?><div class="updated"><p><strong><?php _e('Options saved.') ?></strong></p></div><?php
+}
+print '<div class="wrap">';
+switch( $_GET[ 'action' ] ) {
+ case "editblog":
+ $options_table_name = $wpmuBaseTablePrefix . $_GET[ 'id' ] ."_options";
+ $query = "SELECT *
+ FROM ".$options_table_name."
+ WHERE option_name NOT LIKE 'rss%'";
+ $options = $wpdb->get_results( $query, ARRAY_A );
+ $query = "SELECT *
+ FROM ".$wpdb->blogs."
+ WHERE blog_id = '".$_GET[ 'id' ]."'";
+ $details = $wpdb->get_row( $query, ARRAY_A );
+ $is_archived = get_settings( "is_archived" );
+ if( $is_archived == '' )
+ $is_archived = 'no';
+
+ print "<h2>Edit Blog</h2>";
+ ?>
+ <form name="form1" method="post" action="wpmu-edit.php?action=updateblog">
+ <input type="hidden" name="id" value="<?php echo $_GET[ 'id' ] ?>" />
+ <table><td valign='top'>
+ <table width="100%" border='0' cellspacing="2" cellpadding="5" class="editform">
+ <tr valign="top">
+ <th scope="row">Blogname</th>
+ <td><input name="blog[blogname]" type="text" id="blog_name" value="<?php echo $details[ 'blogname' ] ?>" size="20" />.<?php echo $domain; ?></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row">Registered</th>
+ <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo $details[ 'registered' ] ?>" size="40" /></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row">Last Updated</th>
+ <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo $details[ 'last_updated' ] ?>" size="40" /></td>
+ </tr>
+ <tr valign="top">
+ <th scope="row">Public</th>
+ <td><input type='radio' name='blog[is_public]' value='yes'<?php if( $details[ 'is_public' ] == 'yes' ) echo " checked"?>> Yes&nbsp;&nbsp;
+ <input type='radio' name='blog[is_public]' value='no'<?php if( $details[ 'is_public' ] == 'no' ) echo " checked"?>> No &nbsp;&nbsp;
+ </td>
+ </tr>
+ <tr valign="top">
+ <th scope="row">Archived</th>
+ <td><input type='radio' name='option[is_archived]' value='yes'<?php if( $is_archived == 'yes' ) echo " checked"?>> Yes&nbsp;&nbsp;
+ <input type='radio' name='option[is_archived]' value='no'<?php if( $is_archived == 'no' ) echo " checked"?>> No &nbsp;&nbsp;
+ </td>
+ </tr>
+ <tr><td colspan='2'>
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+ </p>
+ <br />
+ <br />
+ </td></tr>
+ <?php
+ while( list( $key, $val ) = each( $options ) ) {
+ ?>
+ <tr valign="top">
+ <th scope="row"><?php echo ucwords( str_replace( "_", " ", $val[ 'option_name' ] ) ) ?></th>
+ <td><input name="option[<?php echo $val[ 'option_name' ] ?>]" type="text" id="<?php echo $val[ 'option_name' ] ?>" value="<?php echo $val[ 'option_value' ] ?>" size="40" /></td>
+ </tr>
+ <?php
+ }
+ ?>
+ </table>
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />
+ </p>
+ </td>
+ <td valign='top'>
+ <?php
+ $themes = get_themes();
+ $query = "SELECT option_value
+ FROM ".$options_table_name."
+ WHERE option_name = 'allowed_themes'";
+ $blog_allowed_themes = $wpdb->get_var( $query );
+ if( $blog_allowed_themes != false )
+ $blog_allowed_themes = unserialize( $blog_allowed_themes );
+ $allowed_themes = get_site_settings( "allowed_themes" );
+ if( $allowed_themes == false ) {
+ $allowed_themes = array_keys( $themes );
+ }
+ $out = '';
+ while( list( $key, $val ) = each( $themes ) ) {
+ if( isset( $allowed_themes[ $key ] ) == false ) {
+ if( isset( $blog_allowed_themes[ $key ] ) == true ) {
+ $checked = 'checked ';
+ } else {
+ $checked = '';
+ }
+
+ $out .= '
+ <tr valign="top">
+ <th title="'.$val[ "Description" ].'" scope="row">'.$key.'</th>
+ <td><input name="theme['.$key.']" type="checkbox" id="'.$key.'" value="on" '.$checked.'/></td>
+ </tr> ';
+ }
+ }
+ if( $out != '' ) {
+ print "<h3>Blog Themes</h3>";
+ print '<table width="100%" border="0" cellspacing="2" cellpadding="5" class="editform">';
+ print '<tr><th>Theme</th><th>Enable</th></tr>';
+ print $out;
+ print "</table>";
+ }
+ ?>
+ </td>
+ </table>
+ <?php
+ break;
+ default:
+ $query = "SELECT *
+ FROM ".$wpdb->blogs."
+ WHERE site_id = '".$wpdb->siteid."'";
+ if( $_GET[ 's' ] != '' ) {
+ $query = "SELECT *
+ FROM ".$wpdb->blogs.", ".$wpdb->site."
+ WHERE site_id = '".$wpdb->siteid."'
+ AND ".$wpdb->blogs.".site_id = ".$wpdb->site.".id
+ AND blogname like '%".$_GET[ 's' ]."%'";
+ }
+ $blog_list = $wpdb->get_results( $query, ARRAY_A );
+?>
+<h2>Blogs</h2>
+<form name="searchform" action="wpmu-blogs.php" method="get" style="float: left; width: 16em; margin-right: 3em;">
+ <fieldset>
+ <legend><?php _e('Search Blogs&hellip;') ?></legend>
+ <input type='hidden' name='action' value='blogs'>
+ <input type="text" name="s" value="<?php if (isset($_GET[ 's' ])) echo wp_specialchars($_GET[ 's' ], 1); ?>" size="17" />
+ <input type="submit" name="submit" value="<?php _e('Search') ?>" />
+ </fieldset>
+</form>
+
+<br style="clear:both;" />
+
+<?php
+
+// define the columns to display, the syntax is 'internal name' => 'display name'
+$posts_columns = array(
+ 'id' => __('ID'),
+ 'blogname' => __('Blog Name'),
+ 'last_updated' => __('Last Updated'),
+ 'registered' => __('Registered')
+);
+$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_backend'] = '';
+$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 ($blog_list) {
+$bgcolor = '';
+foreach ($blog_list as $blog) {
+$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 $blog[ 'blog_id' ] ?></th>
+ <?php
+ break;
+
+ case 'blogname':
+ ?>
+ <td><?php echo $blog[ 'blogname' ] ?>
+ </td>
+ <?php
+ break;
+
+ case 'last_updated':
+ ?>
+ <td><?php echo $blog[ 'last_updated' ] ?></td>
+ <?php
+ break;
+
+ case 'registered':
+ ?>
+ <td><?php echo $blog[ 'registered' ] ?></td>
+ <?php
+ break;
+
+ case 'control_view':
+ ?>
+ <td><a href="<?php echo get_blogaddress_by_name( $blog[ 'blogname' ] ); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
+ <?php
+ break;
+
+ case 'control_edit':
+ ?>
+ <td><?php echo "<a href='wpmu-blogs.php?action=editblog&amp;id=".$blog[ 'blog_id' ]."' class='edit'>" . __('Edit') . "</a>"; ?></td>
+ <?php
+ break;
+
+ case 'control_backend':
+ ?>
+ <td><?php echo "<a href='".get_blogaddress_by_name( $blog[ 'blogname' ] )."wp-admin/' class='edit'>" . __('Backend') . "</a>"; ?></td>
+ <?php
+ break;
+
+ case 'control_delete':
+ ?>
+ <td><?php echo "<a href='wpmu-edit.php?action=deleteblog&amp;id=".$blog[ 'blog_id' ]."' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this blog?\\n \'OK\' to delete, \'Cancel\' to stop.") ) . "')\">" . __('Delete') . "</a>"; ?></td>
+ <?php
+ break;
+
+ default:
+ ?>
+ <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
+ <?php
+ break;
+ }
+}
+?>
+ </tr>
+<?php
+}
+print "</table>";
+} else {
+?>
+ <tr style='background-color: <?php echo $bgcolor; ?>'>
+ <td colspan="8"><?php _e('No blogs found.') ?></td>
+ </tr>
+<?php
+} // end if ($blogs)
+
+ $themes = get_themes();
+ $allowed_themes = get_site_settings( "allowed_themes" );
+ if( $allowed_themes == false ) {
+ $allowed_themes = array_keys( $themes );
+ }
+
+ print "<br />";
+ print "<form action='wpmu-edit.php?action=updatethemes' method='POST'>";
+ print "<h3>Site Themes</h3>";
+ print '<table border="0" cellspacing="2" cellpadding="5" class="editform">';
+ print "<caption>Disable themes site-wide. You can enable themes on a blog by blog basis.</caption>";
+ print '<tr><th>Theme</th><th>Description</th><th>Disabled</th></tr>';
+ while( list( $key, $val ) = each( $themes ) ) {
+ $enabled = '';
+ $disabled = '';
+ if( isset( $allowed_themes[ $key ] ) == true ) {
+ $enabled = 'checked ';
+ } else {
+ $disabled = 'checked ';
+ }
+ ?>
+ <tr valign="top">
+ <th scope="row"><?php echo $key ?></th>
+ <td><?php echo $val[ 'Description' ] ?></td>
+ <td>
+ <input name="theme[<?php echo $key ?>]" type="radio" id="<?php echo $key ?>" value="disabled" <?php echo $disabled ?>/> Yes
+ &nbsp;&nbsp;&nbsp;
+ <input name="theme[<?php echo $key ?>]" type="radio" id="<?php echo $key ?>" value="enabled" <?php echo $enabled ?>/> No
+ </td>
+ </tr>
+ <?php
+ }
+ ?>
+ </table>
+ <input type='submit' value='Update Themes'>
+ </form>
+ <?php
+break;
+} // end switch( $action )
+?>
+
+<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>
+
+</div>
+<?php include('admin-footer.php'); ?>
diff --git a/wp-inst/wp-admin/wpmu-edit.php b/wp-inst/wp-admin/wpmu-edit.php
new file mode 100644
index 0000000..02beff9
--- /dev/null
+++ b/wp-inst/wp-admin/wpmu-edit.php
@@ -0,0 +1,102 @@
+<?php
+require_once('admin.php');
+
+do_action( "wpmuadminedit", "" );
+
+switch( $_GET[ 'action' ] ) {
+ case "updateblog":
+ $options_table_name = $wpmuBaseTablePrefix . $_POST[ 'id' ] ."_options";
+
+ // themes
+ if( is_array( $_POST[ 'theme' ] ) ) {
+ $allowed_themes = $_POST[ 'theme' ];
+ $_POST[ 'option' ][ 'allowed_themes' ] = $_POST[ 'theme' ];
+ }
+ if( is_array( $_POST[ 'option' ] ) ) {
+ while( list( $key, $val ) = each( $_POST[ 'option' ] ) ) {
+ if ( is_array($val) || is_object($val) )
+ $val = serialize($val);
+
+ $query = "SELECT option_id, option_value
+ FROM ".$options_table_name."
+ WHERE option_name = '".$key."'";
+ $opts = $wpdb->get_row( $query, ARRAY_A );
+ $optvalue = $opts[ 'option_value' ];
+ $option_id = $opts[ 'option_id' ];
+ if( $opts == false ) {
+ $query = "INSERT INTO ".$options_table_name." ( `option_id` , `blog_id` , `option_name` , `option_can_override` , `option_type` , `option_value` , `option_width` , `option_height` , `option_description` , `option_admin_level` , `autoload` )
+ VALUES ( NULL, '0', '".$key."', 'Y', '1', '".$val."', '20', '8', '', '1', 'yes')";
+ $wpdb->query( $query );
+ } elseif( $optvalue != $val ) {
+ $query = "UPDATE ".$options_table_name."
+ SET option_value = '".$val."'
+ WHERE option_name = '".$key."'";
+ $wpdb->query( $query );
+ }
+ }
+ }
+
+ // update blogs table
+ if( $_POST[ 'blog' ][ 'blogname' ] != 'main' ) {
+ $query = "UPDATE ".$wpdb->blogs."
+ SET blogname = '".$_POST[ 'blog' ][ 'blogname' ]."',
+ registered = '".$_POST[ 'blog' ][ 'registered' ]."',
+ last_updated = '".$_POST[ 'blog' ][ 'last_updated' ]."',
+ is_public = '".$_POST[ 'blog' ][ 'is_public' ]."'
+ WHERE blog_id = '".$_POST[ 'id' ]."'";
+ $wpdb->query( $query );
+ }
+ header( "Location: wpmu-blogs.php?action=editblog&id=".$_POST[ 'id' ]."&updated=true" );
+ break;
+ case "deleteblog":
+ $query = "UPDATE ".$wpdb->blogs."
+ SET is_public = 'archived'
+ WHERE blog_id = '".$_GET[ 'id' ]."'";
+ $wpdb->query( $query );
+ break;
+ case "updateuser":
+ unset( $_POST[ 'option' ][ 'ID' ] );
+ if( is_array( $_POST[ 'option' ] ) ) {
+ while( list( $key, $val ) = each( $_POST[ 'option' ] ) ) {
+ $query = "UPDATE ".$wpdb->users."
+ SET ".$key." = '".$val."'
+ WHERE ID = '".$_POST[ 'id' ]."'";
+ $wpdb->query( $query );
+ }
+ }
+ if( is_array( $_POST[ 'meta' ] ) ) {
+ while( list( $key, $val ) = each( $_POST[ 'meta' ] ) ) {
+ $query = "UPDATE ".$wpdb->usermeta."
+ SET meta_key = '".$_POST[ 'metaname' ][ $key ]."',
+ meta_value = '".$val."'
+ WHERE umeta_id = '".$key."'";
+ $wpdb->query( $query );
+ }
+ }
+ if( is_array( $_POST[ 'metadelete' ] ) ) {
+ while( list( $key, $val ) = each( $_POST[ 'metadelete' ] ) ) {
+ $query = "DELETE FROM ".$wpdb->usermeta."
+ WHERE umeta_id = '".$key."'";
+ $wpdb->query( $query );
+ }
+ }
+ header( "Location: wpmu-users.php?action=edit&id=".$_POST[ 'id' ]."&updated=true" );
+ break;
+ case "updatethemes":
+ if( is_array( $_POST[ 'theme' ] ) ) {
+ $themes = array_flip( array_keys( get_themes() ) );
+ reset( $themes );
+ while( list( $key, $val ) = each( $themes ) )
+ {
+ if( $_POST[ 'theme' ][ addslashes( $key ) ] == 'enabled' )
+ $allowed_themes[ $key ] = true;
+ }
+ update_site_settings( 'allowed_themes', $allowed_themes );
+ }
+ header( "Location: wpmu-blogs.php?updated=true" );
+ break;
+ default:
+ header( "Location: wpmu-admin.php" );
+ break;
+}
+?>
diff --git a/wp-inst/wp-admin/wpmu-users.php b/wp-inst/wp-admin/wpmu-users.php
new file mode 100644
index 0000000..c1f7e1a
--- /dev/null
+++ b/wp-inst/wp-admin/wpmu-users.php
@@ -0,0 +1,199 @@
+<?php
+require_once('admin.php');
+
+$title = __('WPMU Admin');
+$parent_file = 'wpmu-admin.php';
+require_once('admin-header.php');
+if( $wpblog != 'main' || $user_level < 10) {
+ die( __('<p>You do not have permission to access this page.</p>') );
+}
+if (isset($_GET['updated'])) {
+ ?><div class="updated"><p><strong><?php _e('Options saved.') ?></strong></p></div><?php
+}
+
+print '<div class="wrap">';
+switch( $_GET[ 'action' ] ) {
+ case "edit":
+ print "<h2>Edit User</h2>";
+ $options_table_name = $wpmuBaseTablePrefix . $_GET[ 'id' ] ."_options";
+ $query = "SELECT *
+ FROM ".$wpdb->users."
+ WHERE ID = '".$_GET[ 'id' ]."'";
+ $userdetails = $wpdb->get_results( $query, ARRAY_A );
+ $query = "SELECT *
+ FROM ".$wpdb->usermeta."
+ WHERE user_id = '".$_GET[ 'id' ]."'";
+ $usermetadetails= $wpdb->get_results( $query, ARRAY_A );
+ ?>
+ <table><td valign='top'>
+ <form name="form1" method="post" action="wpmu-edit.php?action=updateuser">
+ <input type="hidden" name="id" value="<?php echo $_GET[ 'id' ] ?>" />
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <?php
+ unset( $userdetails[0][ 'ID' ] );
+ while( list( $key, $val ) = each( $userdetails[0] ) ) {
+ ?>
+ <tr valign="top">
+ <th width="33%" scope="row"><?php echo ucwords( str_replace( "_", " ", $key ) ) ?></th>
+ <td><input name="option[<?php echo $key ?>]" type="text" id="<?php echo $val ?>" value="<?php echo $val ?>" size="40" /></td>
+ </tr>
+ <?php
+ }
+ ?>
+ </table>
+ </td><td valign='top'>
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
+ <tr><th style='text-align: left'>Name</th><th style='text-align: left'>Value</th><th style='text-align: left'>Delete</th></tr>
+ <?php
+ while( list( $key, $val ) = each( $usermetadetails ) ) {
+ ?>
+ <tr valign="top">
+ <th width="33%" scope="row"><input name="metaname[<?php echo $val[ 'umeta_id' ] ?>]" type="text" id="<?php echo $val[ 'meta_key' ] ?>" value="<?php echo $val[ 'meta_key' ] ?>"></th>
+ <td><input name="meta[<?php echo $val[ 'umeta_id' ] ?>]" type="text" id="<?php echo $val[ 'meta_value' ] ?>" value="<?php echo $val[ 'meta_value' ] ?>" size="40" /></td>
+ <td><input type='checkbox' name='metadelete[<?php echo $val[ 'umeta_id' ] ?>]'></td>
+ </tr>
+ <?php
+ }
+ ?>
+ </table>
+ </td></table>
+
+ <p class="submit">
+ <input type="submit" name="Submit" value="<?php _e('Update User') ?> &raquo;" />
+ </p>
+ <?php
+ break;
+ default:
+ $query = "SELECT *
+ FROM ".$wpdb->users;
+ if( $_GET[ 's' ] != '' ) {
+ $query .= " WHERE user_login LIKE '%".$_GET[ 's' ]."%'";
+ }
+ $user_list = $wpdb->get_results( $query, ARRAY_A );
+?>
+<h2>Users</h2>
+<form name="searchform" action="wpmu-admin.php" method="get" style="float: left; width: 16em; margin-right: 3em;">
+ <fieldset>
+ <legend><?php _e('Search Users&hellip;') ?></legend>
+ <input type='hidden' name='action' value='users'>
+ <input type="text" name="s" value="<?php if (isset($_GET[ 's' ])) echo wp_specialchars($_GET[ 's' ], 1); ?>" size="17" />
+ <input type="submit" name="submit" value="<?php _e('Search') ?>" />
+ </fieldset>
+</form>
+
+<br style="clear:both;" />
+
+<?php
+
+// define the columns to display, the syntax is 'internal name' => 'display name'
+$posts_columns = array(
+ 'ID' => __('ID'),
+ 'user_login' => __('Login'),
+ 'user_email' => __('Email'),
+ 'display_name' => __('Name'),
+ 'user_registered' => __('Registered')
+);
+$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+
+// you can not edit these at the moment
+$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 ($user_list) {
+$bgcolor = '';
+foreach ($user_list as $user) {
+$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 $user[ 'ID' ] ?></th>
+ <?php
+ break;
+
+ case 'user_login':
+ ?>
+ <td><?php echo $user[ 'user_login' ] ?>
+ </td>
+ <?php
+ break;
+
+ case 'display_name':
+ ?>
+ <td><?php echo $user[ 'display_name' ] ?></td>
+ <?php
+ break;
+
+ case 'user_email':
+ ?>
+ <td><?php echo $user[ 'user_email' ] ?></td>
+ <?php
+ break;
+
+ case 'user_registered':
+ ?>
+ <td><?php echo $user[ 'user_registered' ] ?></td>
+ <?php
+ break;
+
+ case 'control_edit':
+ ?>
+ <td><?php echo "<a href='wpmu-users.php?action=edit&amp;id=".$user[ 'ID' ]."' class='edit'>" . __('Edit') . "</a>"; ?></td>
+ <?php
+ break;
+
+ case 'control_delete':
+ ?>
+ <td><?php echo "<a href='wpmu-users.php?action=delete&amp;id=".$user[ 'ID' ]."' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this user?\\n \'OK\' to delete, \'Cancel\' to stop.") ) . "')\">" . __('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 users found.') ?></td>
+ </tr>
+<?php
+} // end if ($users)
+?>
+</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
+}
+
+?>
+</div>
+<?php include('admin-footer.php'); ?>