Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21416
Modified Files:
comment.php
Log Message:
fix comment popup window (hopefully. I hate this window, would someone test if everything works? :-O)
Index: comment.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/comment.php,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- comment.php 19 Nov 2004 11:04:58 -0000 1.52
+++ comment.php 22 Nov 2004 14:34:43 -0000 1.53
@@ -53,8 +53,8 @@
fwrite($fp, '[' . date('d.m.Y H:i') . '] ID: ' . $id . "\n");
fclose($fp);
}
- if (add_trackback($id, $_REQUEST['title'], $_REQUEST['url'],
- $_REQUEST['blog_name'], $_REQUEST['excerpt'])) {
+
+ if (add_trackback($id, $_REQUEST['title'], $_REQUEST['url'], $_REQUEST['blog_name'], $_REQUEST['excerpt'])) {
if ($tb_logging) {
$fp = fopen('trackback2.log', 'a');
fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK SUCCESS' . "\n");
@@ -72,88 +72,53 @@
fclose($fp);
}
} else if ($type == 'pingback') {
- if(add_pingback($_REQUEST['entry_id'], $HTTP_RAW_POST_DATA)) {
+ if (add_pingback($_REQUEST['entry_id'], $HTTP_RAW_POST_DATA)) {
report_pingback_success();
} else {
report_pingback_failure();
}
} else {
$id = (int)(!empty($serendipity['POST']['entry_id']) ? $serendipity['POST']['entry_id'] : $serendipity['GET']['entry_id']);
+ $serendipity['head_subtitle'] = COMMENTS;
+ $serendipity['smarty_file'] = 'commentpopup.tpl';
+ serendipity_smarty_init();
- $html_header = '';
-
- if ($serendipity['XHTML11']) {
- $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_header .= '<html' . ($serendipity['XHTML11'] ? ' xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" dir="ltr"' : '') . '>
-<head>
- <title>' . COMMENTS . '</title>
- <link rel="stylesheet" type="text/css" href="' . $serendipity['serendipityHTTPPath'] . 'serendipity.css.php?mode=comments" />
- <meta http-equiv="Content-Type" content="text/html; charset=' . LANG_CHARSET . '" />
-</head>
-<body class="s9y_wrap" id="serendipity_comment_page">
-';
if (isset($_GET['success']) && $_GET['success'] == 'true') {
- echo $html_header;
- printf(
- COMMENT_ADDED . COMMENT_ADDED_CLICK,
-
- '<a href="' . $_GET['url'] . '&serendipity[entry_id]=' . $_GET['entry_id'] . '">',
- '</a>',
- '<a href="#" onclick="self.close()">',
- '</a>'
+ $serendipity['smarty']->assign(
+ array(
+ 'is_comment_added' => true,
+ 'comment_url' => htmlspecialchars($_GET['url']) . '&serendipity[entry_id]=' . $id,
+ 'comment_string' => explode('%s', COMMENT_ADDED_CLICK)
+ )
);
} else if (!isset($serendipity['POST']['submit'])) {
- echo $html_header;
if ($serendipity['GET']['type'] == 'trackbacks') {
- $tbu = $serendipity['baseURL'] . 'comment.php?type=trackback&entry_id=' . (int)$serendipity['GET']['entry_id'];
- $query = "SELECT title FROM {$serendipity['dbPrefix']}entries WHERE id = '". (int)$serendipity['GET']['entry_id'] ."'";
+ $query = "SELECT title FROM {$serendipity['dbPrefix']}entries WHERE id = '". $id ."'";
$entry = serendipity_db_query($query);
- $entry = serendipity_archiveURL($serendipity['GET']['entry_id'], $entry[0]['title'], 'baseURL');
-?>
- <div class="serendipity_commentsTitle"><?php echo TRACKBACKS; ?></div><br />
- <dl>
- <dt><b><?php echo TRACKBACK_SPECIFIC; ?>:</b><br /></dt>
- <dd><a href="<?php echo $tbu; ?>"><?php echo $tbu; ?></a><br /></dd>
+ $entry = serendipity_archiveURL($id, $entry[0]['title'], 'baseURL');
- <dt><b><?php echo DIRECT_LINK; ?>:</b><br /></dt>
- <dd><a href="<?php echo $entry; ?>"><?php echo $entry; ?></a></dd>
- </dl>
- <?php serendipity_printTrackbacks(serendipity_fetchTrackbacks($id)); ?>
-<?php
+ $serendipity['smarty']->assign(
+ array(
+ 'is_showtrackbacks' => true,
+ 'comment_url' => $serendipity['baseURL'] . 'comment.php?type=trackback&entry_id=' . $id,
+ 'comment_entryurl' => $entry
+ )
+ );
} else {
-?>
- <div class="serendipity_commentsTitle"><?php echo COMMENTS; ?></div>
-<?php
$query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $id . "'";
$ca = serendipity_db_query($query, true);
+ $comment_allowed = serendipity_db_bool($ca['allow_comments']) || !is_array($ca) ? true : false;
+ $serendipity['smarty']->assign(
+ array(
+ 'is_showcomments' => true,
+ 'is_comment_allowed' => $comment_allowed
+ )
+ );
serendipity_printComments(serendipity_fetchComments($id));
- if ($serendipity['POST']['preview']) {
- serendipity_printComments(
- array(
- array(
- 'email' => $serendipity['POST']['email'],
- 'username' => $serendipity['POST']['name'],
- 'body' => $serendipity['POST']['comment'],
- 'url' => $serendipity['POST']['url'],
- 'timestamp' => time()
- )
- )
- );
- }
-
- if (serendipity_db_bool($ca['allow_comments']) || !is_array($ca)) {
-?>
- <div class="serendipity_commentsTitle"><?php echo ADD_COMMENT; ?></div>
-<?php
+ if ($comment_allowed) {
serendipity_displayCommentForm($id, '?', $comments, $serendipity['POST'], true, serendipity_db_bool($ca['moderate_comments']), $ca);
- } elseif (!serendipity_db_bool($ca['allow_comments'])) { ?>
- <div class="serendipity_center serendipity_msg_important"><?php echo COMMENTS_CLOSED; ?></div>
-<?php
}
}
} else {
@@ -164,37 +129,33 @@
$comment['subscribe'] = $serendipity['POST']['subscribe'];
$comment['parent_id'] = $serendipity['POST']['replyTo'];
if (!empty($comment['comment'])) {
- if (serendipity_saveComment($serendipity['POST']['entry_id'], $comment, 'NORMAL')) {
- $sc_url = $serendipity['baseURL'] . 'comment.php?entry_id=' . $serendipity['POST']['entry_id'] . '&success=true&url=' . urlencode($_SERVER['HTTP_REFERER']);
+ if (serendipity_saveComment($id, $comment, 'NORMAL')) {
+ $sc_url = $serendipity['baseURL'] . 'comment.php?entry_id=' . $id . '&success=true&url=' . urlencode($_SERVER['HTTP_REFERER']);
if (serendipity_isResponseClean($sc_url)) {
header('Location: ' . $sc_url);
}
exit;
} else {
- echo $html_header;
- printf(
- COMMENT_NOT_ADDED . COMMENT_NOT_ADDED_CLICK,
-
- '<a href="' . $_SERVER['HTTP_REFERER'] . '">',
- '</a>',
- '<a href="#" onclick="self.close()">',
- '</a>'
+ $serendipity['smarty']->assign(
+ array(
+ 'is_comment_notadded' => true,
+ 'comment_url' => htmlspecialchars($_SERVER['HTTP_REFERER']),
+ 'comment_string' => explode('%s', COMMENT_NOT_ADDED_CLICK)
+ )
);
}
} else {
- echo $html_header;
- printf(
- EMPTY_COMMENT,
-
- '<a href="#" onclick="history.go(-1)">',
- '</a>'
+ $serendipity['smarty']->assign(
+ array(
+ 'is_comment_empty' => true,
+ 'comment_url' => htmlspecialchars($_SERVER['HTTP_REFERER']),
+ 'comment_string' => explode('%s', EMPTY_COMMENT)
+ )
);
}
}
-?>
-</body>
-</html>
-<?php
+
+ $serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath'));
}
/* vim: set sts=4 ts=4 expandtab : */
-?>
+?>
\ No newline at end of file
|