3
* This file implements the Comment class.
5
* This file is part of the Quam Plures project - {@link http://quamplures.net/}.
6
* See also {@link https://launchpad.net/quam-plures}.
8
* @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
9
* @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}.
10
* Parts of this file are copyright (c)2004-2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
12
* @license http://quamplures.net/license.html GNU General Public License (GPL)
14
* {@internal Open Source relicensing agreement:
15
* Daniel HAHLER grants Francois PLANQUE the right to license
16
* Daniel HAHLER's contributions to this file and the b2evolution project
17
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
20
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
21
* @author blueyed: Daniel HAHLER.
22
* @author fplanque: Francois PLANQUE
3
* This file implements the Comment class
5
* @todo (1111) vars type 'foo' need useful/valid descriptions
6
* @author {@link http://wonderwinds.com/ Ed Bennett}
7
* @author {@link http://daniel.hahler.de/ Daniel HAHLER}
8
* @author {@link http://fplanque.net/ Francois PLANQUE}
9
* @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
10
* @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
26
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
28
load_class('_core/model/dataobjects/_dataobject.class.php');
13
if(!defined('QP_MAIN_INIT')) die('fail');
35
20
class Comment extends DataObject
38
* The item (parent) of this Comment (lazy-filled).
23
* The item (parent) of this Comment (lazy-filled)
40
24
* @see Comment::get_Item()
41
25
* @see Comment::set_Item()
46
* The comment's user, this is NULL for (anonymous) visitors (lazy-filled).
30
* The comment's user, this is NULL for (anonymous) visitors (lazy-filled)
47
31
* @see Comment::get_author_User()
48
32
* @see Comment::set_author_User()
55
45
var $author_user_ID;
65
95
var $allow_msgform;
392
446
* $params = array_merge( array(
395
* 'text' => '#', // '#' = get_icon( 'delete', 'imgtag' ).' '.T_('Delete!')
396
* 'title' => T_('Delete this comment'),
449
* 'text' => '#', // '#' = get_icon( 'delete', 'imgtag' ).' '.T_('Delete!')
450
* 'title' => T_('Delete this comment'),
400
454
* 'save_context' => true,
458
* @todo (1111) defaults should be empty not space
459
* @uses Comment::get_Item()
460
* @uses User::check_perm()
461
* @uses Item::get_blog_ID()
462
* @uses regenerate_url()
463
* @param array Associative array of parameters
404
465
function delete_link( $params = array() )
406
global $current_User, $admin_url;
408
if( ! is_logged_in() ) return false;
410
if( empty($this->ID) )
411
{ // Happens in Preview
468
global $current_User;
470
if( ! is_logged_in() )
475
if( empty( $this->ID ) )
477
return false; // Happens in Preview
415
480
$this->get_Item();
417
482
if( ! $current_User->check_perm( 'blog_comments', '', false, $this->Item->get_blog_ID() ) )
418
{ // If User has no permission to edit comments:
484
return false; // User has no permission to edit comments
422
// Make sure we are not missing any param:
487
// make sure we aren't missing any required params
423
488
$params = array_merge( array(
427
'title' => T_('Delete this comment'),
431
'save_context' => true,
492
'title' => T_('Delete this comment'),
496
'save_context' => true,
434
499
if( $params['text'] == '#' )
435
{ // Use icon+text as default, if not displayed as button (otherwise just the text)
501
// Use icon+text as default, if not displayed as button (otherwise just the text)
436
502
if( ! $params['button'] )
438
504
$params['text'] = get_icon( 'delete', 'imgtag' ).' '.T_('Delete!');
491
559
* $params = array_merge( array(
494
* 'text' => get_icon( 'edit' ).' '.T_('Edit...'),
495
* 'title' => T_('Edit this comment'),
562
* 'text' => get_icon( 'edit' ).' '.T_('Edit...'),
563
* 'title' => T_('Edit this comment'),
498
566
* 'save_context' => true,
570
* @todo (1111) defaults should be empty not space
571
* @todo (3069) EdB> how come 'text' isn't # like {@see Comment::delete_link()}?
572
* @uses Comment::get_Item()
573
* @uses User::check_perm()
574
* @uses Item::get_blog_ID()
576
* @uses regenerate_url()
577
* @param array Associative array of parameters
502
579
function edit_link( $params = array() )
504
global $current_User, $admin_url;
506
if( ! is_logged_in() ) return false;
508
if( empty($this->ID) )
509
{ // Happens in Preview
582
global $current_User;
584
if( ! is_logged_in() )
589
if( empty( $this->ID ) )
591
return false; // Happens in Preview
513
594
$this->get_Item();
515
596
if( ! $current_User->check_perm( 'blog_comments', '', false, $this->Item->get_blog_ID() ) )
516
{ // If User has no permission to edit comments:
598
return false; // User has no permission to edit comments
520
// Make sure we are not missing any param:
601
// make sure we aren't missing any required params
521
602
$params = array_merge( array(
524
'text' => get_icon( 'edit' ).' '.T_('Edit...'),
525
'title' => T_('Edit this comment'),
528
'save_context' => true,
605
'text' => get_icon( 'edit' ).' '.T_('Edit...'),
606
'title' => T_('Edit this comment'),
609
'save_context' => true,
531
612
echo $params['before'];
532
613
echo '<a href="'.$admin_url.'?ctrl=comments&action=edit&comment_ID='.$this->ID;
582
* T-Tag: Return the author of comment
663
* Return the author of comment
585
666
* $params = array_merge( array(
586
667
* 'before_visitor' => '',
587
* 'after_visitor' => ' ['.T_('Visitor').']',
588
* 'before_user' => '',
589
* 'after_user' => ' ['.T_('Member').']',
590
* 'format' => 'htmlbody',
668
* 'after_visitor' => ' ['.T_('Visitor').']',
669
* 'before_user' => '',
670
* 'after_user' => ' ['.T_('Member').']',
671
* 'format' => 'htmlbody',
591
672
* 'make_link' => false,
676
* @uses Comment::get_author_User()
677
* @uses format_to_output()
678
* @uses User::get_preferred_name()
679
* @uses DataObject::dget()
680
* @uses Comment::get_author_url_link()
681
* @uses Plugins::trigger_event() FilterCommentAuthor
682
* @param array Associative array of parameters
597
685
function get_author( $params = array() )
601
// Make sure we are not missing any param:
689
// make sure we aren't missing any required params
602
690
$params = array_merge( array(
603
'before_visitor' => '',
604
'after_visitor' => ' ['.T_('Visitor').']',
606
'after_user' => ' ['.T_('Member').']',
607
'format' => 'htmlbody',
608
'make_link' => false,
691
'before_visitor' => '',
692
'after_visitor' => ' ['.T_('Visitor').']',
694
'after_user' => ' ['.T_('Member').']',
695
'format' => 'htmlbody',
696
'make_link' => false,
611
699
if( $this->get_author_User() )
612
{ // Author is a user
613
702
if( strlen( $this->author_User->url ) <= 10 )
615
704
$params['make_link'] = false;
634
724
if( $params['make_link'] )
636
727
$r = $this->get_author_url_link( array(
637
'before' => $params['before_visitor'],
638
'after' => $params['after_visitor'],
639
'text' => $author_name,
728
'before' => $params['before_visitor'],
729
'after' => $params['after_visitor'],
730
'text' => $author_name,
643
{ // Display the name: (NOTE: get_author_url_link( with nolink option ) would NOT handle this correctly when url is empty
735
// Display the name: (NOTE: get_author_url_link( with nolink option )
736
// would NOT handle this correctly when url is empty
644
737
$r = $params['before_visitor'].$author_name.$params['after_visitor'];
647
$Plugins->trigger_event( 'FilterCommentAuthor', array( 'data' => & $r, 'makelink' => $params['make_link'], 'Comment' => & $this ) );
740
$Plugins->trigger_event( 'FilterCommentAuthor', array(
742
'makelink' => $params['make_link'],
654
* Get the EMail of the comment's author.
751
* Get the email of the comment's author
658
755
function get_author_email()
660
757
if( $this->get_author_User() )
661
{ // Author is a user
662
return $this->author_User->get('email');
759
return $this->author_User->get( 'email' ); // Author is a user
769
879
$comment = $this->content;
770
$Plugins->trigger_event( 'FilterCommentContent', array( 'data' => & $comment, 'Comment' => $this ) );
880
$Plugins->trigger_event( 'FilterCommentContent', array(
881
'data' => & $comment,
771
884
$comment = format_to_output( $comment, $format );
778
* T-Tag: Return a link to deprecate a comment if user has edit rights
890
* Return a link to deprecate a comment if user has edit rights
781
893
* $params = array_merge( array(
784
* 'text' => get_icon( 'deprecate', 'imgtag' ).' '.T_('Deprecate!'),
785
* 'title' => T_('Deprecate this comment!'),
896
* 'text' => get_icon( 'deprecate', 'imgtag' ).' '.T_('Deprecate!'),
897
* 'title' => T_('Deprecate this comment!'),
788
900
* 'save_context' => true,
904
* @todo (3069) EdB> how come 'text' isn't # like {@see Comment::delete_link()}?
905
* @todo (1111) defaults should be empty not space
906
* @uses Comment::get_Item()
907
* @uses User::check_perm()
908
* @uses Item::get_blog_ID()
909
* @uses regenerate_url()
910
* @param array Associative array of parameters
792
912
function get_deprecate_link( $params = array() )
794
global $current_User, $admin_url;
915
global $current_User;
796
if( ! is_logged_in() ) return false;
917
if( ! is_logged_in() )
798
922
$this->get_Item();
800
if( ($this->status == 'deprecated') // Already deprecateded!
924
if( ( $this->status == 'deprecated' ) // Already deprecated!
801
925
|| ! $current_User->check_perm( 'blog_comments', '', false, $this->Item->get_blog_ID() ) )
802
{ // If User has no permission to edit comments:
927
return false; // User has no permission to edit comments
806
// Make sure we are not missing any param:
930
// make sure we aren't missing any required params
807
931
$params = array_merge( array(
810
'text' => get_icon( 'deprecate', 'imgtag' ).' '.T_('Deprecate!'),
811
'title' => T_('Deprecate this comment!'),
814
'save_context' => true,
934
'text' => get_icon( 'deprecate', 'imgtag' ).' '.T_('Deprecate!'),
935
'title' => T_('Deprecate this comment!'),
938
'save_context' => true,
817
941
$r = $params['before'];
818
942
$r .= '<a href="';
847
971
* 'text' => '#' = get_icon( 'permalink' ).T_('Permalink')<br />
848
972
* 'text' => '#icon#' = get_icon( 'permalink' )<br />
849
973
* 'text' => '#text#' = T_('Permalink')
976
* @uses Comment::get_permanent_url()
977
* @param array Associative array of parameters
851
979
function get_permanent_link( $params = array() )
853
global $current_User, $app_baseurl;
982
global $current_User;
855
// Make sure we are not missing any param:
984
// make sure we aren't missing any required params
856
985
$params = array_merge( array(
858
'title' => T_('Permanent link to this comment'),
987
'title' => T_('Permanent link to this comment'),
863
992
switch( $params['text'] )
866
$params['text'] = get_icon( 'permalink' ).T_('Permalink');
995
$params['text'] = get_icon( 'permalink' ).T_('Permalink');
870
$params['text'] = get_icon( 'permalink' );
999
$params['text'] = get_icon( 'permalink' );
874
$params['text'] = T_('Permalink');
1003
$params['text'] = T_('Permalink');
878
1007
$url = $this->get_permanent_url();
880
1009
// Display as link
881
1010
$r = '<a href="'.$url.'" title="'.$params['title'].'"';
882
if( !empty( $params['class'] ) )
1011
if( ! empty( $params['class'] ) )
884
1013
$r .= ' class="'.$params['class'].'"';
886
if( !empty( $params['nofollow'] ) )
1015
if( ! empty( $params['nofollow'] ) )
888
1017
$r .= ' rel="nofollow"';
912
* T-Tag: Provide a link to publish a comment if user has edit rights
1041
* Provide a link to publish a comment if user has edit rights
915
1044
* $params = array_merge( array(
918
* 'text' => get_icon( 'publish', 'imgtag' ).' '.T_('Publish!'),
919
* 'title' => T_('Publish this comment!'),
1047
* 'text' => get_icon( 'publish', 'imgtag' ).' '.T_('Publish!'),
1048
* 'title' => T_('Publish this comment!'),
1050
* 'glue' => '&',
922
1051
* 'save_context' => true,
1055
* @todo (1111) defaults should be empty not space
1056
* @todo (3069) EdB> how come 'text' isn't # like {@see Comment::delete_link()}?
1057
* @uses Comment::get_Item()
1058
* @uses User::check_perm()
1059
* @uses Item::get_blog_ID()
1060
* @uses regenerate_url()
1061
* @param array Associative array of parameters
926
1063
function get_publish_link( $params = array() )
928
global $current_User, $admin_url;
1066
global $current_User;
930
if( ! is_logged_in() ) return false;
1068
if( ! is_logged_in() )
932
1073
$this->get_Item();
934
if( ($this->status == 'published') // Already published!
1075
if( ( $this->status == 'published' ) // Already published!
935
1076
|| ! $current_User->check_perm( 'blog_comments', '', false, $this->Item->get_blog_ID() ) )
936
{ // If User has no permission to edit comments:
1078
// If User has no permission to edit comments
940
// Make sure we are not missing any param:
1082
// make sure we aren't missing any required params
941
1083
$params = array_merge( array(
944
'text' => get_icon( 'publish', 'imgtag' ).' '.T_('Publish!'),
945
'title' => T_('Publish this comment!'),
948
'save_context' => true,
1086
'text' => get_icon( 'publish', 'imgtag' ).' '.T_('Publish!'),
1087
'title' => T_('Publish this comment!'),
1090
'save_context' => true,
951
1093
$r = $params['before'];
952
1094
$r .= '<a href="';
971
1113
* Get title of comment, e.g. "Comment from: Foo Bar"
973
1115
* @param array Params
974
* 'author_format': Formatting of the author (%s gets replaced with
1116
* - 'author_format': Formatting of the author (%s gets replaced with the author string)
976
1117
* @return string
978
function get_title($params = array())
1119
function get_title( $params = array() )
980
if( empty($params['author_format']) )
1121
if( empty( $params['author_format'] ) )
982
1123
$params['author_format'] = '%s';
984
$author = sprintf($params['author_format'], $this->get_author());
1125
$author = sprintf( $params['author_format'], $this->get_author() );
986
1127
switch( $this->get( 'type' ) )
988
case 'comment': // Display a comment:
989
$s = T_('Comment from %s');
1129
case 'comment': // Display a comment
1130
$s = T_('Comment from %s');
992
case 'trackback': // Display a trackback:
993
$s = T_('Trackback from %s');
1133
case 'trackback': // Display a trackback
1134
$s = T_('Trackback from %s');
996
return sprintf($s, $author);
1137
return sprintf( $s, $author );
1004
1145
* $params = array_merge( array(
1005
1146
* 'before' => '',
1007
* 'text' => '#', // '#' = get_icon( 'email', 'imgtag', array( 'class' => 'middle', 'title' => $params['title'] ) )
1008
* 'title' => T_('Send email to comment author'),
1149
* 'title' => T_('Send email to comment author'),
1010
1151
* ), $params );
1154
* @todo (0000) have an SEO setting for nofollow, default to nofollow
1155
* @todo (1111) defaults should be empty not space
1156
* @uses Comment::get_author_User()
1157
* @uses url_add_param()
1013
1158
* @param string url of the message form
1159
* @param array Associative array of parameters
1015
1161
function msgform_link( $form_url, $params = array() )
1017
1163
if( $this->get_author_User() )
1018
{ // This comment is from a registered user:
1019
if( empty($this->author_User->email) )
1020
{ // We have no email for this Author :(
1165
// This comment is from a registered user
1166
if( empty( $this->author_User->email ) )
1168
// We have no email for this Author :(
1023
elseif( empty($this->author_User->allow_msgform) )
1024
{ // User does not allow message form
1171
elseif( empty( $this->author_User->allow_msgform ) )
1173
// User does not allow message form
1027
1176
$form_url = url_add_param( $form_url, 'recipient_id='.$this->author_User->ID );
1030
{ // This comment is from a visitor:
1031
if( empty($this->author_email) )
1032
{ // We have no email for this comment :(
1180
// This comment is from a visitor:
1181
if( empty( $this->author_email ) )
1183
// We have no email for this comment :(
1035
elseif( empty($this->allow_msgform) )
1036
{ // Anonymous commentator does not allow message form (for this comment)
1186
elseif( empty( $this->allow_msgform ) )
1188
// Anonymous commentator does not allow message form (for this comment)
1041
1193
$form_url = url_add_param( $form_url, 'comment_id='.$this->ID.'&post_id='.$this->item_ID
1042
.'&redirect_to='.rawurlencode(url_rel_to_same_host(regenerate_url('','','','&'), $form_url)) );
1194
.'&redirect_to='.rawurlencode( url_rel_to_same_host( regenerate_url( '','','','&' ), $form_url ) ) );
1044
// Make sure we are not missing any param:
1196
// make sure we aren't missing any required params
1045
1197
$params = array_merge( array(
1049
'title' => T_('Send email to comment author'),
1201
'title' => T_('Send email to comment author'),
1053
1205
// gotta be done this way due to you can't use $params when array_merging $params
1054
1206
if( $params['text'] == '#' ) $params['text'] = get_icon( 'email', 'imgtag', array( 'class' => 'middle', 'title' => $params['title'] ) );
1056
1208
echo $params['before'];
1057
1209
echo '<a href="'.$form_url.'" title="'.$params['title'].'"';
1058
if( !empty( $params['class'] ) )
1210
if( ! empty( $params['class'] ) )
1060
1212
echo ' class="'.$params['class'].'"';
1062
// TODO: have an SEO setting for nofollow here, default to nofollow
1063
1214
echo ' rel="nofollow"';
1064
1215
echo '>'.$params['text'].'</a>';
1065
1216
echo $params['after'];
1256
1417
$notify_array = array();
1258
1419
if( $edited_Blog->get_setting( 'allow_subscriptions' ) )
1259
{ // Get list of users who want to be notfied:
1260
// TODO: also use extra cats/blogs??
1261
// So far you get notifications for everything. We'll need a setting to decide if you want to received unmoderated (aka unpublished) comments or not.
1262
// Note: users receive comments on their own posts. This is done on purpose. Otherwise they think it's broken when they test the app.
1421
// Get list of users who want to be notified
1263
1422
$sql = 'SELECT DISTINCT user_email, user_locale
1264
FROM T_subscriptions INNER JOIN T_users ON sub_user_ID = user_ID
1265
WHERE sub_coll_ID = '.$this->Item->get_blog_ID().'
1266
AND sub_comments <> 0
1267
AND LENGTH(TRIM(user_email)) > 0';
1423
FROM T_subscriptions INNER JOIN T_users ON sub_user_ID = user_ID
1424
WHERE sub_blog_ID = '.$this->Item->get_blog_ID().'
1425
AND sub_comments <> 0
1426
AND LENGTH(TRIM(user_email)) > 0';
1268
1427
$notify_list = $DB->get_results( $sql );
1271
1430
foreach( $notify_list as $notification )
1273
1432
$notify_array[$notification->user_email] = $notification->user_locale;
1277
// Check if we need to include the author:
1436
// Check if we need to include the author
1278
1437
$item_author_User = & $edited_Item->get_creator_User();
1279
1438
if( $item_author_User->notify
1280
1439
&& ( ! empty( $item_author_User->email ) ) )
1281
{ // Author wants to be notified...
1282
if( ! ($this->get_author_User() // comment is from registered user
1283
&& $item_author_User->login == $this->author_User->login) ) // comment is from same user as post
1284
{ // Author is not commenting on his own post...
1441
// Author wants to be notified
1442
if( ! ( $this->get_author_User() // comment is from registered user
1443
&& $item_author_User->login == $this->author_User->login ) ) // comment is from same user as post
1445
// Author is not commenting on his own post...
1285
1446
$notify_array[$item_author_User->email] = $item_author_User->locale;
1289
if( ! count($notify_array) )
1290
{ // No-one to notify:
1450
if( ! count( $notify_array ) )
1452
return false; // No-one to notify
1295
* We have a list of email addresses to notify:
1297
// TODO: dh> this reveals the comments author's email address to all subscribers!!
1298
// $notify_from should get used by default, unless the user has opted in to be the sender!
1299
// fp>If the subscriber has permission to moderate the comments, he SHOULD receive the email address.
1455
// We have a list of email addresses to notify
1456
// @todo (0000) dh> this reveals the comments author's email address to all
1457
// subscribers!! $notify_from should get used by default, unless the user has
1458
// opted in to be the sender! fp> If the subscriber has permission to moderate
1459
// the comments, he SHOULD receive the email address.
1300
1460
if( $this->get_author_User() )
1301
{ // Comment from a registered user:
1302
$mail_from = $this->author_User->get('email');
1303
$mail_from_name = $this->author_User->get('preferredname');
1462
// Comment from a registered user
1463
$mail_from = $this->author_User->get( 'email' );
1464
$mail_from_name = $this->author_User->get( 'preferredname' );
1305
1466
elseif( ! empty( $this->author_email ) )
1306
{ // non-member, but with email address:
1468
// non-member, but with email address
1307
1469
$mail_from = $this->author_email;
1308
1470
$mail_from_name = $this->author;
1311
{ // Fallback (we have no email address): fp>TODO: or the subscriber is not allowed to view it.
1312
1474
global $notify_from;
1476
// Fallback (we have no email address): fp>TODO: or the subscriber is not allowed to view it
1313
1477
$mail_from = $notify_from;
1314
1478
$mail_from_name = NULL;
1318
1482
foreach( $notify_array as $notify_email => $notify_locale )
1320
locale_temp_switch($notify_locale);
1484
locale_temp_switch( $notify_locale );
1322
1486
switch( $this->type )
1324
1488
case 'trackback':
1325
/* TRANS: Subject of the mail to send on new trackbacks. First %s is the blog's shortname, the second %s is the item's title. */
1326
$subject = T_('[%s] New trackback on "%s"');
1489
/* TRANS: Subject of the mail to send on new trackbacks. First %s is the blog's shortname, the second %s is the item's title. */
1490
$subject = T_('[%s] New trackback on "%s"');
1330
/* TRANS: Subject of the mail to send on new comments. First %s is the blog's shortname, the second %s is the item's title. */
1331
$subject = T_('[%s] New comment on "%s"');
1494
/* TRANS: Subject of the mail to send on new comments. First %s is the blog's shortname, the second %s is the item's title. */
1495
$subject = T_('[%s] New comment on "%s"');
1334
$subject = sprintf( $subject, $edited_Blog->get('shortname'), $edited_Item->get('title') );
1498
$subject = sprintf( $subject, $edited_Blog->get( 'shortname' ), $edited_Item->get( 'title' ) );
1336
$notify_message = T_('Blog').': '.$edited_Blog->get('shortname')."\n"
1500
$notify_message = T_('Blog').': '.$edited_Blog->get( 'shortname' )."\n"
1337
1501
// Mail bloat: .' ( '.str_replace('&', '&', $edited_Blog->gen_blogurl())." )\n"
1338
.T_('Post').': '.$edited_Item->get('title')."\n";
1502
.T_('Post').': '.$edited_Item->get( 'title' )."\n";
1339
1503
// Mail bloat: .' ( '.str_replace('&', '&', $edited_Item->get_permanent_url())." )\n";
1340
// TODO: fp> We MAY want to force short URL and avoid it to wrap on a new line in the mail which may prevent people from clicking
1342
1505
switch( $this->type )
1344
1507
case 'trackback':
1345
$user_domain = gethostbyaddr($this->author_IP);
1346
$notify_message .= T_('Website').": $this->author (IP: $this->author_IP, $user_domain)\n";
1508
$user_domain = gethostbyaddr( $this->author_IP );
1509
$notify_message .= T_('Website').": $this->author (IP: $this->author_IP, $user_domain)\n";
1510
$notify_message .= T_('Url').": $this->author_url\n";
1514
if( $this->get_author_User() )
1516
// Comment from a registered user
1517
$notify_message .= T_('Author').': '.$this->author_User->get( 'preferredname' ).' ('.$this->author_User->get( 'login' ).")\n";
1521
// Comment from visitor
1522
$user_domain = gethostbyaddr( $this->author_IP );
1523
$notify_message .= T_('Author').": $this->author (IP: $this->author_IP, $user_domain)\n";
1524
$notify_message .= T_('Email').": $this->author_email\n";
1347
1525
$notify_message .= T_('Url').": $this->author_url\n";
1351
if( $this->get_author_User() )
1352
{ // Comment from a registered user:
1353
$notify_message .= T_('Author').': '.$this->author_User->get('preferredname').' ('.$this->author_User->get('login').")\n";
1356
{ // Comment from visitor:
1357
$user_domain = gethostbyaddr($this->author_IP);
1358
$notify_message .= T_('Author').": $this->author (IP: $this->author_IP, $user_domain)\n";
1359
$notify_message .= T_('Email').": $this->author_email\n";
1360
$notify_message .= T_('Url').": $this->author_url\n";
1365
T_('Comment').': '.str_replace('&', '&', $this->get_permanent_url())."\n"
1366
// TODO: fp> We MAY want to force a short URL and avoid it to wrap on a new line in the mail which may prevent people from clicking
1529
$notify_message = T_('Comment').': '.str_replace('&', '&', $this->get_permanent_url())."\n".$notify_message;
1369
if( !empty( $this->rating ) )
1531
if( ! empty( $this->rating ) )
1371
1533
$notify_message .= T_('Rating').": $this->rating\n";
1374
$notify_message .= $this->get('content')
1536
$notify_message .= $this->get( 'content' )
1376
1538
.T_('Edit/Delete').': '.$admin_url.'?ctrl=items&blog='.$edited_Blog->ID.'&p='.$edited_Item->ID.'&c=1#c'.$this->ID."\n\n"
1377
1539
.T_('Edit your subscriptions/notifications').': '.str_replace('&', '&', url_add_param( $edited_Blog->gen_blogurl(), 'disp=subs' ) )."\n";