Skip to content

Commit 3d99cdd

Browse files
committed
Included comments in notifications
1 parent 9f6d24d commit 3d99cdd

4 files changed

Lines changed: 72 additions & 7 deletions

File tree

controller/rating_controller.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config
103103
/**
104104
* Display the post rating page
105105
*
106-
* @param string $mode Mode taken from the URL
106+
* @param string $mode Mode taken from the URL
107107
* @param int $post_id Post ID taken from the URL
108108
* @return Symfony\Component\HttpFoundation\Response A Symfony Response object
109109
* @access public
@@ -434,7 +434,7 @@ public function post($mode, $post_id)
434434
// Save vote
435435
if ($submit)
436436
{
437-
// Prevent cheater to break the forum permissions to give negative points or give more points than they can
437+
// Prevent cheater to break the forum permissions to give negative points or give more points than they can
438438
if (!$this->auth->acl_get('f_rs_rate_negative', $row['forum_id']) && $points < 0 || $points < 0 && $this->config['rs_min_rep_negative'] && ($this->user->data['user_reputation'] < $this->config['rs_min_rep_negative']) || $this->config['rs_enable_power'] && (($points > $max_voting_allowed) || ($points < -$max_voting_allowed)))
439439
{
440440
$submit = false;
@@ -483,6 +483,7 @@ public function post($mode, $post_id)
483483
'user_id_from' => $this->user->data['user_id'],
484484
'post_id' => $post_id,
485485
'post_subject' => $row['post_subject'],
486+
'comment' => $comment,
486487
);
487488

488489
$notification_type = ($points > 0) ? 'pico.reputation.notification.type.rate_post_positive' : 'pico.reputation.notification.type.rate_post_negative';
@@ -825,7 +826,7 @@ public function user($uid)
825826

826827
if ($submit)
827828
{
828-
//Prevent cheater to break the forum permissions to give negative points or give more points than they can
829+
//Prevent cheater to break the forum permissions to give negative points or give more points than they can
829830
if (!$this->auth->acl_get('u_rs_rate_negative') && $points < 0 || $points < 0 && $this->config['rs_min_rep_negative'] && ($this->user->data['user_reputation'] < $this->config['rs_min_rep_negative']) || $this->config['rs_enable_power'] && (($points > $max_voting_allowed) || ($points < -$max_voting_allowed)))
830831
{
831832
$submit = false;
@@ -898,4 +899,4 @@ public function user($uid)
898899

899900
return $this->helper->render('rateuser.html', $this->user->lang('RS_USER_RATING'));
900901
}
901-
}
902+
}

controller/reputation_common.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
*
4+
* Reputation System
5+
*
6+
* @copyright (c) 2014 Lukasz Kaczynski
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = array();
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, array(
41+
'REPUTATION' => 'Reputation',
42+
43+
'RS_DISABLED' => 'Sorry, but the board administrator has disabled this feature.',
44+
45+
'RS_COMMENT' => 'Comment',
46+
'RS_POINTS' => 'Points',
47+
48+
'RS_POST_REPUTATION' => 'Post reputation',
49+
'RS_POST_RATED' => 'You have rated this post',
50+
'RS_RATE_POST_POSITIVE' => 'Rate post positive',
51+
'RS_RATE_POST_NEGATIVE' => 'Rate post negative',
52+
'RS_RATE_USER' => 'Rate user',
53+
'RS_VIEW_DETAILS' => 'View details',
54+
55+
'NOTIFICATION_TYPE_REPUTATION' => 'Someone gives you reputation point',
56+
'NOTIFICATION_RATE_POST_POSITIVE' => '<strong>Rated positively</strong> by %s for post %s',
57+
'NOTIFICATION_RATE_POST_NEGATIVE' => '<strong>Rated negatively</strong> by %s for post %s',
58+
'NOTIFICATION_RATE_USER' => '<strong>Rated</strong> by %s',
59+
));

language/en/reputation_common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
'RS_VIEW_DETAILS' => 'View details',
5454

5555
'NOTIFICATION_TYPE_REPUTATION' => 'Someone gives you reputation point',
56-
'NOTIFICATION_RATE_POST_POSITIVE' => '<strong>Rated positively</strong> by %s for post',
57-
'NOTIFICATION_RATE_POST_NEGATIVE' => '<strong>Rated negatively</strong> by %s for post',
56+
'NOTIFICATION_RATE_POST_POSITIVE' => '<strong>Rated positively</strong> by %s for post %s',
57+
'NOTIFICATION_RATE_POST_NEGATIVE' => '<strong>Rated negatively</strong> by %s for post %s',
5858
'NOTIFICATION_RATE_USER' => '<strong>Rated</strong> by %s',
5959
));

notification/type/rate_post_positive.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ public function get_title()
228228
return $this->user->lang(
229229
$this->language_key,
230230
phpbb_generate_string_list($usernames, $this->user),
231+
censor_text($this->get_data('post_subject')),
231232
$trimmed_voting_users_cnt
232233
);
233234
}
@@ -239,9 +240,12 @@ public function get_title()
239240
*/
240241
public function get_reference()
241242
{
243+
if (empty($this->get_data('comment'))) {
244+
return null;
245+
}
242246
return $this->user->lang(
243247
'NOTIFICATION_REFERENCE',
244-
censor_text($this->get_data('post_subject'))
248+
censor_text($this->get_data('comment'))
245249
);
246250
}
247251

@@ -305,6 +309,7 @@ public function create_insert_array($data, $pre_create_data = array())
305309
$this->set_data('user_id_from', $data['user_id_from']);
306310
$this->set_data('post_id', $data['post_id']);
307311
$this->set_data('post_subject', $data['post_subject']);
312+
$this->set_data('comment', $data['comment']);
308313

309314
parent::create_insert_array($data, $pre_create_data);
310315
}

0 commit comments

Comments
 (0)