Skip to content

Commit

Permalink
Migration to get_settings
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
saxmatt committed Mar 1, 2004
1 parent 9e718af commit b6aa1f6
Show file tree
Hide file tree
Showing 30 changed files with 109 additions and 155 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<head>
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $blog_charset; ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
<meta name="generator" content="WordPress <?php echo $wp_version; ?>" /> <!-- leave this for stats -->

<style type="text/css" media="screen">
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/admin-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function gethelp_link($this_file, $helptag) {
<title>WordPress &rsaquo; <?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?></title>
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<link rel="shortcut icon" href="../wp-images/wp-favicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $blog_charset ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
<?php
if ($redirect==1) {
?>
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/bookmarklet.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress > Bookmarklet</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $blog_charset ?>" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<link rel="shortcut icon" href="../wp-images/wp-favicon.png" />
<script type="text/javascript" language="javascript">
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/edit-form-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="wrap">
<?php

$allowed_users = explode(" ", trim($fileupload_allowedusers));
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));

$submitbutton_text = 'Save';
$toprow_title = 'Editing Post #' . $postdata['ID'];
Expand All @@ -11,7 +11,7 @@
$colspan = 2;
$form_pingback = '<input type="hidden" name="post_pingback" value="0" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
if ($use_trackback) {
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> an <acronym title="Uniform Resource Locator">URL</acronym></a></label>
(Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br />
<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>';
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/edit-form-comment.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$allowed_users = explode(" ", trim($fileupload_allowedusers));
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));

$submitbutton_text = 'Edit this!';
$toprow_title = 'Editing Comment # '.$commentdata['comment_ID'];
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/edit-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
<div class="wrap">
<?php

$allowed_users = explode(" ", trim($fileupload_allowedusers));
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));

