WordPress.org

Make WordPress Core

Changeset 143


Ignore:
Timestamp:
06/01/2003 02:49:30 PM (19 years ago)
Author:
saxmatt
Message:

New status fields.

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/b2edit.form.php

    r44 r143  
    11<div class="wrap">
    22<?php
     3
     4function selected($selected, $current) {
     5    if ($selected == $current) echo ' selected="selected"';
     6}
    37
    48switch($action) {
     
    4953  // this is for everything but comment editing
    5054?>
    51       <table>
    52         <tr>
    53         <td width="210">
    54           <label for="title">Title:</label><br />
    55           <input type="text" name="post_title" size="25" tabindex="1" style="width: 190px;" value="<?php echo $edited_post_title; ?>" id="title" />
     55     
     56<table>
     57      <tr>
     58        <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" />
    5659        </td>
    57         <td>
    58           <label for="category">Category :</label>
    59               <br /><?php dropdown_categories(); ?>
     60        <td> <label for="category">Category :</label> <br />
     61          <?php dropdown_categories(); ?>
    6062        </td>
    61         </tr>
    62       </table>
     63        <td><label for="post_status">Post Status:</label><br />
     64         
     65      <select name="post_status" id="post_status">
     66        <option value="publish"<?php selected($post_status, 'publish'); ?>>Publish</option>
     67            <option value="draft"<?php selected($post_status, 'draft'); ?>>Draft</option>
     68            <option value="private"<?php selected($post_status, 'private'); ?>>Private</option>
     69          </select> </td>
     70        <td><label for="comment_status">Comments:</label><br />
     71         
     72      <select name="comment_status" id="comment_status">
     73        <option value="open"<?php selected($comment_status, 'open'); ?>>Open</option>
     74            <option value="closed"<?php selected($comment_status, 'closed'); ?>>Closed</option>
     75          </select> </td>
     76        <td><label for="ping_status">Pings:</label><br />
     77         
     78      <select name="ping_status" id="ping_status">
     79        <option value="open"<?php selected($ping_status, 'open'); ?>>Open</option>
     80            <option value="closed"<?php selected($ping_status, 'open'); ?>>Closed</option>
     81          </select></td>
     82        <td><label for="post_password">Post Password:</label>
     83      <br />
     84          <input name="post_password" type="text" id="post_password" value="<?php echo $post_password ?>" /> </td>
     85      </tr>
     86    </table>
    6387  <?php
    6488
     
    135159    touch_time(($action == 'edit'));
    136160}
     161if ('edit' == $action) echo "
     162<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>";
    137163?>
    138 
    139164</form>
    140165</div>
  • trunk/wp-admin/b2edit.php

    r136 r143  
    4141
    4242        $standalone = 1;
    43         require_once('b2header.php');
    44 
     43        require_once('b2header.php');   
     44       
    4545        $post_pingback = intval($HTTP_POST_VARS["post_pingback"]);
    4646        $content = balanceTags($HTTP_POST_VARS["content"]);
     
    5050        $post_title = addslashes($HTTP_POST_VARS["post_title"]);
    5151        $post_category = intval($HTTP_POST_VARS["post_category"]);
     52        $post_status = $HTTP_POST_VARS['post_status'];
     53        $comment_status = $HTTP_POST_VARS['comment_status'];
     54        $ping_status = $HTTP_POST_VARS['ping_status'];
     55        $post_password = addslashes($HTTP_POST_VARS['post_password']);
    5256
    5357        if ($user_level == 0)
     
    7074        }
    7175
    72         $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')";
     76        $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')";
    7377        $result = $wpdb->query($query);
    7478
     
    119123        $standalone = 0;
    120124        require_once('b2header.php');
     125
    121126        $post = $HTTP_GET_VARS['post'];
    122127        if ($user_level > 0) {
    123             $postdata=get_postdata($post) or die('Oops, no post with this ID. <a href="b2edit.php">Go back</a>!');
     128            $postdata = get_postdata($post);
    124129            $authordata = get_userdata($postdata["Author_ID"]);
    125130            if ($user_level < $authordata[13])
     
    131136            $excerpt = format_to_edit($excerpt);
    132137            $edited_post_title = format_to_edit($postdata['Title']);
     138            $post_status = $postdata['post_status'];
     139            $comment_status = $postdata['comment_status'];
     140            $ping_status = $postdata['ping_status'];
     141            $post_password = $postdata['post_password'];
    133142
    134143            include('b2edit.form.php');
    135 
    136144        } else {
    137145?>
     
    165173        $excerpt = format_to_post($excerpt);
    166174        $post_title = addslashes($HTTP_POST_VARS["post_title"]);
     175        $post_status = $HTTP_POST_VARS['post_status'];
     176        $comment_status = $HTTP_POST_VARS['comment_status'];
     177        $ping_status = $HTTP_POST_VARS['ping_status'];
     178        $post_password = addslashes($HTTP_POST_VARS['post_password']);
    167179
    168180        if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
     
    179191            $datemodif = ", post_date=\"$aa-$mm-$jj $hh:$mn:$ss\"";
    180192        } else {
    181             $datemodif = "";
    182         }
    183 
    184         $query = "UPDATE $tableposts SET post_content=\"$content\", post_excerpt=\"$excerpt\", post_title=\"$post_title\", post_category=\"$post_category\"".$datemodif." WHERE ID=$post_ID";
     193            $datemodif = '';
     194        }
     195
     196        $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";
    185197        $result = $wpdb->query($query);
    186198
     
    283295        $newcomment_author_email = addslashes($newcomment_author_email);
    284296        $newcomment_author_url = addslashes($newcomment_author_url);
    285         $post_autobr = $HTTP_POST_VARS["post_autobr"];
    286297
    287298        if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
     
    318329            if ((!$withcomments) && (!$c)) {
    319330
    320                 $action="post";
     331                $action = 'post';
     332                get_currentuserinfo();
     333                $drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID");
     334                if ($drafts) {
     335                    ?>
     336                    <div class="wrap">
     337                    <p><strong>Your Drafts:</strong>
     338                    <?php
     339                    $i = 0;
     340                    foreach ($drafts as $draft) {
     341                        if (0 != $i) echo ', ';
     342                        echo "<a href='b2edit.php?action=edit&amp;post=$draft->ID' title='Edit this draft'>$draft->post_title</a>";
     343                        ++$i;
     344                        }
     345                    ?>.</p>
     346                    </div>
     347                    <?php
     348                }
    321349                include("b2edit.form.php");
    322350                echo "<br /><br />";
     
    326354        } else {
    327355
    328             echo $tabletop;
     356
    329357?>
     358<div class="wrap">
    330359            <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>
     360</div>
    331361<?php
    332             echo $tablebottom;
    333             echo "<br /><br />";
     362
    334363        }
    335364
  • trunk/wp-admin/b2edit.showposts.php

    r139 r143  
    234234    start_b2(); ?>
    235235            <p>
    236                 <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>
     236                <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>
    237237                <?php
    238238                if (($user_level > $authordata[13]) or ($user_login == $authordata[1])) {
     
    243243                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> ";
    244244                }
     245                if ('private' == $post->post_status) echo ' - <strong>Private</strong>';
    245246                ?>
    246247                ]
Note: See TracChangeset for help on using the changeset viewer.