Make WordPress Core

Changeset 139


Ignore:
Timestamp:
06/01/2003 12:10:47 PM (22 years ago)
Author:
saxmatt
Message:

ezSQL updates.

File:
1 edited

Legend:

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

    r109 r139  
    129129        <option value="all">All Categories</option>
    130130        <?php
    131     $query="SELECT * FROM $tablecategories";
    132     $result=mysql_query($query);
     131    $categories = $wpdb->get_results("SELECT * FROM $tablecategories");
    133132    $querycount++;
    134133    $width = ($mode=="sidebar") ? "100%" : "170px";
    135     while($row = mysql_fetch_object($result)) {
    136         echo "<option value=\"".$row->cat_ID."\"";
    137         if ($row->cat_ID == $postdata["Category"])
     134    foreach ($categories as $category) {
     135        echo "<option value=\"".$category->cat_ID."\"";
     136        if ($category->cat_ID == $postdata["Category"])
    138137            echo " selected='selected'";
    139138        echo ">".$row->cat_name."</option>";
     
    231230    include($abspath.'blog.header.php');
    232231
    233     while($row = mysql_fetch_object($result)) {
     232    foreach ($posts as $post) {
    234233        $posts_per_page = 10;
    235234    start_b2(); ?>
    236235            <p>
    237                 <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") ?><?php trackback_number('', ', 1 trackback', ', % trackbacks') ?><?php pingback_number('', ', 1 pingback', ', % pingbacks') ?></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 comment', '1 comment', "% comments") ?></a>
    238237                <?php
    239238                if (($user_level > $authordata[13]) or ($user_login == $authordata[1])) {
    240                 echo " - <a href=\"b2edit.php?action=edit&amp;post=".$postdata["ID"];
     239                echo " - <a href='b2edit.php?action=edit&amp;post=$id";
    241240                if ($m)
    242241                echo "&m=$m";
    243                 echo "\">Edit</a>";
    244                 echo " - <a href=\"b2edit.php?action=delete&amp;post=".$postdata["ID"]."\" onclick=\"return confirm('You are about to delete this post \'".$row->post_title."\'\\n  \'Cancel\' to stop, \'OK\' to delete.')\">Delete</a> ";
     242                echo "'>Edit</a>";
     243                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> ";
    245244                }
    246245                ?>
     
    250249                <?php permalink_anchor(); ?>
    251250                <?php
    252                 if ($safe_mode)
    253                     echo "<xmp>";
    254251                the_content();
    255                 if ($safe_mode)
    256                     echo "</xmp>";
    257252                ?>
    258253            </p>
     
    262257                if (($withcomments) or ($c)) {
    263258
    264                     $queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date";
    265                     $resultc = mysql_query($queryc);
    266                     if ($resultc) {
     259                    $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
     260                    if ($comments) {
    267261                    ?>
    268262
    269                     <h3 id="comments">comments</h3>
    270 
     263                    <h3>Comments</h3>
     264                <ol id="comments">
    271265                    <?php
    272                     while($rowc = mysql_fetch_object($resultc)) {
    273                         $commentdata = get_commentdata($rowc->comment_ID);
     266                    foreach ($comments as $comment) {
     267                        $commentdata = $comment;
    274268                    ?>
    275269               
    276270                    <!-- comment -->
    277                     <p>
     271                    <li>
    278272                    <b><?php comment_author() ?> ( <?php comment_author_email_link() ?> / <?php comment_author_url_link() ?> )</b> (IP: <?php comment_author_IP() ?>)
    279                     <br />
    280273                    <?php comment_text() ?>
    281                     <br />
    282274                    <?php comment_date('Y/m/d') ?> @ <?php comment_time() ?>
    283275                    <?php
    284276                    if (($user_level > $authordata[13]) or ($user_login == $authordata[1])) {
    285                         echo "[ <a href=\"b2edit.php?action=editcomment&comment=".$commentdata["comment_ID"]."\">Edit</a>";
    286                         echo " - <a href=\"b2edit.php?action=deletecomment&p=".$postdata["ID"]."&comment=".$commentdata["comment_ID"]."\">Delete</a> ]";
     277                        echo "[ <a href=\"b2edit.php?action=editcomment&amp;comment=".$commentdata->comment_ID."\">Edit</a>";
     278                        echo " - <a href=\"b2edit.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$commentdata->comment_ID."\">Delete</a> ]";
    287279                    }
    288280                    ?>
    289                     </p>
     281                    </li>
    290282                    <!-- /comment -->
    291283
     
    293285                    <?php //end of the loop, don't delete
    294286                    }
    295 
     287                    echo '</ol>';
    296288                    if ($comment_error)
    297                         echo "<p><font color=\"red\">Error: please fill the required fields (name & comment)</font></p>";
     289                        echo "<p>Error: please fill the required fields (name & comment)</p>";
    298290                    ?>
    299291
Note: See TracChangeset for help on using the changeset viewer.