Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv28627
Modified Files:
serendipity_functions.inc.php
Log Message:
We now show user's url AND email
Emails are subjected to a replacement of @ to [at], to avoid spam
Also fixed direct links to comments and made sure linked URLs are somewhat valid
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- serendipity_functions.inc.php 15 Jun 2003 02:36:38 -0000 1.65
+++ serendipity_functions.inc.php 16 Jun 2003 17:54:21 -0000 1.66
@@ -432,26 +432,53 @@
if (!count($comments)) {
print "<tr><td><i>".NO_COMMENTS."</i></td></tr>";
}
-
+ $x = 0;
foreach ($comments as $comment) {
- $link = empty($comment['url']) ? "mailto:{$comment['email']}" : $comment['url'];
+ $x++;
+ /* Protect submitted mails against spam, by replacing @ with [at */]
+ if ( !empty($comment['email']) ) {
+ $comment['email'] = str_replace('@', '[at]', $comment['email']);
+ }
+
$name = empty($comment['author']) ? 'Anonymous' : $comment['author'];
$type = $comment['type'] == 'trackback' ? TRACKBACK_FROM : POSTED_BY;
?>
<tr>
<td class="serendipity_comment">
- <a name="c<?=$comment['id']?>"></a>
- <?=nl2br(serendipity_markup_text(serendipity_emoticate($comment['body'])))?><br />
+ <a name="c<?=$comment['id']?>"></a>
+ <?=nl2br(serendipity_markup_text(serendipity_emoticate($comment['body'])))?><br />
<div class="serendipity_comment_source">
- <?=$type?> <?=($link ? "<a href=\"$link\">$name</a>" : $name)?> <?=ON?>
- <a href="<?=$PHP_SELF?>#comment<?=$comment['id']?>"><?=date("M d, h:i", $comment['timestamp'])?></a>
- <?php
- if ($_SESSION["serendipityAuthedUser"] === true) {
- ?>
+ <a href="<?=$PHP_SELF?>#c<?=$comment['id']?>" title="Link to comment #<?= $x ?>">#<?= $x ?></a> -
+ <?php
+ echo $type ." ";
+ ?>
+ <?php
+ /* Link to the user's email */
+ if ( !empty($comment['email']) ) {
+ echo "<a href=\"mailto:$comment[email]\" title=\"Send a mail to $name ($comment[email])\">$name</a>";
+ } else {
+ echo $name;
+ }
+ ?>
+ <?php
+ /* Link to the user's website, if the URL is valid */
+ if ( $comment['type'] != 'trackback' && !empty($comment['url']) && $comment['url'] != 'http://' && eregi('^http://', $comment['url']) ) {
+ echo " (<a href=\"$comment[url]\" target=\"_blank\" title=\"$comment[url]\">Link</a>)";
+ }
+ ?>
+ <?php
+ /* Show when the entry was made */
+ echo " ". ON ." ". date("M d, h:i", $comment['timestamp']);
+ ?>
+<?php
+ if ( $_SESSION["serendipityAuthedUser"] === true ) {
+?>
(<a href="<?=$serendipity["baseURL"]?>comment.php?serendipity[delete]=<?=$comment['id']?>&serendipity[entry]=<?=$comment['entry_id']?>&serendipity[type]=comments"><?= DELETE ?></a>)
- <?php
- }
- ?></div>
+<?php
+ }
+?>
+
+ </div>
</td>
</tr>
<?php
|