From c9136856b5cc53b30f6843a6f9cf8933c87dcccf Mon Sep 17 00:00:00 2001 From: saxmatt Date: Sun, 5 Sep 2004 00:24:28 +0000 Subject: [PATCH] Massive options cleanup and another step of cleaning up the upgrade/install. git-svn-id: http://svn.automattic.com/wordpress/trunk@1599 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 1 - wp-admin/edit-form-advanced.php | 13 +- wp-admin/edit-form-comment.php | 2 - wp-admin/edit-form.php | 16 +- wp-admin/edit-page-form.php | 3 - wp-admin/link-categories.php | 8 +- wp-admin/link-import.php | 4 +- wp-admin/link-manager.php | 20 +- wp-admin/menu.php | 5 +- wp-admin/optionhandler.php | 54 ---- wp-admin/options-discussion.php | 6 +- wp-admin/options-general.php | 16 +- wp-admin/options-misc.php | 198 +++++++------ wp-admin/options-permalink.php | 2 - wp-admin/options-reading.php | 105 ++++--- wp-admin/options-writing.php | 12 +- wp-admin/options.php | 71 ++--- wp-admin/post.php | 4 +- wp-admin/profile.php | 9 +- wp-admin/upgrade-functions.php | 306 +++++---------------- wp-atom.php | 3 +- wp-blog-header.php | 1 - wp-commentsrss2.php | 1 - wp-includes/functions-post.php | 49 +--- wp-includes/functions.php | 14 +- wp-includes/links-update-xml.php | 2 +- wp-includes/template-functions-general.php | 2 +- wp-locations.php | 4 +- wp-mail.php | 3 +- wp-rdf.php | 1 - wp-rss.php | 2 +- wp-trackback.php | 3 - 32 files changed, 318 insertions(+), 622 deletions(-) delete mode 100644 wp-admin/optionhandler.php diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index a57116661c..fb3f7b1603 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -13,7 +13,6 @@ get_currentuserinfo(); $posts_per_page = get_settings('posts_per_page'); $what_to_show = get_settings('what_to_show'); -$archive_mode = get_settings('archive_mode'); $date_format = get_settings('date_format'); $time_format = get_settings('time_format'); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 90b4298414..2912094d8c 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -9,8 +9,6 @@ $messages[3] = __('Custom field deleted.');
"; } -if (get_settings('use_pingback')) { - $form_pingback = ''; -} else { - $form_pingback = ''; -} +$form_pingback = ''; $form_prevstatus = ''; -if (get_settings('use_trackback')) { $form_trackback = '

' . __('(Separate multiple URIs with spaces.)') . '

