Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv14361
Modified Files:
serendipity_functions.inc.php serendipity_lang_en.inc.php
Log Message:
We now send diffirent emails if the comment is a trackback.
We also strip HTML tags in the mails
And we changed the signature a bit
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- serendipity_functions.inc.php 25 May 2003 17:20:04 -0000 1.53
+++ serendipity_functions.inc.php 26 May 2003 00:18:56 -0000 1.54
@@ -516,8 +516,7 @@
AND e.authorid = a.authorid";
$row = serendipity_db_query($query, true);
if($row['mail_comments']) {
- serendipity_sendComment($row['email'], $name, $email, $url, $id,
- $row['title'], $comments);
+ serendipity_sendComment($row['email'], $name, $email, $url, $id, $row['title'], $comments, $type);
}
serendipity_purgeEntry($id, $t);
}
@@ -536,25 +535,45 @@
serendipity_db_query("UPDATE ".$serendipity["dbPrefix"]." SET comments=comments+1 WHERE id LIKE $id");
}
-function serendipity_sendComment($to, $fromName, $fromEmail, $fromUrl, $id, $title, $comment) {
+function serendipity_sendComment($to, $fromName, $fromEmail, $fromUrl, $id, $title, $comment, $type='NORMAL') {
global $serendipity;
- $text =
-sprintf(A_NEW_COMMENT_BLAHBLAH, $serendipity[blogTitle],$id)."
+
+ if ($type == 'TRACKBACK') {
-IP Address: $_SERVER[REMOTE_ADDR]
-".NAME.": $fromName
-".EMAIL.": $fromEmail
-URL: $fromUrl
+/* If the comment is a trackback */
+ $subject = "[$serendipity[blogTitle]] New trackback made to $title";
+ $text = sprintf(A_NEW_TRACKBACK_BLAHBLAH, $title)."
-".COMMENTS.":
+Weblog ".NAME.": ". stripslashes($fromName) ."
+Link to remote-entry: $fromUrl
-$comment
+Excerpt:
+". strip_tags($comment);
+
+
+ } else {
+/* If the comment is a.. comment */
+ $subject = "[$serendipity[blogTitle]] New comment posted to $title";
+ $text = sprintf(A_NEW_COMMENT_BLAHBLAH, $serendipity[blogTitle],$title)."
+
+User IP Address: $_SERVER[REMOTE_ADDR]
+User ".NAME.": $fromName
+User ".EMAIL.": $fromEmail
+User URL: $fromUrl
+
+".COMMENTS.":
+". strip_tags($comment);
+
+ }
+
+$signature = "
--
-Powered by serendipity.
-My blog runs on PHP. Yours can too.
-http://php-blog.sf.net/ to find out how.";
-mail($to, "[$serendipity[blogTitle]] New comment posted to $title", $text,
+$serendipity[blogTitle] is powered by Serendipity.
+The best PHP blog around, you can use it too.
+Check out http://php-blog.sf.net/ to find out how.";
+
+mail($to, $subject, $text.$signature,
"From: $fromName <$fromEmail>\r\n");
}
Index: serendipity_lang_en.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_en.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- serendipity_lang_en.inc.php 22 May 2003 23:01:00 -0000 1.11
+++ serendipity_lang_en.inc.php 26 May 2003 00:18:56 -0000 1.12
@@ -82,7 +82,8 @@
define("POSTED_BY", "Posted by");
define("TRACKBACK_FROM", "Trackback from");
define("ON", "on");
-define("A_NEW_COMMENT_BLAHBLAH", "A new comment has been posted on your blog %s, on entry #%s.");
+define("A_NEW_COMMENT_BLAHBLAH", "A new comment has been posted on your blog \"%s\", in the entry entitled \"%s\".");
+define("A_NEW_TRACKBACK_BLAHBLAH", "A new trackback has been made to your blog-entry entitled \"%s\".");
define("NO_CATEGORY", "No Category");
define("ENTRY_BODY", "Entry Body");
define("EXTENDED_BODY", "Extended Body");
|