Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28285
Modified Files:
NEWS comment.php
Log Message:
Redirection after entering a comment
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- NEWS 31 Jan 2004 17:07:07 -0000 1.56
+++ NEWS 2 Feb 2004 08:39:40 -0000 1.57
@@ -2,7 +2,7 @@
Version 0.5.1 ()
------------------------------------
-
+ * Redirection after a comment has been added to prevent users refreshing a page and double-submitting. (garvinhicking)
Version 0.5 (January 31, 2004)
------------------------------------
Index: comment.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/comment.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- comment.php 23 Jan 2004 05:50:19 -0000 1.27
+++ comment.php 2 Feb 2004 08:39:40 -0000 1.28
@@ -52,24 +52,32 @@
}
} else {
$id = $serendipity['GET']['entry_id'];
+ $html_header = '';
if ($serendipity['XHTML11']) {
- echo '<?xml version="1.0" encoding="iso-8859-1" ?>' . "\n";
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<?php
+ $html_header .= '<?xml version="1.0" encoding="iso-8859-1" ?>' . "\n";
+ $html_header .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' . "\n";
}
-?>
-<html<?php echo ($serendipity['XHTML11'] ? ' xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" dir="ltr"' : ''); ?>>
+
+ $html_header .= '<html' . ($serendipity['XHTML11'] ? ' xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" dir="ltr"' : '') . '>
<head>
- <title><?php echo 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="' . $serendipity['serendipityHTTPPath'] . 'serendipity.css.php?mode=comments" />
</head>
<body>
+';
+ if (isset($_GET['success']) && $_GET['success'] == 'true') {
+ echo $html_header;
+ printf(
+ COMMENT_ADDED,
-<?php
- if (!isset($serendipity['POST']['comment'])) {
+ '<a href="' . $_GET['url'] . '">',
+ '</a>',
+ '<a href="#" onclick="self.close()">',
+ '</a>'
+ );
+ } else if (!isset($serendipity['POST']['comment'])) {
+ echo $html_header;
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'];
@@ -115,15 +123,10 @@
$comment['subscribe'] = $serendipity['POST']['subscribe'];
if ( !empty($comment['comment']) ) {
if (serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL')) {
- printf(
- COMMENT_ADDED,
-
- '<a href="' . $_SERVER['HTTP_REFERER'] . '">',
- '</a>',
- '<a href="#" onclick="self.close()">',
- '</a>'
- );
+ header('Location: ' . $serendipity['baseURL'] . 'comment.php?success=true&url=' . urlencode($_SERVER['HTTP_REFERER']));
+ exit;
} else {
+ echo $html_header;
printf(
COMMENT_NOT_ADDED,
@@ -134,6 +137,7 @@
);
}
} else {
+ echo $html_header;
printf(
EMPTY_COMMENT,
|