'; if ('' != $pinged) { @@ -37,9 +30,7 @@ if (get_settings('use_trackback')) { } $pings .= ''; } -} else { - $form_trackback = ''; -} + $saveasdraft = ''; if (empty($post_status)) $post_status = 'draft'; diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php index 7d75a32cbf..73cfb51d21 100644 --- a/wp-admin/edit-form-comment.php +++ b/wp-admin/edit-form-comment.php @@ -1,7 +1,5 @@ '; -} else { - $form_pingback = ''; -} +$form_pingback = ''; -if (get_settings('use_trackback')) { - $form_trackback = '

(Separate multiple URIs with spaces.)
'), 'http://wordpress.org/docs/reference/post/#trackback') . +$form_trackback = '

(Separate multiple URIs with spaces.)
'), 'http://wordpress.org/docs/reference/post/#trackback') . '

'; -} else { - $form_trackback = ''; -} + $saveasdraft = ''; diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index f1bbc8922c..e4dcec8590 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -1,9 +1,6 @@
diff --git a/wp-admin/link-categories.php b/wp-admin/link-categories.php index 1e209dc626..6a2972331e 100644 --- a/wp-admin/link-categories.php +++ b/wp-admin/link-categories.php @@ -28,7 +28,7 @@ switch ($action) { $standalone = 1; include_once('admin-header.php'); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); $cat_name = addslashes($_POST['cat_name']); @@ -91,7 +91,7 @@ switch ($action) { if ($cat_id=="1") die(sprintf(__("Can't delete the %s link category: this is the default one"), $cat_name)); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$cat_id'"); @@ -207,7 +207,7 @@ switch ($action) { $standalone = 1; include_once("./admin-header.php"); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); $submit=$_POST["submit"]; @@ -280,7 +280,7 @@ switch ($action) { { $standalone=0; include_once ("./admin-header.php"); - if ($user_level < get_settings('links_minadminlevel')) { + if ($user_level < 5) { die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)")); } ?> diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php index eaadef893d..3f8c88eb76 100644 --- a/wp-admin/link-import.php +++ b/wp-admin/link-import.php @@ -17,7 +17,7 @@ switch ($step) { { $standalone = 0; include_once('admin-header.php'); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin’ uh?")); $opmltype = 'blogrolling'; // default. @@ -74,7 +74,7 @@ switch ($step) { case 1: { $standalone = 0; include_once('admin-header.php'); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); ?>
diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index a6bcadf28c..31cd43a6a3 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -89,7 +89,7 @@ switch ($action) { check_admin_referer(); // check the current user's level first. - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); //for each link id (in $linkcheck[]): if the current user level >= the @@ -102,7 +102,7 @@ switch ($action) { $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 (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed + if (($user_level >= $row->user_level)) { // ok to proceed $ids_to_change[] = $row->link_id; } } @@ -122,7 +122,7 @@ switch ($action) { check_admin_referer(); // check the current user's level first. - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); //for each link id (in $linkcheck[]): toggle the visibility @@ -162,7 +162,7 @@ switch ($action) { check_admin_referer(); // check the current user's level first. - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); //for each link id (in $linkcheck[]) change category to selected value @@ -199,7 +199,7 @@ switch ($action) { $link_rss_uri = $_POST['rss_uri']; $auto_toggle = get_autotoggle($link_category); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); // if we are in an auto toggle category and this one is visible then we @@ -250,7 +250,7 @@ switch ($action) { $link_rss_uri = $_POST['rss_uri']; $auto_toggle = get_autotoggle($link_category); - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); // if we are in an auto toggle category and this one is visible then we @@ -283,7 +283,7 @@ switch ($action) { $link_id = (int) $_GET['link_id']; - if ($user_level < get_settings('links_minadminlevel')) + if ($user_level < 5) die (__("Cheatin' uh ?")); $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id"); @@ -306,7 +306,7 @@ switch ($action) { $standalone=0; $xfn = true; include_once ('admin-header.php'); - if ($user_level < get_settings('links_minadminlevel')) { + if ($user_level < 5) { die(__('You do not have sufficient permissions to edit the links for this blog.')); } $link_id = (int) $_GET['link_id']; @@ -571,7 +571,7 @@ switch ($action) { setcookie('links_show_order_'.$cookiehash, $links_show_order, time()+600); $standalone=0; include_once ("./admin-header.php"); - if ($user_level < get_settings('links_minadminlevel')) { + if ($user_level < 5) { die(__("You do not have sufficient permissions to edit the links for this blog.")); } @@ -721,7 +721,7 @@ LINKS; LINKS; $show_buttons = 1; // default - if (get_settings('links_use_adminlevels') && ($link->user_level > $user_level)) { + if ($link->user_level > $user_level) { $show_buttons = 0; } diff --git a/wp-admin/menu.php b/wp-admin/menu.php index c9ca326cd5..583b87246c 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -36,9 +36,8 @@ $submenu['options-general.php'][5] = array(__('General'), 5, 'options-general.ph $submenu['options-general.php'][10] = array(__('Writing'), 5, 'options-writing.php'); $submenu['options-general.php'][15] = array(__('Reading'), 5, 'options-reading.php'); $submenu['options-general.php'][20] = array(__('Discussion'), 5, 'options-discussion.php'); -$submenu['options-general.php'][25] = array(__('Miscellaneous'), 5, 'options-misc.php'); -$submenu['options-general.php'][30] = array(__('Permalinks'), 5, 'options-permalink.php'); -$submenu['options-general.php'][35] = array(__('Link Manager'), 5, 'options.php?option_group_id=8'); +$submenu['options-general.php'][25] = array(__('Permalinks'), 5, 'options-permalink.php'); +$submenu['options-general.php'][30] = array(__('Miscellaneous'), 5, 'options-misc.php'); $self = preg_replace('|.*/wp-admin/|i', '', $_SERVER['PHP_SELF']); if (!isset($parent_file)) $parent_file = ''; diff --git a/wp-admin/optionhandler.php b/wp-admin/optionhandler.php deleted file mode 100644 index 3f4b88c687..0000000000 --- a/wp-admin/optionhandler.php +++ /dev/null @@ -1,54 +0,0 @@ -option_type) { - case 1: // integer - case 3: // string - case 8: // float - case 6: // range -- treat same as integer for now! - if (($option_result->option_type == 1) || ($option_result->option_type == 1)) { - $width = 6; - } else { - $width = $option_result->option_width; - } - return <<$option_result->option_name$between - -TEXTINPUT; - //break; - - case 2: // boolean - $true_selected = ($option_result->option_value == '1') ? 'selected="selected"' : ''; - $false_selected = ($option_result->option_value == '0') ? 'selected="selected"' : ''; - return <<$option_result->option_name$between - -BOOLSELECT; - //break; - - } // end switch - return $option_result->option_name . $editable; -} // end function get_option_widget - - -function validate_option($option, $name, $val) { - global $wpdb; - $msg = ''; - return $msg; -} // end validate_option - -?> \ No newline at end of file diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index f30a2728d0..0f1ba02dea 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -103,12 +103,12 @@ include('options-head.php');

Common spam words.') ?>

- +

-
- +
+ \ No newline at end of file diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index 406525051b..7ab3e0df6f 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -51,25 +51,25 @@ include('options-head.php'); - + - - + - + - @@ -93,7 +93,7 @@ include('options-head.php'); - @@ -102,12 +102,12 @@ include('options-head.php'); - -
+


+
+

+


+

diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index d79c824a73..8acab29617 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -21,7 +21,7 @@ if (!get_magic_quotes_gpc()) { $_COOKIE = add_magic_quotes($_COOKIE); } -$wpvarstoreset = array('action','standalone', 'option_group_id'); +$wpvarstoreset = array('action','standalone'); for ($i=0; $i
-

-
- - -
- - /> - - - - - - - - - - - - - - - - - - - - -
-
-%s'), ABSPATH . 'wp-content') ?> - -
-
-%s'), get_settings('siteurl') . '/wp-content') ?> -
-
-
- jpg jpeg png gif ') ?>
+ +
+ + /> + + + + + + + + + + + + + + + + + + + + + - -
+
+ %s'), ABSPATH . 'wp-content') ?> + +
+
+ %s'), get_settings('siteurl') . '/wp-content') ?> +
+
+
+ jpg jpeg png gif') ?>
-
-
- - /> - - - - - - - - - - - - - - + } + ?> + + +
- -
- -
+
+
+ + /> + + + + + + + + + + + + + + + + + + +
+
+ http://static.wordpress.org/changes.xml') ?> + +
+ +
+

' ) ?>

+
+
+ + /> + + + + + + + + + + + + + + +
+ +
+ +
+
+

+ +

+

+ +

+ + -
-
-

- -

-

- -

- -
- \ No newline at end of file + \ No newline at end of file diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 5c1eda992f..026819db83 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -30,8 +30,6 @@ if ($home != '' && $home != get_settings('siteurl')) { $home_path = ABSPATH; } -require_once('./optionhandler.php'); - if (isset($_POST['submit'])) { update_option('permalink_structure', $_POST['permalink_structure']); $permalink_structure = $_POST['permalink_structure']; diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index 5cf5418fbd..892448ed24 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -43,59 +43,56 @@ include('options-head.php'); ?>
-

-
- - -
- - - - - - -
-
-
+

+ + + +
+ + + + + + +
+ + +
+
-
- - - - - - - - - - -
-

-
-
- - - - - -
-
- recommended)') ?>
-

- -

-

- -

-
+
+ + + + + + + + + + +
+
+ +
+
+ + + + + +

+ recommended)') ?>
+

+ +

+

+ +

+
- + \ No newline at end of file diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index 814542a69b..953ccb639c 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -63,7 +63,7 @@ include('options-head.php'); - + @@ -92,7 +92,7 @@ endforeach;

Update Services on the wiki. Separate multiple URIs by line breaks.'), 'http://wiki.wordpress.org/index.php/UpdateServices') ?>

- +
@@ -101,19 +101,19 @@ endforeach; - - + diff --git a/wp-admin/options.php b/wp-admin/options.php index 3ff0a8284f..c937d08357 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -22,7 +22,7 @@ if (!get_magic_quotes_gpc()) { $_COOKIE = add_magic_quotes($_COOKIE); } -$wpvarstoreset = array('action','standalone', 'option_group_id'); +$wpvarstoreset = array('action','standalone'); for ($i=0; $i $value) { $option_names[] = "'$key'"; @@ -66,7 +55,6 @@ case 'update': } $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)"); -// die(var_dump($options)); // HACK // Options that if not there have 0 value but need to be something like "closed" @@ -84,18 +72,10 @@ $nonbools = array('default_ping_status', 'default_comment_status'); $new_val = 0; } if( in_array($option->option_name, $nonbools) && $new_val == 0 ) $new_val = 'closed'; - if ($new_val !== $old_val) { - $query = "UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"; - $result = $wpdb->query($query); - //if( in_array($option->option_name, $nonbools)) die('boo'.$query); - if (!$result) { - $dB_errors .= sprintf(__(" SQL error while saving %s. "), $this_name); - } else { - ++$any_changed; - } + if ($new_val !== $old_val) + $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"); } } - } // end foreach unset($cache_settings); // so they will be re-read get_settings('siteurl'); // make it happen now } // end if options @@ -104,22 +84,14 @@ $nonbools = array('default_ping_status', 'default_comment_status'); $message = sprintf(__('%d setting(s) saved... '), $any_changed); } - if ( isset($dB_errors) || isset($validation_message) ) { - if ($message != '') { - $message .= '
'; - } - $message .= $dB_errors . '
' . $validation_message; - } - - $referred = str_replace(array('&updated=true', '?updated=true') , '', $_SERVER['HTTP_REFERER']); - if (strstr($referred, '?')) $goback = $referred . '&updated=true'; - else $goback = str_replace('?updated=true', '', $_SERVER['HTTP_REFERER']) . '?updated=true'; + $referred = str_replace('?updated=true' , '', $_SERVER['HTTP_REFERER']); + $goback = str_replace('?updated=true', '', $_SERVER['HTTP_REFERER']) . '?updated=true'; header('Location: ' . $goback); break; default: $standalone = 0; - include_once("./admin-header.php"); + include_once('./admin-header.php'); if ($user_level <= 6) { die(__("You have do not have sufficient permissions to edit the options for this blog.")); } @@ -128,21 +100,21 @@ default:
-

