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
This commit is contained in:
saxmatt 2004-09-05 00:24:28 +00:00
parent bc229c60fa
commit c9136856b5
32 changed files with 318 additions and 622 deletions

View File

@ -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');

View File

@ -9,8 +9,6 @@ $messages[3] = __('Custom field deleted.');
<div class="wrap">
<?php
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
if (0 == $post_ID) {
$form_action = 'post';
} else {
@ -18,15 +16,10 @@ if (0 == $post_ID) {
$form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
}
if (get_settings('use_pingback')) {
$form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_pingback" />';
} else {
$form_pingback = '';
}
$form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_pingback" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
if (get_settings('use_trackback')) {
$form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" 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 />
<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>';
if ('' != $pinged) {
@ -37,9 +30,7 @@ if (get_settings('use_trackback')) {
}
$pings .= '</ul>';
}
} else {
$form_trackback = '';
}
$saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
if (empty($post_status)) $post_status = 'draft';

View File

@ -1,7 +1,5 @@
<?php
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
$submitbutton_text = __('Edit Comment &raquo;');
$toprow_title = sprintf(__('Editing Comment # %s'), $commentdata['comment_ID']);
$form_action = 'editedcomment';

View File

@ -1,24 +1,14 @@
<div class="wrap">
<?php
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
$form_action = 'post';
$form_extra = '';
if (get_settings('use_pingback')) {
$form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_pingback" />';
} else {
$form_pingback = '';
}
$form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_pingback" />';
if (get_settings('use_trackback')) {
$form_trackback = '<p><label for="trackback">' . sprintf(__('<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') .
$form_trackback = '<p><label for="trackback">' . sprintf(__('<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>';
} else {
$form_trackback = '';
}
$saveasdraft = '';

View File

@ -1,9 +1,6 @@
<div class="wrap">
<?php
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
$form_action = 'post';
$form_extra = '';
?>

View File

@ -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 <strong>%s</strong> 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. :)"));
}
?>

View File

@ -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&#8217; 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 ?"));
?>
<div class="wrap">

View File

@ -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;
}

View File

@ -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 = '';

View File

@ -1,54 +0,0 @@
<?php
require_once('../wp-config.php');
/**
** get_option_widget()
** parameters:
** option_result - result set containing option_id, option_name, option_type,
** option_value, option_description, option_admin_level
** editable - flag to determine whether the returned widget will be editable
**/
function get_option_widget($option_result, $editable, $between)
{
global $wpdb;
$disabled = $editable ? '' : 'disabled';
switch ($option_result->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 <<<TEXTINPUT
<label for="$option_result->option_name">$option_result->option_name</label>$between
<input type="text" name="$option_result->option_name" size="$width" value="$option_result->option_value" $disabled/>
TEXTINPUT;
//break;
case 2: // boolean
$true_selected = ($option_result->option_value == '1') ? 'selected="selected"' : '';
$false_selected = ($option_result->option_value == '0') ? 'selected="selected"' : '';
return <<<BOOLSELECT
<label for="$option_result->option_name">$option_result->option_name</label>$between
<select name="$option_result->option_name" $disabled>
<option value="1" $true_selected>true</option>
<option value="0" $false_selected>false</option>
</select>
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
?>

View File

@ -103,12 +103,12 @@ include('options-head.php');
<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://wiki.wordpress.org/index.php/SpamWords">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 echo get_settings('moderation_keys'); ?></textarea>
<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>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" value="<?php _e('Update Options') ?>" />
</p>
</form>
</div>
<?php include("admin-footer.php") ?>
</div>
<?php include('./admin-footer.php'); ?>

View File

@ -51,25 +51,25 @@ include('options-head.php');
<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 echo htmlspecialchars(get_settings('blogname')); ?>" size="40" /></td>
<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 echo htmlspecialchars(get_settings('blogdescription')); ?>" size="45" />
<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('WordPress address (URI):') ?></th>
<td><input name="siteurl" type="text" id="siteurl" value="<?php echo get_settings('siteurl'); ?>" size="40" class="code" /></td>
<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Blog address (URI):') ?></th>
<td><input name="home" type="text" id="home" value="<?php echo get_settings('home'); ?>" size="40" class="code" /><br /><?php _e('If you want your blog homepage to be different than the directory you installed WordPress in, enter that address here. '); ?></td>
<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code" /><br /><?php _e('If you want your blog homepage to be different than the directory you installed WordPress in, enter that address here. '); ?></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 echo get_settings('admin_email'); ?>" size="40" class="code" />
<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>
@ -93,7 +93,7 @@ include('options-head.php');
</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 echo get_settings('gmt_offset'); ?>" />
<td><input name="gmt_offset" type="text" id="gmt_offset" size="2" value="<?php form_option('gmt_offset'); ?>" />
<?php _e('hours') ?> </td>
</tr>
<tr>
@ -102,12 +102,12 @@ include('options-head.php');
</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 echo get_settings('date_format'); ?>" /><br />
<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 gmdate(get_settings('date_format'), current_time('timestamp')); ?></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 echo get_settings('time_format'); ?>" /><br />
<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>
</table>

View File

@ -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<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -44,89 +44,117 @@ include('options-head.php');
?>
<div class="wrap">
<h2><?php _e('Miscellaneous 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="'hack_file','use_fileupload','fileupload_realpath','fileupload_url','fileupload_allowedtypes','fileupload_maxk','fileupload_maxk','fileupload_minlevel','use_geo_positions','default_geourl_lat','default_geourl_lon','use_default_geourl'" />
<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 width="33%" valign="top" scope="row"><?php _e('Destination directory:') ?> </th>
<td>
<input name="fileupload_realpath" type="text" id="fileupload_realpath" value="<?php echo get_settings('fileupload_realpath'); ?>" size="50" /><br />
<?php printf(__('Recommended: <code>%s</code>'), ABSPATH . 'wp-content') ?>
</td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('URI of this directory:') ?> </th>
<td>
<input name="fileupload_url" type="text" id="fileupload_url" value="<?php echo get_settings('fileupload_url'); ?>" size="50" /><br />
<?php printf(__('Recommended: <code>%s</code>'), get_settings('siteurl') . '/wp-content') ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Maximum size:') ?> </th>
<td><input name="fileupload_maxk" type="text" id="fileupload_maxk" value="<?php echo get_settings('fileupload_maxk'); ?>" size="4" />
<?php _e('Kilobytes (KB)') ?></td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('Allowed file extensions:') ?></th>
<td><input name="fileupload_allowedtypes" type="text" id="fileupload_allowedtypes" value="<?php echo get_settings('fileupload_allowedtypes'); ?>" size="40" />
<br />
<?php _e('Recommended: <code>jpg jpeg png gif </code>') ?></td>
</tr>
<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 = '';
<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_realpath','fileupload_url','fileupload_allowedtypes','fileupload_maxk','fileupload_maxk','fileupload_minlevel','use_geo_positions','use_linksupdate','weblogs_xml_url','links_updated_date_format','links_recently_updated_prepend','links_recently_updated_append','default_geourl_lat','default_geourl_lon','use_default_geourl'" />
<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 width="33%" valign="top" scope="row"><?php _e('Destination directory:') ?> </th>
<td>
<input name="fileupload_realpath" type="text" id="fileupload_realpath" value="<?php form_option('fileupload_realpath'); ?>" size="50" /><br />
<?php printf(__('Recommended: <code>%s</code>'), ABSPATH . 'wp-content') ?>
</td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('URI of this directory:') ?> </th>
<td>
<input name="fileupload_url" type="text" id="fileupload_url" value="<?php form_option('fileupload_url'); ?>" size="50" /><br />
<?php printf(__('Recommended: <code>%s</code>'), get_settings('siteurl') . '/wp-content') ?>
</td>
</tr>
<tr>
<th scope="row"><?php _e('Maximum size:') ?> </th>
<td><input name="fileupload_maxk" type="text" id="fileupload_maxk" value="<?php form_option('fileupload_maxk'); ?>" size="4" />
<?php _e('Kilobytes (KB)') ?></td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('Allowed file extensions:') ?></th>
<td><input name="fileupload_allowedtypes" type="text" id="fileupload_allowedtypes" value="<?php form_option('fileupload_allowedtypes'); ?>" size="40" />
<br />
<?php _e('Recommended: <code>jpg jpeg png gif</code>') ?></td>
</tr>
<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>
<fieldset class="options">
<legend>
<input name="use_geo_positions" type="checkbox" id="use_geo_positions" value="1" <?php checked('1', get_settings('use_geo_positions')); ?> />
<label for="use_geo_positions"><?php _e('Use Geographic Tracking Features') ?></label></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Default latitude:') ?> </th>
<td>
<input name="default_geourl_lat" type="text" id="default_geourl_lat" value="<?php echo get_settings('default_geourl_lat'); ?>" size="50" />
</td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('Default longitude:') ?> </th>
<td>
<input name="default_geourl_lon" type="text" id="default_geourl_lon" value="<?php echo get_settings('default_geourl_lon'); ?>" size="50" />
</td>
</tr>
<tr>
<th scope="row"> </th>
<td><label>
<input type="checkbox" name="use_default_geourl" value="1" <?php checked('1', get_settings('use_default_geourl')); ?> />
<?php _e('Use default location values if none specified.') ?></label></td>
</tr>
}
?>
</select></td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend>
<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 Link&#8217;s Update Times') ?></label></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Update file:') ?> </th>
<td>
<input name="weblogs_xml_url" type="text" id="weblogs_xml_url" value="<?php form_option('weblogs_xml_url'); ?>" size="50" /><br />
<?php __('Recommended: <code>http://static.wordpress.org/changes.xml</code>') ?>
</td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('Updated link time format:') ?> </th>
<td>
<input name="links_updated_date_format" type="text" id="links_updated_date_format" value="<?php form_option('links_updated_date_format'); ?>" size="50" />
</td>
</tr>
<tr>
<th scope="row"><?php _e('Prepend updated with:') ?> </th>
<td><input name="links_recently_updated_prepend" type="text" id="links_recently_updated_prepend" value="<?php form_option('links_recently_updated_prepend'); ?>" size="50" /></td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('Append updated with:') ?></th>
<td><input name="links_recently_updated_append" type="text" id="links_recently_updated_append" value="<?php form_option('links_recently_updated_append'); ?>" size="50" /></td>
</tr>
</table>
<p><?php printf(__('A link is "recent" if it has been updated in the past %s minutes.'), '<input name="links_recently_updated_time" type="text" id="links_recently_updated_time" size="3" value="' . get_settings('links_recently_updated_time'). '" />' ) ?></p>
</fieldset>
<fieldset class="options">
<legend>
<input name="use_geo_positions" type="checkbox" id="use_geo_positions" value="1" <?php checked('1', get_settings('use_geo_positions')); ?> />
<label for="use_geo_positions"><?php _e('Use Geographic Tracking Features') ?></label></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr>
<th width="33%" valign="top" scope="row"><?php _e('Default latitude:') ?> </th>
<td>
<input name="default_geourl_lat" type="text" id="default_geourl_lat" value="<?php form_option('default_geourl_lat'); ?>" size="50" />
</td>
</tr>
<tr>
<th valign="top" scope="row"><?php _e('Default longitude:') ?> </th>
<td>
<input name="default_geourl_lon" type="text" id="default_geourl_lon" value="<?php form_option('default_geourl_lon'); ?>" size="50" />
</td>
</tr>
<tr>
<th scope="row"> </th>
<td><label>
<input type="checkbox" name="use_default_geourl" value="1" <?php checked('1', get_settings('use_default_geourl')); ?> />
<?php _e('Use default location values if none specified.') ?></label></td>
</tr>
</table>
</fieldset>
<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>
</table>
</fieldset>
<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") ?>
<?php include('./admin-footer.php'); ?>

View File

@ -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'];

View File

@ -43,59 +43,56 @@ include('options-head.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('Front Page') ?></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_page" type="text" id="posts_per_page" value="<?php echo get_settings('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>
<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('Front Page') ?></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_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 echo get_settings('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 echo get_settings('blog_charset'); ?>" size="20" class="code" />
<br />
<?php _e('The character encoding you write your blog in (UTF-8 <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>
<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 <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") ?>
<?php include('./admin-footer.php'); ?>

View File

@ -63,7 +63,7 @@ include('options-head.php');
</tr>
<tr valign="top">
<th width="33%" scope="row"> <?php _e('Size of the writing box:') ?></th>
<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php echo get_settings('default_post_edit_rows'); ?>" size="2" style="width: 1.5em; " />
<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">
@ -92,7 +92,7 @@ endforeach;
<legend><?php _e('Update Services') ?></legend>
<p><?php printf(__('Enter the sites that you would like to notify when you publish a new post. For a list of some recommended sites to ping please see <a href="%s">Update Services</a> on the wiki. Separate multiple URIs by line breaks.'), 'http://wiki.wordpress.org/index.php/UpdateServices') ?></p>
<textarea name="ping_sites" id="ping_sites" style="width: 98%;"><?php echo get_settings('ping_sites'); ?></textarea>
<textarea name="ping_sites" id="ping_sites" style="width: 98%;"><?php form_option('ping_sites'); ?></textarea>
</fieldset>
<fieldset class="options">
<legend><?php _e('Writing by e-mail') ?></legend>
@ -101,19 +101,19 @@ endforeach;
<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 echo get_settings('mailserver_url'); ?>" size="40" />
<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
<label for="port"><?php _e('Port:') ?></label>
<input name="mailserver_port" type="text" id="mailserver_port" value="<?php echo get_settings('mailserver_port'); ?>" size="6" />
<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 echo get_settings('mailserver_login'); ?>" size="40" /></td>
<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 echo get_settings('mailserver_pass'); ?>" size="40" />
<input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" size="40" />
</td>
</tr>
<tr valign="top">

View File

@ -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<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -37,13 +37,6 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
}
if (isset($_GET['option_group_id'])) $option_group_id = (int) $_GET['option_group_id'];
require_once('./optionhandler.php');
$non_was_selected = 0;
if (!isset($_GET['option_group_id'])) {
$option_group_id = 1;
$non_was_selected = 1;
}
switch($action) {
@ -52,10 +45,6 @@ case 'update':
include_once('./admin-header.php');
$any_changed = 0;
// iterate through the list of options in this group
// pull the vars from the post
// validate ranges etc.
// update the values
if (!$_POST['page_options']) {
foreach ($_POST as $key => $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 .= '<br />';
}
$message .= $dB_errors . '<br />' . $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:
<?php include('options-head.php'); ?>
<div class="wrap">
<h2><?php echo $current_desc; ?></h2>
<form name="form" action="<?php echo $this_file; ?>" method="post">
<h2>All options</h2>
<form name="form" action="options.php" method="post">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="option_group_id" value="<?php echo $option_group_id; ?>" />
<table width="90%" cellpadding="2" cellspacing="2" border="0">
<table width="98%">
<?php
//Now display all the options for the selected group.
if ('all' == $_GET['option_group_id']) :
$options = $wpdb->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<tr><td width='10%' valign='top'>" . get_option_widget($option, ($user_level >= $option->option_admin_level), '</td><td width="15%" valign="top" style="border: 1px solid #ccc">');
echo "\t</td><td valign='top' class='helptext'>$option->option_description</td></tr>\n";
$value = htmlspecialchars($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>
@ -150,17 +122,10 @@ endforeach;
</form>
</div>
<div class="wrap">
<?php
if ($current_long_desc != '') {
echo $current_long_desc;
}
?>
</div>
<?php
} // end else a group was selected
break;
} // end switch
include('admin-footer.php');
?>
?>

View File

@ -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:
<p>
<?php
$bookmarklet_height= (get_settings('use_trackback')) ? 460 : 420;
$bookmarklet_height= 420;
if ($is_NS4 || $is_gecko) {
?>

View File

@ -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)) { ?>
<div class="updated">

View File

@ -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', '<em>');
add_option('links_recently_updated_append', '</em>');
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 &lt;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 - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 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, '&gt;&gt;', '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, '&lt;&lt;', '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 <a href=\"options-permalink.php\">permalink options page</a> 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&#8217;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&#8217;t be overwritten when you upgrade. The file must be in your wordpress root and called <code>my-hacks.php</code>', '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 <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 52");
$wpdb->query("UPDATE $wpdb->options SET option_description = 'see <a href=\"http://php.net/date\">help</a> 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 ;");

View File

@ -13,8 +13,7 @@ $more = 1;
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
<feed version="0.3"
xmlns="http://purl.org/atom/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:lang="<?php echo get_settings('rss_language'); ?>">
xmlns:dc="http://purl.org/dc/elements/1.1/">
<title><?php bloginfo_rss('name') ?></title>
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('url') ?>" />
<tagline><?php bloginfo_rss("description") ?></tagline>

View File

@ -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');

View File

@ -20,7 +20,6 @@ foreach ($posts as $post) { start_wp();
<title><?php if (isset($_REQUEST["p"]) || isset($_REQUEST["name"])) { echo "Comments on: "; the_title_rss(); } else { bloginfo_rss("name"); echo " Comments"; } ?></title>
<link><?php (isset($_REQUEST["p"]) || isset($_REQUEST["name"])) ? permalink_single_rss() : bloginfo_rss("url") ?></link>
<description><?php bloginfo_rss("description") ?></description>
<language><?php echo get_settings('rss_language'); ?></language>
<pubDate><?php echo gmdate('r'); ?></pubDate>
<generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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) {

View File

@ -17,12 +17,12 @@ for ($i = $start; $i >= 0; $i--) {
<?php
if (get_settings('rss_use_excerpt')) {
?>
<note><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), get_settings('rss_encoded_html')) ?>
<note><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length')) ?>
</note>
<?php
} else { // use content
?>
<note><?php the_excerpt_rss('', 0, '', get_settings('rss_excerpt_length'), get_settings('rss_encoded_html')) ?></note>
<note><?php the_excerpt_rss('', 0, '', get_settings('rss_excerpt_length')) ?></note>
<?php
} // end else use content
?>

View File

@ -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();

View File

@ -25,7 +25,6 @@ add_filter('the_content', 'trim');
<title><?php bloginfo_rss('name') ?></title>
<link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss('description') ?></description>
<dc:language><?php echo get_settings('rss_language'); ?></dc:language>
<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></dc:date>
<admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
<sy:updatePeriod>hourly</sy:updatePeriod>

View File

@ -30,7 +30,7 @@ if (get_settings('rss_use_excerpt')) {
<?php
} else { // use content
?>
<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), get_settings('rss_encoded_html')) ?></description>
<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length')) ?></description>
<?php
} // end else use content
?>

View File

@ -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)