New status fields.

git-svn-id: http://svn.automattic.com/wordpress/trunk@143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-06-01 14:49:30 +00:00
parent 96459f6958
commit 290ac10686
3 changed files with 79 additions and 24 deletions

View File

@ -1,6 +1,10 @@
<div class="wrap">
<?php
function selected($selected, $current) {
if ($selected == $current) echo ' selected="selected"';
}
switch($action) {
case 'post':
$submitbutton_text = 'Blog this!';
@ -48,18 +52,38 @@ switch($action) {
<?php if ($action != "editcomment") {
// this is for everything but comment editing
?>
<table>
<tr>
<td width="210">
<label for="title">Title:</label><br />
<input type="text" name="post_title" size="25" tabindex="1" style="width: 190px;" value="<?php echo $edited_post_title; ?>" id="title" />
<table>
<tr>
<td width="210"> <label for="title">Title:</label> <br /> <input type="text" name="post_title" size="25" tabindex="1" style="width: 190px;" value="<?php echo $edited_post_title; ?>" id="title" />
</td>
<td>
<label for="category">Category :</label>
<br /><?php dropdown_categories(); ?>
<td> <label for="category">Category :</label> <br />
<?php dropdown_categories(); ?>
</td>
</tr>
</table>
<td><label for="post_status">Post Status:</label><br />
<select name="post_status" id="post_status">
<option value="publish"<?php selected($post_status, 'publish'); ?>>Publish</option>
<option value="draft"<?php selected($post_status, 'draft'); ?>>Draft</option>
<option value="private"<?php selected($post_status, 'private'); ?>>Private</option>
</select> </td>
<td><label for="comment_status">Comments:</label><br />
<select name="comment_status" id="comment_status">
<option value="open"<?php selected($comment_status, 'open'); ?>>Open</option>
<option value="closed"<?php selected($comment_status, 'closed'); ?>>Closed</option>
</select> </td>
<td><label for="ping_status">Pings:</label><br />
<select name="ping_status" id="ping_status">
<option value="open"<?php selected($ping_status, 'open'); ?>>Open</option>
<option value="closed"<?php selected($ping_status, 'open'); ?>>Closed</option>
</select></td>
<td><label for="post_password">Post Password:</label>
<br />
<input name="post_password" type="text" id="post_password" value="<?php echo $post_password ?>" /> </td>
</tr>
</table>
<?php
} else {
@ -134,7 +158,8 @@ echo $form_trackback;
if ($user_level > 4) {
touch_time(($action == 'edit'));
}
if ('edit' == $action) echo "
<p><a href='b2edit.php?action=delete&amp;post=$post' onclick=\"return confirm('You are about to delete this post \'".$edited_post_title."\'\\n \'Cancel\' to stop, \'OK\' to delete.')\">Delete this post</a></p>";
?>
</form>
</div>

View File

@ -40,8 +40,8 @@ switch($action) {
case 'post':
$standalone = 1;
require_once('b2header.php');
require_once('b2header.php');
$post_pingback = intval($HTTP_POST_VARS["post_pingback"]);
$content = balanceTags($HTTP_POST_VARS["content"]);
$content = format_to_post($content);
@ -49,6 +49,10 @@ switch($action) {
$excerpt = format_to_post($excerpt);
$post_title = addslashes($HTTP_POST_VARS["post_title"]);
$post_category = intval($HTTP_POST_VARS["post_category"]);
$post_status = $HTTP_POST_VARS['post_status'];
$comment_status = $HTTP_POST_VARS['comment_status'];
$ping_status = $HTTP_POST_VARS['ping_status'];
$post_password = addslashes($HTTP_POST_VARS['post_password']);
if ($user_level == 0)
die ("Cheatin' uh ?");
@ -69,7 +73,7 @@ switch($action) {
$now = date("Y-m-d H:i:s", (time() + ($time_difference * 3600)));
}
$query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_category, post_excerpt) VALUES ('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt')";
$query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_category, post_excerpt, post_status, comment_status, ping_status, post_password) VALUES ('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password')";
$result = $wpdb->query($query);
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
@ -118,9 +122,10 @@ switch($action) {
$standalone = 0;
require_once('b2header.php');
$post = $HTTP_GET_VARS['post'];
if ($user_level > 0) {
$postdata=get_postdata($post) or die('Oops, no post with this ID. <a href="b2edit.php">Go back</a>!');
$postdata = get_postdata($post);
$authordata = get_userdata($postdata["Author_ID"]);
if ($user_level < $authordata[13])
die ('You don&#8217;t have the right to edit <strong>'.$authordata[1].'</strong>&#8217;s posts.');
@ -130,9 +135,12 @@ switch($action) {
$excerpt = $postdata['Excerpt'];
$excerpt = format_to_edit($excerpt);
$edited_post_title = format_to_edit($postdata['Title']);
$post_status = $postdata['post_status'];
$comment_status = $postdata['comment_status'];
$ping_status = $postdata['ping_status'];
$post_password = $postdata['post_password'];
include('b2edit.form.php');
} else {
?>
<p>Since you're a newcomer, you'll have to wait for an admin to raise your level to 1,
@ -164,6 +172,10 @@ switch($action) {
$excerpt = balanceTags($HTTP_POST_VARS["excerpt"]);
$excerpt = format_to_post($excerpt);
$post_title = addslashes($HTTP_POST_VARS["post_title"]);
$post_status = $HTTP_POST_VARS['post_status'];
$comment_status = $HTTP_POST_VARS['comment_status'];
$ping_status = $HTTP_POST_VARS['ping_status'];
$post_password = addslashes($HTTP_POST_VARS['post_password']);
if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
$aa = $HTTP_POST_VARS["aa"];
@ -178,10 +190,10 @@ switch($action) {
$ss = ($ss > 59) ? $ss - 60 : $ss;
$datemodif = ", post_date=\"$aa-$mm-$jj $hh:$mn:$ss\"";
} else {
$datemodif = "";
$datemodif = '';
}
$query = "UPDATE $tableposts SET post_content=\"$content\", post_excerpt=\"$excerpt\", post_title=\"$post_title\", post_category=\"$post_category\"".$datemodif." WHERE ID=$post_ID";
$query = "UPDATE $tableposts SET post_content='$content', post_excerpt='$excerpt', post_title='$post_title', post_category='$post_category'".$datemodif.", post_status='$post_status', comment_status='$comment_status', ping_status='$ping_status', post_password='$post_password' WHERE ID = $post_ID";
$result = $wpdb->query($query);
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
@ -282,7 +294,6 @@ switch($action) {
$newcomment_author = addslashes($newcomment_author);
$newcomment_author_email = addslashes($newcomment_author_email);
$newcomment_author_url = addslashes($newcomment_author_url);
$post_autobr = $HTTP_POST_VARS["post_autobr"];
if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
$aa = $HTTP_POST_VARS["aa"];
@ -317,7 +328,24 @@ switch($action) {
if ($user_level > 0) {
if ((!$withcomments) && (!$c)) {
$action="post";
$action = 'post';
get_currentuserinfo();
$drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID");
if ($drafts) {
?>
<div class="wrap">
<p><strong>Your Drafts:</strong>
<?php
$i = 0;
foreach ($drafts as $draft) {
if (0 != $i) echo ', ';
echo "<a href='b2edit.php?action=edit&amp;post=$draft->ID' title='Edit this draft'>$draft->post_title</a>";
++$i;
}
?>.</p>
</div>
<?php
}
include("b2edit.form.php");
echo "<br /><br />";
@ -325,12 +353,13 @@ switch($action) {
} else {
echo $tabletop;
?>
<div class="wrap">
<p>Since you're a newcomer, you'll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />You can also <a href="mailto:<?php echo $admin_email ?>?subject=b2-promotion">e-mail the admin</a> to ask for a promotion.<br />When you're promoted, just reload this page and you'll be able to blog. :)</p>
</div>
<?php
echo $tablebottom;
echo "<br /><br />";
}
include("b2edit.showposts.php");

View File

@ -233,7 +233,7 @@ if ($i == "ASC")
$posts_per_page = 10;
start_b2(); ?>
<p>
<strong><?php the_time('Y/m/d @ H:i:s'); ?></strong> [ <a href="b2edit.php?p=<?php echo $id ?>&c=1"><?php comments_number('no comment', '1 comment', "% comments") ?></a>
<strong><?php the_time('Y/m/d @ H:i:s'); ?></strong> [ <a href="b2edit.php?p=<?php echo $id ?>&c=1"><?php comments_number('no comments', '1 comment', "% comments") ?></a>
<?php
if (($user_level > $authordata[13]) or ($user_login == $authordata[1])) {
echo " - <a href='b2edit.php?action=edit&amp;post=$id";
@ -242,6 +242,7 @@ if ($i == "ASC")
echo "'>Edit</a>";
echo " - <a href='b2edit.php?action=delete&amp;post=$id' onclick=\"return confirm('You are about to delete this post \'".$row->post_title."\'\\n \'Cancel\' to stop, \'OK\' to delete.')\">Delete</a> ";
}
if ('private' == $post->post_status) echo ' - <strong>Private</strong>';
?>
]
<br />