-
+

All options

+ - -
+ - +
- +
+
get_results("SELECT * FROM $wpdb->options ORDER BY option_name"); -endif; foreach ($options as $option) : - if ('all' == $_GET['option_group_id']) $option->option_type = 3; - echo "\t\n"; + $value = htmlspecialchars($option->option_value); + echo " + + + + +"; endforeach; ?>
" . get_option_widget($option, ($user_level >= $option->option_admin_level), ''); - echo "\t$option->option_description
$option->option_description
@@ -150,17 +122,10 @@ endforeach;
-
+ -
- +?> \ No newline at end of file diff --git a/wp-admin/post.php b/wp-admin/post.php index 74004755d6..4adc264e1b 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -732,7 +732,6 @@ case 'editedcomment': $comment_status = get_settings('default_comment_status'); $ping_status = get_settings('default_ping_status'); $post_pingback = get_settings('default_pingback_flag'); - $default_post_cat = get_settings('default_post_category'); include('edit-page-form.php'); } else { @@ -782,7 +781,6 @@ default: $comment_status = get_settings('default_comment_status'); $ping_status = get_settings('default_ping_status'); $post_pingback = get_settings('default_pingback_flag'); - $default_post_cat = get_settings('default_post_category'); if (get_settings('advanced_edit')) { include('edit-form-advanced.php'); @@ -796,7 +794,7 @@ default:

diff --git a/wp-admin/profile.php b/wp-admin/profile.php index 146ec00af2..01090eb3da 100644 --- a/wp-admin/profile.php +++ b/wp-admin/profile.php @@ -107,10 +107,7 @@ break; case 'IErightclick': - - $bookmarklet_tbpb = (get_settings('use_trackback')) ? '&trackback=1' : ''; - $bookmarklet_tbpb .= (get_settings('use_pingback')) ? '&pingback=1' : ''; - $bookmarklet_height= (get_settings('use_trackback')) ? 590 : 550; + $bookmarklet_height= 550; ?> @@ -146,9 +143,7 @@ default: include_once('admin-header.php'); $profiledata=get_userdata($user_ID); - $bookmarklet_tbpb = (get_settings('use_trackback')) ? '&trackback=1' : ''; - $bookmarklet_tbpb .= (get_settings('use_pingback')) ? '&pingback=1' : ''; - $bookmarklet_height= (get_settings('use_trackback')) ? 480 : 440; + $bookmarklet_height= 440; if (isset($updated)) { ?>

diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index 49ef834ee4..ec62112c7b 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -152,19 +152,81 @@ CREATE TABLE $wpdb->users ( function upgrade_all() { + populate_options(); upgrade_071(); upgrade_072(); upgrade_100(); upgrade_101(); upgrade_110(); upgrade_130(); - - // Options that should not exist - $obs_options = array(''); } +function populate_options() { -// .71 stuff + $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + add_option('siteurl', $guessurl, 'WordPress web address'); + add_option('blogfilename', '', 'Default file for blog'); + add_option('blogname', 'My Weblog', 'Blog title'); + add_option('blogdescription', '', 'Short tagline'); + add_option('new_users_can_blog', 0); + add_option('users_can_register', 1); + 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', 0); + add_option('fileupload_realpath', ABSPATH . 'wp-content'); + add_option('fileupload_url', get_option('siteurl') . '/wp-content'); + 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('use_geo_positions', 0); + add_option('use_default_geourl', 0); + add_option('default_geourl_lat', 0); + add_option('default_geourl_lon', 0); + add_option('weblogs_xml_url', 'http://static.wordpress.org/changes.xml'); + add_option('links_updated_date_format', 'F j, Y g:i a'); + add_option('links_recently_updated_prepend', ''); + add_option('links_recently_updated_append', ''); + add_option('links_recently_updated_time', 120); + add_option('comment_moderation', 0); + add_option('moderation_notify', 1); + add_option('permalink_structure'); + 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); + + // 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', 'rss_language', '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'); + foreach ($unusedoptions as $option) : + delete_option($option); + endforeach; +} function upgrade_071() { global $wpdb; @@ -204,130 +266,6 @@ function upgrade_072() { PRIMARY KEY (option_id, blog_id, option_name) ) "); - - // Guess a site URI -$guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $HTTP_HOST . $REQUEST_URI); - $option_data = array( //base options from b2cofig - "1" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (1,'siteurl', 3, '$guessurl', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\'', 8, 30)", - "2" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)", - "3" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (3,'blogname', 3, 'my weblog', 'blogname is the name of your blog', 8, 20)", - "4" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (4,'blogdescription', 3, 'babblings!', 'blogdescription is the description of your blog', 8, 40)", - //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)", - "7" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)", - "8" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)", - "54" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (54,'admin_email', 3, 'you@example.com', 'Your email (obvious eh?)', 8, 20)", - // general blog setup - "9" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)", - //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (10,'use_preview', 2, '1', 'Do you want to use the \'preview\' function', 8, 20)", - "14" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (14,'use_htmltrans', 2, '1', 'IMPORTANT! set this to false if you are using Chinese, Japanese, Korean, or other double-bytes languages', 8, 20)", - "15" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (15,'use_balanceTags', 2, '1', 'this could help balance your HTML code. if it gives bad results, set it to false', 8, 20)", - "16" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (16,'use_smilies', 2, '1', 'set this to true to enable smiley conversion in posts (note: this makes smiley conversion in ALL posts)', 8, 20)", - "17" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (17,'smilies_directory', 3, 'http://example.com/wp-images/smilies', 'the directory where your smilies are (no trailing slash)', 8, 40)", - "18" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (18,'require_name_email', 2, '0', 'set this to true to require e-mail and name, or false to allow comments without e-mail/name', 8, 20)", - "20" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (20,'comments_notify', 2, '1', 'set this to true to let every author be notified about comments on their posts', 8, 20)", - //rss/rdf feeds - "21" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (21,'posts_per_rss', 1, '10', 'number of last posts to syndicate', 8, 20)", - "22" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (22,'rss_language', 3, 'en', 'the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )', 8, 20)", - "23" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (23,'rss_encoded_html', 2, '0', 'for b2rss.php: allow encoded HTML in <description> tag?', 8, 20)", - "24" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (24,'rss_excerpt_length', 1, '50', 'length (in words) of excerpts in the RSS feed? 0=unlimited note: in b2rss.php, this will be set to 0 if you use encoded HTML', 8, 20)", - "25" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (25,'rss_use_excerpt', 2, '1', 'use the excerpt field for rss feed.', 8, 20)", - "29" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (29,'use_trackback', 2, '1', 'set this to false or true, whether you want to allow your posts to be trackback\'able or not note: setting it to false would also disable sending trackbacks', 8, 20)", - "30" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (30,'use_pingback', 2, '1', 'set this to false or true, whether you want to allow your posts to be pingback\'able or not note: setting it to false would also disable sending pingbacks', 8, 20)", - //file upload - "31" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (31,'use_fileupload', 2, '0', 'set this to false to disable file upload, or true to enable it', 8, 20)", - "32" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (32,'fileupload_realpath', 3, '/home/your/site/wordpress/images', 'enter the real path of the directory where you\'ll upload the pictures \nif you\'re unsure about what your real path is, please ask your host\'s support staff \nnote that the directory must be writable by the webserver (chmod 766) \nnote for windows-servers users: use forwardslashes instead of backslashes', 8, 40)", - "33" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (33,'fileupload_url', 3, 'http://example.com/images', 'enter the URL of that directory (it\'s used to generate the links to the uploded files)', 8, 40)", - "34" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (34,'fileupload_allowedtypes', 3, ' jpg gif png ', 'accepted file types, separated by spaces. example: \'jpg gif png\'', 8, 20)", - "35" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (35,'fileupload_maxk', 1, '96', 'by default, most servers limit the size of uploads to 2048 KB, if you want to set it to a lower value, here it is (you cannot set a higher value than your server limit)', 8, 20)", - "36" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (36,'fileupload_minlevel', 1, '1', 'you may not want all users to upload pictures/files, so you can set a minimum level for this', 8, 20)", - "37" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (37,'fileupload_allowedusers', 3, '', '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'', 8, 30)", - // email settings - "38" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (38,'mailserver_url', 3, 'mail.example.com', 'mailserver settings', 8, 20)", - "39" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (39,'mailserver_login', 3, 'login@example.com', 'mailserver settings', 8, 20)", - "40" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (40,'mailserver_pass', 3, 'password', 'mailserver settings', 8, 20)", - "41" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (41,'mailserver_port', 1, '110', 'mailserver settings', 8, 20)", - "42" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (42,'default_category', 1, '1', 'by default posts will have this category', 8, 20)", - "46" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)", - - // default post stuff - - "55" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(55,'default_post_status', 5, 'publish', 'The default state of each new post', 8, 20)", - "56" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(56,'default_comment_status', 5, 'open', 'The default state of comments for each new post', 8, 20)", - "57" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(57,'default_ping_status', 5, 'open', 'The default ping state for each new post', 8, 20)", - "58" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(58,'default_pingback_flag', 5, '1', 'Whether the \'PingBack the URLs in this post\' checkbox should be checked by default', 8, 20)", - "59" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(59,'default_post_category', 7, '1', 'The default category for each new post', 8, 20)", - "83" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(83,'default_post_edit_rows', 1, '9', 'The number of rows in the edit post form (min 3, max 100)', 8, 5)", - - // original options from options page - "48" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)", - "49" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (49,'what_to_show', 5, 'posts','Posts or days', 4, 20)", - "50" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)", - "51" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)", - "52" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)", - "53" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (53,'time_format', 3, 'g:i a', 'see note for format characters', 4, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (84,'use_geo_positions', 2, '0', 'Turns on the geo url features of WordPress', 8, 20)", - "85" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)", - "86" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - see here', 8, 20)", - "87" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)", - "60" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (60,'links_minadminlevel', 1, '5', 'The minimum admin level to edit links', 8, 10)", - "61" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (61,'links_use_adminlevels', 2, '1', 'set this to false to have all links visible and editable to everyone in the link manager', 8, 20)", - "62" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (62,'links_rating_type', 5, 'image', 'Set this to the type of rating indication you wish to use', 8, 10)", - "63" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (63,'links_rating_char', 3, '*', 'If we are set to \'char\' which char to use.', 8, 5)", - "64" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (64,'links_rating_ignore_zero', 2, '1', 'What do we do with a value of zero? set this to true to output nothing, 0 to output as normal (number/image)', 8, 20)", - "65" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (65,'links_rating_single_image', 2, '1', 'Use the same image for each rating point? (Uses links_rating_image[0])', 8, 20)", - "66" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (66,'links_rating_image0', 3, 'wp-links/links-images/tick.png', 'Image for rating 0 (and for single image)', 8, 40)", - "67" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (67,'links_rating_image1', 3, 'wp-links/links-images/rating-1.gif', 'Image for rating 1', 8, 40)", - "68" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (68,'links_rating_image2', 3, 'wp-links/links-images/rating-2.gif', 'Image for rating 2', 8, 40)", - "69" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (69,'links_rating_image3', 3, 'wp-links/links-images/rating-3.gif', 'Image for rating 3', 8, 40)", - "70" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (70,'links_rating_image4', 3, 'wp-links/links-images/rating-4.gif', 'Image for rating 4', 8, 40)", - "71" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (71,'links_rating_image5', 3, 'wp-links/links-images/rating-5.gif', 'Image for rating 5', 8, 40)", - "72" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (72,'links_rating_image6', 3, 'wp-links/links-images/rating-6.gif', 'Image for rating 6', 8, 40)", - "73" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (73,'links_rating_image7', 3, 'wp-links/links-images/rating-7.gif', 'Image for rating 7', 8, 40)", - "74" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (74,'links_rating_image8', 3, 'wp-links/links-images/rating-8.gif', 'Image for rating 8', 8, 40)", - "75" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (75,'links_rating_image9', 3, 'wp-links/links-images/rating-9.gif', 'Image for rating 9', 8, 40)", - "77" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (77,'weblogs_xml_url', 3, 'http://www.weblogs.com/changes.xml', 'Which file to grab from weblogs.com', 8, 40)", - "78" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (78,'weblogs_cacheminutes', 1, '60', 'cache time in minutes (if it is older than this get a new copy)', 8, 10)", - "79" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (79,'links_updated_date_format', 3, 'd/m/Y h:i', 'The date format for the updated tooltip', 8, 25)", - "80" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (80,'links_recently_updated_prepend', 3, '>>', 'The text to prepend to a recently updated link', 8, 10)", - "81" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (81,'links_recently_updated_append', 3, '<<', 'The text to append to a recently updated link', 8, 20)", - "82" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (82,'links_recently_updated_time', 1, '120', 'The time in minutes to consider a link recently updated', 8, 20)" - ); - - foreach ($option_data as $option_id => $query) { - if(!$wpdb->get_var("SELECT * FROM $wpdb->options WHERE option_id = '$option_id'")) { - $wpdb->query($query); - } - } - - if (file_exists('../wp-links/links.config.php')) { - include('../wp-links/links.config.php'); - - // now update the database with those settings - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_minadminlevel )."' WHERE option_id=60"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_use_adminlevels )."' WHERE option_id=61"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_type )."' WHERE option_id=62"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_char )."' WHERE option_id=63"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_ignore_zero )."' WHERE option_id=64"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_single_image )."' WHERE option_id=65"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image0 )."' WHERE option_id=66"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image1 )."' WHERE option_id=67"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image2 )."' WHERE option_id=68"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image3 )."' WHERE option_id=69"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image4 )."' WHERE option_id=70"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image5 )."' WHERE option_id=71"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image6 )."' WHERE option_id=72"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image7 )."' WHERE option_id=73"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image8 )."' WHERE option_id=74"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image9 )."' WHERE option_id=75"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($weblogs_cache_file )."' WHERE option_id=76"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($weblogs_xml_url )."' WHERE option_id=77"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($weblogs_cacheminutes )."' WHERE option_id=78"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_updated_date_format )."' WHERE option_id=79"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_recently_updated_prepend)."' WHERE option_id=80"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_recently_updated_append )."' WHERE option_id=81"; $q = $wpdb->query($query); - $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_recently_updated_time )."' WHERE option_id=82"; $q = $wpdb->query($query); - // end if links.config.php exists - } - } function upgrade_100() { @@ -349,22 +287,6 @@ function upgrade_100() { add_clean_index($wpdb->categories, 'category_nicename'); add_clean_index($wpdb->comments, 'comment_approved'); - - // Options stuff - if (!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'comment_moderation'")) { - $wpdb->query("INSERT INTO $wpdb->options - (option_id, blog_id, option_name, option_can_override, option_type, option_value, option_width, option_height, option_description, option_admin_level) - VALUES - ('0', '0', 'comment_moderation', 'Y', '5',' none', 20, 8, 'If enabled, comments will only be shown after they have been approved.', 8)"); - } - - if (!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'moderation_notify'")) { - $wpdb->query("INSERT INTO $wpdb->options - (option_id, blog_id, option_name, option_can_override, option_type, option_value, option_width, option_height, option_description, option_admin_level) - VALUES - ('0', '0', 'moderation_notify' , 'Y', '2', '1', 20, 8, 'Set this to true if you want to be notified about new comments that wait for approval', 8)"); - } - // 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) { @@ -383,40 +305,12 @@ function upgrade_100() { $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'"); } } - - if (!$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = 'permalink_structure'")) { // If it's not already there - $wpdb->query("INSERT INTO `$wpdb->options` - (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) - VALUES - ('', '0', 'permalink_structure', 'Y', '3', '', '20', '8', 'How the permalinks for your site are constructed. See permalink options page for necessary mod_rewrite rules and more information.', '8');"); - } - - if (!$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = 'gzipcompression'")) { // If it's not already there - $wpdb->query("INSERT INTO `$wpdb->options` - (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) - VALUES - ('', '0', 'gzipcompression', 'Y', '2', '0', '20', '8', 'Whether your output should be gzipped or not. Enable this if you don’t already have mod_gzip running.', '8');"); -} - if (!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'hack_file'")) { - $wpdb->query("INSERT INTO `$wpdb->options` - ( `option_id` , `blog_id` , `option_name` , `option_can_override` , `option_type` , `option_value` , `option_width` , `option_height` , `option_description` , `option_admin_level` ) - VALUES - ('', '0', 'hack_file', 'Y', '2', '0', '20', '8', 'Set this to true if you plan to use a hacks file. This is a place for you to store code hacks that won’t be overwritten when you upgrade. The file must be in your wordpress root and called my-hacks.php', '8')"); - } - // fix upload users description - $wpdb->query("UPDATE $wpdb->options SET option_description = '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'' WHERE option_id = 37"); - // and file types - $wpdb->query("UPDATE $wpdb->options SET option_description = 'accepted file types, separated by spaces. example: \'jpg gif png\'' WHERE option_id = 34"); - // add link to php date format. this could be to a wordpress.org page in the future - $wpdb->query("UPDATE $wpdb->options SET option_description = 'see help for format characters' WHERE option_id = 52"); - $wpdb->query("UPDATE $wpdb->options SET option_description = 'see help for format characters' WHERE option_id = 53"); + $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/%'"); - $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'comment_allowed_tags'"); - $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'use_preview'"); - $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'search_engine_friendly_urls'"); + // Multiple categories maybe_create_table($wpdb->post2cat, " CREATE TABLE `$wpdb->post2cat` ( @@ -495,7 +389,6 @@ function upgrade_110() { } // Convert passwords to MD5 and update table appropiately - $user_table = $wpdb->get_row("DESCRIBE $wpdb->users user_pass"); if ($user_table->Type != 'varchar(32)') { $wpdb->query("ALTER TABLE $wpdb->users MODIFY user_pass varchar(64) not null"); @@ -508,10 +401,6 @@ function upgrade_110() { } } - // Add blog_charset option - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'blog_charset'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('blog_charset', 3, 'utf-8', 8)"); - } // Get the GMT offset, we'll use that later on $all_options = get_alloptions_110(); @@ -528,12 +417,7 @@ function upgrade_110() { $gmt_offset = -$diff_gmt_weblogger; // Add a gmt_offset option, with value $gmt_offset - if (!get_settings('gmt_offset')) { - if(!$wpdb->get_var("SELECT * FROM $wpdb->options WHERE option_name = 'gmt_offset'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_description, option_admin_level) VALUES ('gmt_offset', 8, $gmt_offset, 'The difference in hours between GMT and your timezone', 8)"); - } - - } + 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' @@ -567,49 +451,9 @@ function upgrade_110() { // First we need to enlarge option_value so it can hold larger values: $wpdb->query("ALTER TABLE `$wpdb->options` CHANGE `option_value` `option_value` TEXT NOT NULL"); - - // Now an option for blog pinging - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'ping_sites'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('ping_sites', 3, 'http://rpc.pingomatic.com/', 8)"); - } - - // Option for using the advanced edit screen by default - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'advanced_edit'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('advanced_edit', 5, '0', 8)"); - } + // Fix for CVS versions $wpdb->query("UPDATE $wpdb->options SET option_type = '5' WHERE option_name = 'advanced_edit'"); - - // Now an option for moderation words - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'moderation_keys'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('moderation_keys', 3, '', 8)"); - } - - // Option for plugins - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'active_plugins'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('active_plugins', 3, '', 8)"); - } - - // Option for max # of links per comment - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'comment_max_links'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('comment_max_links', 3, '5', 8)"); - } - - // Option for different blog URL - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'home'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('home', 3, '', 8)"); - } - - // Option for category base - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'category_base'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '', 8)"); - } - - // 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'); - foreach ($unusedoptions as $option) : - delete_option($option); - endforeach; // Forward-thinking $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL"); @@ -622,13 +466,9 @@ function upgrade_110() { function upgrade_130() { global $wpdb, $table_prefix; - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'default_email_category'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_description, option_admin_level) VALUES('default_email_category', 1, '1', 'by default posts by email will have this category', 8)"); - } - - if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'recently_edited'")) { - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('recently_edited', 3, '', 8)"); - } + add_option('default_email_category', 1, 'Posts by email go to this category'); + add_option('recently_edited'); + add_option('use_linksupdate', 0); maybe_add_column($wpdb->options, 'autoload', "ALTER TABLE `$wpdb->options` ADD `autoload` ENUM( 'yes', 'no' ) NOT NULL ;"); diff --git a/wp-atom.php b/wp-atom.php index 0dc59a5015..858021025a 100644 --- a/wp-atom.php +++ b/wp-atom.php @@ -13,8 +13,7 @@ $more = 1; '; ?> + xmlns:dc="http://purl.org/dc/elements/1.1/"> <?php bloginfo_rss('name') ?> diff --git a/wp-blog-header.php b/wp-blog-header.php index 6a7286df76..56cd6eae32 100644 --- a/wp-blog-header.php +++ b/wp-blog-header.php @@ -150,7 +150,6 @@ if ( !isset($nopaging) ) { $nopaging = ''; } -$archive_mode = get_settings('archive_mode'); $use_gzipcompression = get_settings('gzipcompression'); $more_wpvars = array('posts_per_page', 'what_to_show', 'showposts', 'nopaging'); diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php index 71edab2291..3f56087cd8 100644 --- a/wp-commentsrss2.php +++ b/wp-commentsrss2.php @@ -20,7 +20,6 @@ foreach ($posts as $post) { start_wp(); <?php if (isset($_REQUEST["p"]) || isset($_REQUEST["name"])) { echo "Comments on: "; the_title_rss(); } else { bloginfo_rss("name"); echo " Comments"; } ?> - http://wordpress.org/?v= diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 6d00d87034..b47db8b148 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -217,53 +217,8 @@ function wp_delete_post($postid = 0) { /**** Misc ****/ // get permalink from post ID -function post_permalink($post_ID=0, $mode = 'id') { - global $wpdb; - global $querystring_start, $querystring_equal, $querystring_separator; - - $blog_URL = get_settings('home') .'/'. get_settings('blogfilename'); - - $postdata = get_postdata($post_ID); - - // this will probably change to $blog_ID = $postdata['Blog_ID'] one day. - $blog_ID = 1; - - if (!($postdata===false)) { - - switch(strtolower($mode)) { - case 'title': - $title = preg_replace('/[^a-zA-Z0-9_\.-]/', '_', $postdata['Title']); - break; - case 'id': - default: - $title = "post-$post_ID"; - break; - } - - // this code is blatantly derived from permalink_link() - $archive_mode = get_settings('archive_mode'); - switch($archive_mode) { - case 'daily': - $post_URL = $blog_URL.$querystring_start.'m'.$querystring_equal.substr($postdata['Date'],0,4).substr($postdata['Date'],5,2).substr($postdata['Date'],8,2).'#'.$title; - break; - case 'monthly': - $post_URL = $blog_URL.$querystring_start.'m'.$querystring_equal.substr($postdata['Date'],0,4).substr($postdata['Date'],5,2).'#'.$title; - break; - case 'weekly': - if((!isset($cacheweekly)) || (empty($cacheweekly[$postdata['Date']]))) { - $sql = "SELECT WEEK('".$postdata['Date']."') as wk"; - $row = $wpdb->get_row($sql); - $cacheweekly[$postdata['Date']] = $row->wk; - } - $post_URL = $blog_URL.$querystring_start.'m'.$querystring_equal.substr($postdata['Date'],0,4).$querystring_separator.'w'.$querystring_equal.$cacheweekly[$postdata['Date']].'#'.$title; - break; - case 'postbypost': - $post_URL = $blog_URL.$querystring_start.'p'.$querystring_equal.$post_ID; - break; - } - } - - return $post_URL; +function post_permalink($post_id = 0, $mode = '') { // $mode legacy + return get_permalink($post_id); } // Get the name of a category from its ID diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 9f07f4aabf..e212591b6d 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -313,6 +313,14 @@ function get_settings($setting) { endif; } +function get_option($option) { + return get_settings($option); +} + +function form_option($option) { + echo htmlspecialchars( get_option($option) ); +} + function get_alloptions() { global $wpdb; if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'")) { @@ -351,8 +359,7 @@ function update_option($option_name, $newvalue) { // thx Alex Stapleton, http://alex.vort-x.net/blog/ -function add_option($name, $value = '') { - // Adds an option if it doesn't already exist +function add_option($name, $value = '', $description = '') { global $wpdb; if ( is_array($value) || is_object($value) ) $value = serialize($value); @@ -360,7 +367,8 @@ function add_option($name, $value = '') { if(!get_settings($name)) { $name = $wpdb->escape($name); $value = $wpdb->escape($value); - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value) VALUES ('$name', '$value')"); + $description = $wpdb->escape($description); + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, option_description) VALUES ('$name', '$value', '$description')"); if($wpdb->insert_id) { global $cache_settings; diff --git a/wp-includes/links-update-xml.php b/wp-includes/links-update-xml.php index f1906dad7f..7c9e8ef974 100644 --- a/wp-includes/links-update-xml.php +++ b/wp-includes/links-update-xml.php @@ -58,7 +58,7 @@ function get_weblogs_updatedfile() { if (file_exists($file)) { // is it old? $modtime = filemtime($file); - if ((time() - $modtime) > (get_settings('weblogs_cacheminutes') * 60)) { + if ((time() - $modtime) > (1.5 * 60)) { $update = true; } } else { // doesn't exist diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 0856ce2b49..50ece01ac1 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -222,7 +222,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb; if ('' == $type) { - $type = get_settings('archive_mode'); + $type = 'monthly'; } if ('' != $limit) { diff --git a/wp-locations.php b/wp-locations.php index 241a2df6c5..adaa5c7bff 100644 --- a/wp-locations.php +++ b/wp-locations.php @@ -17,12 +17,12 @@ for ($i = $start; $i >= 0; $i--) { - + - + diff --git a/wp-mail.php b/wp-mail.php index 4a4f1d88c9..0ea3a7b0e6 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -7,8 +7,7 @@ error_reporting(2037); $time_difference = get_settings('gmt_offset') * 3600; -$phone_delim = get_settings('use_phoneemail'); -if (empty($phone_delim)) $phone_delim = '::'; +$phone_delim = '::'; $pop3 = new POP3(); diff --git a/wp-rdf.php b/wp-rdf.php index ac65cbca4a..c886d8e80a 100644 --- a/wp-rdf.php +++ b/wp-rdf.php @@ -25,7 +25,6 @@ add_filter('the_content', 'trim'); <?php bloginfo_rss('name') ?> - hourly diff --git a/wp-rss.php b/wp-rss.php index 4b2380a7b3..a970ba3f8e 100644 --- a/wp-rss.php +++ b/wp-rss.php @@ -30,7 +30,7 @@ if (get_settings('rss_use_excerpt')) { - + diff --git a/wp-trackback.php b/wp-trackback.php index f5d1e75d74..b616f3d5e4 100644 --- a/wp-trackback.php +++ b/wp-trackback.php @@ -28,9 +28,6 @@ if ((strlen(''.$tb_id)) && (empty($_GET['__mode'])) && (strlen(''.$tb_url))) { @header('Content-Type: text/xml; charset=' . get_settings('blog_charset')); - if (!get_settings('use_trackback')) - trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.'); - $pingstatus = $wpdb->get_var("SELECT ping_status FROM $wpdb->posts WHERE ID = $tb_id"); if ('closed' == $pingstatus)