Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv1001
Modified Files:
comment.php
Log Message:
Code cleanup:
o tabs -> spaces
o indenting, spacing
o double quotes -> single Quotes
o Some echos -> ?>...<?php
o & -> &
o defer global vars (PHP_SELF,...)
o '/>' for single html tags.
This makes the page to tentatively valid XHTML 1.1 code. Valid content-type/xml headers are missing though, yet. :)
Index: comment.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/comment.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- comment.php 25 Jun 2003 22:04:30 -0000 1.10
+++ comment.php 4 Jul 2003 10:36:37 -0000 1.11
@@ -2,16 +2,16 @@
session_start();
include_once('serendipity_config.inc.php');
-if ( isset($serendipity['GET']['delete'],$serendipity['GET']['entry'],$serendipity['GET']['type']) ) {
- serendipity_deleteComment($serendipity['GET']['delete'],$serendipity['GET']['entry'],$serendipity['GET']['type']);
+if ( isset($serendipity['GET']['delete'], $serendipity['GET']['entry'],$serendipity['GET']['type']) ) {
+ serendipity_deleteComment($serendipity['GET']['delete'], $serendipity['GET']['entry'], $serendipity['GET']['type']);
}
/* It's time to finally check if we need to remember the entered information,
the reason we are doing this up here, is because we want to send cookie-headers */
if ( isset($serendipity['POST']['remember']) ) {
- $details['url'] = $serendipity['POST']['url'];
- $details['name'] = $serendipity['POST']['name'];
- $details['email'] = $serendipity['POST']['email'];
+ $details['url'] = $serendipity['POST']['url'];
+ $details['name'] = $serendipity['POST']['name'];
+ $details['email'] = $serendipity['POST']['email'];
$details['remember'] = 'checked';
serendipity_rememberCommentDetails($details);
} elseif ( isset($serendipity['POST']['comment']) ) {
@@ -38,60 +38,77 @@
report_trackback_failure();
}
} else if ($type == 'pingback') {
- if(add_pingback($_POST['entry_id'],$HTTP_RAW_POST_DATA)) {
+ if(add_pingback($_POST['entry_id'], $HTTP_RAW_POST_DATA)) {
report_pingback_success();
- }
- else {
+ } else {
report_pingback_failure();
}
} else {
-$id = $serendipity['GET']['entry_id'];
+ $id = $serendipity['GET']['entry_id'];
?>
<html>
<head>
-<title>Comments</title>
-<link rel="stylesheet" type="text/css" href="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity.css.php?mode=comments">
+ <title>Comments</title>
+ <link rel="stylesheet" type="text/css" href="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity.css.php?mode=comments" />
</head>
<body>
+
<?php
-if (!isset($serendipity['POST']['comment'])) {
- if ($serendipity['GET']['type'] == "trackbacks") {
- echo '<div class="serendipity_commentsTitle">Trackbacks</div><br />';
- echo '<b>Trackback specific URI for this entry:<br />'.str_repeat(" ",7);
- $tbu = $serendipity['baseURL']."comment.php?type=trackback&entry_id=".$serendipity['GET']['entry_id'];
- echo '<a href="'.$tbu.'">'.$tbu.'</a><p />';
- echo '<b>Direct link to this entry:<br />'.str_repeat(" ",7);
- $query = "SELECT title FROM {$serendipity['dbPrefix']}entries WHERE id = ". $serendipity['GET']['entry_id'];
- $entry = serendipity_db_query($query);
- $entry = $serendipity['baseURL']
- . "archives/"
- . $serendipity['GET']['entry_id']
- . "_".serendipity_makeFilename($entry[0]['title']).".html";
- echo '<a href="'. $entry .'">'. $entry .'</a>';
- serendipity_printTrackbacks(serendipity_fetchTrackbacks($id));
- } else {
-?>
-<div class="serendipity_commentsTitle">Comments</div>
-<?php serendipity_printComments(serendipity_fetchComments($id)); ?>
-<div class="serendipity_commentsTitle">Add A Comment</div>
-<?php serendipity_displayCommentForm($id);
- }
-} else {
- $comment['url'] = $serendipity['POST']['url'];
- $comment['comment'] = trim($serendipity['POST']['comment']);
- $comment['name'] = $serendipity['POST']['name'];
- $comment['email'] = $serendipity['POST']['email'];
- if ( !empty($comment['comment']) ) {
- serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL');
-?>
-Your comment was successfully added. Click <a href="<?php echo $PHP_SELF; ?>?serendipity[entry_id]=<?php echo $serendipity['POST']['entry_id']; ?>">here</a> to return to
-the comments, and <a href="#" onClick="self.close()">here</a> to close this window.
-<?php } else { ?>
-Your comment did not contain anything, please <a href="#" onClick="history.go(-1)">go back</a> and try again
-<?php }
-} ?>
+ if (!isset($serendipity['POST']['comment'])) {
+ if ($serendipity['GET']['type'] == 'trackbacks') {
+ $tbu = $serendipity['baseURL'] . 'comment.php?type=trackback&entry_id=' . $serendipity['GET']['entry_id'];
+ $query = 'SELECT title FROM ' . $serendipity['dbPrefix'] . 'entries WHERE id = ' . $serendipity['GET']['entry_id'];
+ $entry = serendipity_db_query($query);
+ $entry = $serendipity['baseURL']
+ . 'archives/'
+ . $serendipity['GET']['entry_id']
+ . '_' . serendipity_makeFilename($entry[0]['title']) . '.html';
+ ?>
+<div id="serendipity_bodyLevel">
+ <div class="serendipity_commentsTitle">Trackbacks</div><br />
+ <dl>
+ <dt><b>Trackback specific URI for this entry:</b><br /></dt>
+ <dd><a href="<?php echo $tbu; ?>"><?php echo $tbu; ?></a><br /></dd>
+
+ <dt><b>Direct link to this entry:</b><br /></dt>
+ <dd><a href="<?php echo $entry; ?>"><?php echo $entry; ?></a>
+ <?php serendipity_printTrackbacks(serendipity_fetchTrackbacks($id)); ?>
+ </dd>
+ </dl>
+<?php
+ } else {
+ ?>
+ <div class="serendipity_commentsTitle">Comments</div>
+<?php
+ serendipity_printComments(serendipity_fetchComments($id)); ?>
+
+
+ <div class="serendipity_commentsTitle">Add A Comment</div>
+<?php
+ serendipity_displayCommentForm($id);
+ }
+ } else {
+ $comment['url'] = $serendipity['POST']['url'];
+ $comment['comment'] = trim($serendipity['POST']['comment']);
+ $comment['name'] = $serendipity['POST']['name'];
+ $comment['email'] = $serendipity['POST']['email'];
+ if ( !empty($comment['comment']) ) {
+ serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL');
+ ?>
+ Your comment was successfully added.
+ Click <a href="<?php echo $_SERVER['PHP_SELF']; ?>?serendipity[entry_id]=<?php echo $serendipity['POST']['entry_id']; ?>">here to return</a> to
+ the comments, and <a href="#" onClick="self.close()">here to close</a> this window.
+<?php
+ } else {
+ ?>
+ Your comment did not contain anything, please <a href="#" onClick="history.go(-1)">go back</a> and try again
+<?php
+ }
+ }
+ ?>
+</div>
</body>
</html>
<?php
}
-?>
+?>
\ No newline at end of file
|