$submitbutton_text = 'Blog this!';
$toprow_title = 'New Post';
$form_action = 'post';
$form_extra = '';
if ($use_pingback) {
if (get_settings('use_pingback')) {
$form_pingback = '<input type="checkbox" class="checkbox" name="post_pingback" value="1" ';
if ($post_pingback) $form_pingback .= 'checked="checked" ';
$form_pingback .= 'tabindex="7" id="pingback" /> <label for="pingback"><strong>PingBack</strong> the <acronym title="Uniform Resource Locators">URL</acronym>s in this post</label> <a href="http://wordpress.org/docs/reference/post/#pingback" title="Help on Pingbacks">?</a><br />';
} else {
$form_pingback = '';
}
if ($use_trackback) {
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> an <acronym title="Uniform Resource Locator">URL</acronym></a>:</label> (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br />
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>';
if ('' != $pinged) {
Expand Down
3 changes: 0 additions & 3 deletions wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@
"INSERT INTO $tableoptions (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)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(26,'use_weblogsping', 2, '0', 'set this to true if you want your site to be listed on http://weblogs.com when you add a new post', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(27,'use_blodotgsping', 2, '0', 'set this to true if you want your site to be listed on http://blo.gs when you add a new post', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(28,'blodotgsping_url', 3, 'http://example.com', 'You shouldn\'t need to change this.', 8, 30)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(29,'use_trackback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be trackback\'able or not note: setting it to zero would also disable sending trackbacks', 8, 20)",
"INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(30,'use_pingback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be pingback\'able or not note: setting it to zero would also disable sending pingbacks', 8, 20)",
//file upload
Expand Down Expand Up @@ -700,8 +699,6 @@
if (isset($url)) {
$query= "UPDATE $tableoptions set option_value='$url' where option_id=1"; //siteurl
$q = $wpdb->query($query);
$query= "UPDATE $tableoptions set option_value='$url' where option_id=28"; //blodotgsping_url
$q = $wpdb->query($query);
$query= "UPDATE $tableoptions set option_value='$url/wp-images/smilies' where option_id=17"; //smilies_directory
$q = $wpdb->query($query);
}
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/link-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}
else // try to get the upload file.
{
$uploaddir = $fileupload_realpath;
$uploaddir = get_settings('fileupload_realpath');
$uploadfile = $uploaddir.'/'.$_FILES['userfile']['name'];

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
$self = str_replace('/wp-admin/', '', $PHP_SELF);
if ((substr($self, -20) == substr($item[1], -20) && empty($parent_file)) || ($parent_file && ($item[1] == $parent_file))) $class = ' class="current"';
if ($user_level >= $item[0]) {
if (('upload.php' == $item[1] && $use_fileupload && ($user_level >= $fileupload_minlevel)
&& (in_array($user_login, explode(' ', $allowed_users)) || (trim($fileupload_allowedusers)==""))) || 'upload.php' != $item[1])
if (('upload.php' == $item[1] && get_settings('use_fileupload') && ($user_level >= get_settings('fileupload_minlevel'))
&& (in_array($user_login, explode(' ', $allowed_users)) || (trim(get_settings('fileupload_allowedusers'))==''))) || 'upload.php' != $item[1])
echo "\n\t<li><a href='{$item[1]}'$class>{$item[2]}</a></li>";
}
}
Expand Down
10 changes: 5 additions & 5 deletions wp-admin/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,17 +707,17 @@ function add_magic_quotes($array) {
<p>

<?php
$bookmarklet_height= ($use_trackback) ? 460 : 420;
$bookmarklet_height= (get_settings('use_trackback')) ? 460 : 420;

if ($is_NS4 || $is_gecko) {
?>
<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}void(window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'WordPress bookmarklet','scrollbars=yes,width=600,height=460,left=100,top=150,status=yes'));">Press It
- <?php echo $blogname ?></a>
- <?php echo get_settings('blogname'); ?></a>
<?php
} else if ($is_winIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo get_settings('siteurl') ?>/wp-admin/bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">Press it
- <?php echo $blogname ?></a>
- <?php echo get_settings('blogname'); ?></a>
<script type="text/javascript" language="JavaScript">
<!--
function oneclickbookmarklet(blah) {
Expand All @@ -733,12 +733,12 @@ function oneclickbookmarklet(blah) {
} else if ($is_opera) {
?>
<a href="javascript:void(window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">Press it
- <?php echo $blogname ?></a>
- <?php echo get_settings('blogname'); ?></a>
<?php
} else if ($is_macIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','bookmarklet','scrollbars=yes,width=600,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">Press it
- <?php echo $blogname ?></a>
- <?php echo get_settings('blogname'); ?></a>
<?php
}
?>
Expand Down
16 changes: 8 additions & 8 deletions wp-admin/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ function add_magic_quotes($array) {
case 'IErightclick':


$bookmarklet_tbpb = ($use_trackback) ? '&trackback=1' : '';
$bookmarklet_tbpb .= ($use_pingback) ? '&pingback=1' : '';
$bookmarklet_height= ($use_trackback) ? 590 : 550;
$bookmarklet_tbpb = (get_settings('use_trackback')) ? '&trackback=1' : '';
$bookmarklet_tbpb .= (get_settings('use_pingback')) ? '&pingback=1' : '';
$bookmarklet_height= (get_settings('use_trackback')) ? 590 : 550;

?>

Expand All @@ -191,7 +191,7 @@ function add_magic_quotes($array) {

<p>To have a one-click bookmarklet, just copy and paste this<br />into a new text file:</p>
<?php
$regedit = "REGEDIT4\r\n[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Post To &WP : ".$blogname."]\r\n@=\"javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open('". get_settings('siteurl') ."/wp-admin/bookmarklet.php?text='+escape(Q)+'".$bookmarklet_tbpb."&popupurl='+escape(doc.location.href)+'&popuptitle='+escape(doc.title),'bookmarklet','scrollbars=no,width=480,height=".$bookmarklet_height.",left=100,top=150,status=yes'));btw.focus();\"\r\n\"contexts\"=hex:31\"";
$regedit = "REGEDIT4\r\n[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Post To &WP : ". get_settings('blogname') ."]\r\n@=\"javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open('". get_settings('siteurl') ."/wp-admin/bookmarklet.php?text='+escape(Q)+'".$bookmarklet_tbpb."&popupurl='+escape(doc.location.href)+'&popuptitle='+escape(doc.title),'bookmarklet','scrollbars=no,width=480,height=".$bookmarklet_height.",left=100,top=150,status=yes'));btw.focus();\"\r\n\"contexts\"=hex:31\"";
?>
<pre style="margin: 20px; background-color: #cccccc; border: 1px dashed #333333; padding: 5px; font-size: 12px;"><?php echo $regedit; ?></pre>
<p>Save it as wordpress.reg, and double-click on this file in an Explorer<br />
Expand All @@ -216,9 +216,9 @@ function add_magic_quotes($array) {
include_once('admin-header.php');
$profiledata=get_userdata($user_ID);

$bookmarklet_tbpb = ($use_trackback) ? '&trackback=1' : '';
$bookmarklet_tbpb .= ($use_pingback) ? '&pingback=1' : '';
$bookmarklet_height= ($use_trackback) ? 480 : 440;
$bookmarklet_tbpb = (get_settings('use_trackback')) ? '&trackback=1' : '';
$bookmarklet_tbpb .= (get_settings('use_pingback')) ? '&pingback=1' : '';
$bookmarklet_height= (get_settings('use_trackback')) ? 480 : 440;

?>
<?php if ($updated) { ?>
Expand Down Expand Up @@ -323,7 +323,7 @@ function add_magic_quotes($array) {
function addPanel()
{
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))
window.sidebar.addPanel("WordPress Post: <?php echo $blogname ?>","<?php echo get_settings('siteurl'); ?>/wp-admin/sidebar.php","");
window.sidebar.addPanel("WordPress Post: <?php echo get_settings('blogname'); ?>","<?php echo get_settings('siteurl'); ?>/wp-admin/sidebar.php","");
else
alert('No Sidebar found! You must use Mozilla 0.9.4 or later!');
}
Expand Down
1 change: 0 additions & 1 deletion wp-admin/upgrade-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ function upgrade_072() {
"25" => "INSERT INTO $tableoptions (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)",
"26" => "INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (26,'use_weblogsping', 2, '0', 'set this to true if you want your site to be listed on http://weblogs.com when you add a new post', 8, 20)",
"27" => "INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (27,'use_blodotgsping', 2, '0', 'set this to true if you want your site to be listed on http://blo.gs when you add a new post', 8, 20)",
"28" => "INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (28,'blodotgsping_url', 3, 'http://example.com', 'You shouldn\'t need to change this.', 8, 30)",
"29" => "INSERT INTO $tableoptions (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 $tableoptions (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
Expand Down
24 changes: 12 additions & 12 deletions wp-admin/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
if ($user_level == 0) //Checks to see if user has logged in
die ("Cheatin' uh ?");

if (!$use_fileupload) //Checks if file upload is enabled in the config
if (!get_settings('use_fileupload')) //Checks if file upload is enabled in the config
die ("The admin disabled this function");

$allowed_types = explode(' ', trim($fileupload_allowedtypes));
$allowed_types = explode(' ', trim(get_settings('fileupload_allowedtypes')));

if ($HTTP_POST_VARS['submit']) {
$action = 'upload';
} else {
$action = '';
}

if (!is_writable($fileupload_realpath))
if (!is_writable(get_settings('fileupload_realpath')))
$action = 'not-writable';
?>

Expand All @@ -27,7 +27,7 @@
switch ($action) {
case 'not-writable':
?>
<p>It doesn't look like you can use the file upload feature at this time because the directory you have specified (<code><?php echo $fileupload_realpath; ?></code>) doesn't appear to be writable by WordPress. Check the permissions on the directory and for typos.</p>
<p>It doesn't look like you can use the file upload feature at this time because the directory you have specified (<code><?php echo $get_settings('fileupload_realpath'); ?></code>) doesn't appear to be writable by WordPress. Check the permissions on the directory and for typos.</p>

<?php
break;
Expand All @@ -42,7 +42,7 @@
<p>
<label for="img1">File:</label>
<br />
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $fileupload_maxk * 1024 ?>" />
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_settings('fileupload_maxk') * 1024 ?>" />
<input type="file" name="img1" id="img1" size="35" class="uploadform" /></p>
<p>
<label for="imgdesc">Description:</label><br />
Expand Down Expand Up @@ -96,10 +96,10 @@
}

if (strlen($imgalt)) {
$pathtofile = $fileupload_realpath."/".$imgalt;
$pathtofile = get_settings('fileupload_realpath')."/".$imgalt;
$img1 = $HTTP_POST_VARS['img1'];
} else {
$pathtofile = $fileupload_realpath."/".$img1_name;
$pathtofile = get_settings('fileupload_realpath')."/".$img1_name;
$img1 = $HTTP_POST_FILES['img1']['tmp_name'];
}

Expand All @@ -118,8 +118,8 @@
}

if (file_exists($pathtofile) && !strlen($imgalt)) {
$i = explode(" ",$fileupload_allowedtypes);
$i = implode(", ",array_slice($i, 1, count($i)-2));
$i = explode(' ', get_settings('fileupload_allowedtypes'));
$i = implode(', ',array_slice($i, 1, count($i)-2));
$moved = move_uploaded_file($img1, $pathtofile2);
// if move_uploaded_file() fails, try copy()
if (!$moved) {
Expand All @@ -138,7 +138,7 @@
<p> filename '<?php echo $img1; ?>' moved to '<?php echo "$pathtofile2 - $img2_name"; ?>'</p>
<p>Confirm or rename:</p>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $fileupload_maxk*1024 ?>" />
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_settings('fileupload_maxk') *1024 ?>" />
<input type="hidden" name="img1_type" value="<?php echo $img1_type;?>" />
<input type="hidden" name="img1_name" value="<?php echo $img2_name;?>" />
<input type="hidden" name="img1_size" value="<?php echo $img1_size;?>" />
Expand Down Expand Up @@ -197,9 +197,9 @@


if ( ereg('image/',$img1_type)) {
$piece_of_code = "&lt;img src=&quot;$fileupload_url/$img1_name&quot; alt=&quot;$imgdesc&quot; /&gt;";
$piece_of_code = "&lt;img src=&quot;". get_settings('fileupload_url') ."/$img1_name&quot; alt=&quot;$imgdesc&quot; /&gt;";
} else {
$piece_of_code = "&lt;a href=&quot;$fileupload_url/$img1_name&quot; title=&quot;$imgdesc&quot; /&gt;$imgdesc&lt;/a&gt;";
$piece_of_code = "&lt;a href=&quot;". get_settings('fileupload_url') . "/$img1_name&quot; title=&quot;$imgdesc&quot; /&gt;$imgdesc&lt;/a&gt;";
};

?>
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ function filter($value) {
$stars .= '*';
}

$message = "New user registration on your blog $blogname:\r\n\r\n";
$message = 'New user registration on your blog ' . get_settings('blogname') . ":\r\n\r\n";
$message .= "Login: $user_login\r\n\r\nE-mail: $user_email";

@mail($admin_email, "[$blogname] New User Registration", $message);
@mail($admin_email, '[' . get_settings('blogname') . '] New User Registration', $message);
header('Location: users.php');
break;

Expand Down
Loading

0 comments on commit b6aa1f6

Please sign in to comment.