WordPress.org

Make WordPress Core

Changeset 115


Ignore:
Timestamp:
05/29/2003 02:05:37 PM (19 years ago)
Author:
saxmatt
Message:

Major comments overhaul: decreased # of queries, combined *backs and comments, and made ezSQL mod.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2comments.php

    r60 r115  
    1     <?php // Do not delete these lines
    2     if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) == "b2comments.php")
    3         die ("please, do not load this page directly");
     1<?php // Do not delete these lines
     2    if ('b2comments.php' == basename($HTTP_SERVER_VARS['SCRIPT_FILENAME']))
     3        die ('Please do not load this page directly. Thanks!');
    44    if (($withcomments) or ($c)) {
    55
     
    88        $comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "url" : trim($HTTP_COOKIE_VARS["comment_author_url"]);
    99
    10     $queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content NOT LIKE '%<trackback />%' AND comment_content NOT LIKE '%<pingback />%' ORDER BY comment_date";
    11     $resultc = mysql_query($queryc);
    12     if ($resultc) {
    13     ?>
     10    $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
     11?>
    1412
    1513<!-- you can start editing here -->
    1614
    1715<h2>Comments</h2>
     16<p>The URL to TrackBack this entry is:</p>
     17<p><em><?php trackback_url() ?></em></p>
     18
    1819<ol id="comments">
    19     <?php /* this line is b2's motor, do not delete it */ $wxcvbn_c=0; while($rowc = mysql_fetch_object($resultc)) { $wxcvbn_c++; $commentdata = get_commentdata($rowc->comment_ID); ?>
     20<?php
     21// this line is WordPress' motor, do not delete it.
     22if ($comments) {
     23    foreach ($comments as $comment) {
     24?>
    2025   
    21 <!-- comment -->
    2226<li id="comment-<?php comment_ID() ?>">
    2327<?php comment_text() ?>
    24 <p><cite>By <?php if ($commentdata["comment_author_url"] && $commentdata["comment_author_url"] != 'http://url') {
    25     echo <<<QQQ
    26 <a href="{$commentdata["comment_author_url"]}">{$commentdata["comment_author"]}</a>
    27 QQQ;
    28 } else {
    29     echo $commentdata["comment_author"];
    30 } ?> <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
     28<p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
    3129</li>
    32 <!-- /comment -->
    33     <?php /* end of the loop, don't delete */ } if (!$wxcvbn_c) { ?>
    3430
    35 <!-- this is displayed if there are no comments so far -->
     31<?php } // end for each comment
     32} else { // this is displayed if there are no comments so far
     33?>
    3634    <li>No comments yet.</li>
    37 
    38     <?php /* if you delete this the sky will fall on your head */ } ?>
     35<?php } ?>
    3936</ol>
    4037<h2>Leave a Comment</h2>
    4138<p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <?php echo htmlentities($comment_allowed_tags); ?></p>
    4239
    43 <!-- form to add a comment -->
    4440
    4541<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post" id="commentform">
     
    5349    <p>
    5450      <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
    55        <label for="email">email</label>
     51       <label for="email">Email</label>
    5652    </p>
    5753
    5854    <p>
    5955      <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
    60        <label for="url"><acronym title="Uniform Resource Locator">url</acronym></label>
     56       <label for="url"><acronym title="Uniform Resource Locator">URL</acronym></label>
    6157    </p>
    6258
    6359    <p>
    64       <label for="comment">your comment</label>
     60      <label for="comment">Your Comment</label>
    6561    <br />
    6662      <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
     
    7066      <input name="submit" type="submit" tabindex="5" value="Say it!" />
    7167    </p>
    72 
    7368</form>
    7469
    75 <!-- /form -->
    7670
    7771<div><a href="javascript:history.go(-1)">Go back</a>.</div>
     
    7973<?php // if you delete this the sky will fall on your head
    8074}
    81 } else {
    82     return false;
    83 }
    8475?>
Note: See TracChangeset for help on using the changeset viewer.