diff --git a/acp/acp_thanks_info.php b/acp/acp_thanks_info.php
index c8b4147..c0ab79f 100644
--- a/acp/acp_thanks_info.php
+++ b/acp/acp_thanks_info.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -14,13 +16,13 @@ class acp_thanks_info
{
function module()
{
- return array(
+ return [
'filename' => '\gfksx\thanksforposts\acp\acp_thanks_module',
'title' => 'ACP_THANKS_SETTINGS',
- 'version' => '1.3.4',
- 'modes' => array(
- 'thanks' => array('title' => 'ACP_THANKS_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')),
- ),
- );
+ 'version' => '2.0.7',
+ 'modes' => [
+ 'thanks' => ['title' => 'ACP_THANKS_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']],
+ ],
+ ];
}
}
diff --git a/acp/acp_thanks_module.php b/acp/acp_thanks_module.php
index 5af4251..03aff1a 100644
--- a/acp/acp_thanks_module.php
+++ b/acp/acp_thanks_module.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -16,55 +18,71 @@
class acp_thanks_module
{
var $u_action;
- var $new_config = array();
+ var $new_config = [];
function main($id, $mode)
{
- global $config, $request, $user, $phpbb_container, $template;
+ global $phpbb_container;
+
+ /** @var \phpbb\config\config $config Config object */
+ $config = $phpbb_container->get('config');
+
+ /** @var \phpbb\language\language $language Language object */
+ $language = $phpbb_container->get('language');
+
+ /** @var \phpbb\request\request $request Request object */
+ $request = $phpbb_container->get('request');
+
+ /** @var \phpbb\template\template $template Template object */
+ $template = $phpbb_container->get('template');
+
+ /** @var \phpbb\user $user User object */
+ $user = $phpbb_container->get('user');
$submit = $request->is_set_post('submit');
$form_key = 'acp_thanks';
add_form_key($form_key);
+
/**
- * Validation types are:
- * string, int, bool,
- * script_path (absolute path in url - beginning with / and no trailing slash),
- * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
- */
- $display_vars = array(
+ * Validation types are:
+ * string, int, bool,
+ * script_path (absolute path in url - beginning with / and no trailing slash),
+ * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
+ */
+ $display_vars = [
'title' => 'ACP_THANKS_SETTINGS',
- 'vars' => array(
- 'legend' => 'GENERAL_OPTIONS',
- 'remove_thanks' => array('lang' => 'REMOVE_THANKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_only_first_post' => array('lang' => 'THANKS_ONLY_FIRST_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_global_post' => array('lang' => 'THANKS_GLOBAL_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_info_page' => array('lang' => 'THANKS_INFO_PAGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_postlist_view' => array('lang' => 'THANKS_POSTLIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_number_post' => array('lang' => 'THANKS_NUMBER_POST', 'validate' => 'int:1:250', 'type' => 'text:4:6', 'explain' => true),
- 'thanks_time_view' => array('lang' => 'THANKS_TIME_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_counters_view' => array('lang' => 'THANKS_COUNTERS_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_profilelist_view' => array('lang' => 'THANKS_PROFILELIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_number' => array('lang' => 'THANKS_NUMBER', 'validate' => 'int:1', 'type' => 'text:4:4', 'explain' => true),
- 'thanks_top_number' => array('lang' => 'THANKS_TOP_NUMBER', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
- )
- );
+ 'vars' => [
+ 'legend' => 'GENERAL_OPTIONS',
+ 'remove_thanks' => ['lang' => 'REMOVE_THANKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_only_first_post' => ['lang' => 'THANKS_ONLY_FIRST_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_global_post' => ['lang' => 'THANKS_GLOBAL_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_info_page' => ['lang' => 'THANKS_INFO_PAGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_postlist_view' => ['lang' => 'THANKS_POSTLIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_number_post' => ['lang' => 'THANKS_NUMBER_POST', 'validate' => 'int:1:250', 'type' => 'text:4:6', 'explain' => true],
+ 'thanks_time_view' => ['lang' => 'THANKS_TIME_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_counters_view' => ['lang' => 'THANKS_COUNTERS_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_profilelist_view' => ['lang' => 'THANKS_PROFILELIST_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_number' => ['lang' => 'THANKS_NUMBER', 'validate' => 'int:1', 'type' => 'text:4:4', 'explain' => true],
+ 'thanks_top_number' => ['lang' => 'THANKS_TOP_NUMBER', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true],
+ ]
+ ];
if (isset($display_vars['lang']))
{
- $phpbb_container->get('language')->add_lang($display_vars['lang']);
+ $language->add_lang($display_vars['lang']);
}
$this->new_config = $config;
- $cfg_array = ($request->is_set('config')) ? $request->variable('config', array('' => ''), true) : $this->new_config;
- $error = array();
+ $cfg_array = ($request->is_set('config')) ? $request->variable('config', ['' => ''], true) : $this->new_config;
+ $error = [];
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key))
{
- $error[] = $user->lang('FORM_INVALID');
+ $error[] = $language->lang('FORM_INVALID');
}
// Do not write values if there is an error
if (sizeof($error))
@@ -94,20 +112,21 @@ function main($id, $mode)
$phpbb_log = $phpbb_container->get('log');
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode));
- trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
+ trigger_error($language->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
$this->tpl_name = 'acp_thanks';
$this->page_title = $display_vars['title'];
- $template->assign_vars(array(
- 'L_TITLE' => $user->lang($display_vars['title']),
- 'L_TITLE_EXPLAIN' => $user->lang($display_vars['title'] . '_EXPLAIN'),
+ $template->assign_vars([
+ 'L_TITLE' => $language->lang($display_vars['title']),
+ 'L_TITLE_EXPLAIN' => $language->lang($display_vars['title'] . '_EXPLAIN'),
'S_ERROR' => (sizeof($error)) ? true : false,
'ERROR_MSG' => implode('
', $error),
- 'U_ACTION' => $this->u_action)
+ 'U_ACTION' => $this->u_action,
+ ]
);
// Output relevant page
@@ -120,9 +139,10 @@ function main($id, $mode)
if (strpos($config_key, 'legend') !== false)
{
- $template->assign_block_vars('options', array(
+ $template->assign_block_vars('options', [
'S_LEGEND' => true,
- 'LEGEND' => $user->lang($vars))
+ 'LEGEND' => $language->lang($vars),
+ ]
);
continue;
@@ -132,11 +152,11 @@ function main($id, $mode)
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain']))
{
- $l_explain = $user->lang($vars['lang_explain']);
+ $l_explain = $language->lang($vars['lang_explain']);
}
else if ($vars['explain'])
{
- $l_explain = $user->lang($vars['lang'] . '_EXPLAIN');
+ $l_explain = $language->lang($vars['lang'] . '_EXPLAIN');
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
@@ -146,13 +166,13 @@ function main($id, $mode)
continue;
}
- $template->assign_block_vars('options', array(
+ $template->assign_block_vars('options', [
'KEY' => $config_key,
- 'TITLE' => $user->lang($vars['lang']),
+ 'TITLE' => $language->lang($vars['lang']),
'S_EXPLAIN' => $vars['explain'],
'TITLE_EXPLAIN' => $l_explain,
'CONTENT' => $content,
- )
+ ]
);
unset($display_vars['vars'][$config_key]);
diff --git a/acp/acp_thanks_refresh_info.php b/acp/acp_thanks_refresh_info.php
index 09a2eaa..3785cb8 100644
--- a/acp/acp_thanks_refresh_info.php
+++ b/acp/acp_thanks_refresh_info.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -14,13 +16,13 @@ class acp_thanks_refresh_info
{
function module()
{
- return array(
+ return [
'filename' => '\gfksx\thanksforposts\acp\acp_thanks_refresh_module',
'title' => 'ACP_THANKS_REFRESH',
- 'version' => '1.3.4',
- 'modes' => array(
- 'thanks' => array('title' => 'ACP_THANKS_REFRESH', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')),
- ),
- );
+ 'version' => '2.0.7',
+ 'modes' => [
+ 'thanks' => ['title' => 'ACP_THANKS_REFRESH', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']],
+ ],
+ ];
}
}
diff --git a/acp/acp_thanks_refresh_module.php b/acp/acp_thanks_refresh_module.php
index 3773298..936b274 100644
--- a/acp/acp_thanks_refresh_module.php
+++ b/acp/acp_thanks_refresh_module.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -19,18 +21,36 @@ class acp_thanks_refresh_module
function main($id, $mode)
{
- global $db, $user, $request, $template, $cache, $config, $phpbb_container;
+ global $phpbb_container;
+
+ /** @var \phpbb\cache\driver\driver_interface $cache Cache driver object */
+ $cache = $phpbb_container->get('cache.driver');
+
+ /** @var \phpbb\config\config $config Config object */
+ $config = $phpbb_container->get('config');
+
+ /** @var \phpbb\db\driver\driver_interface $db DBAL object */
+ $db = $phpbb_container->get('dbal.conn');
+
+ /** @var \phpbb\language\language $language Language object */
+ $language = $phpbb_container->get('language');
+
+ /** @var \phpbb\request\request $request Request object */
+ $request = $phpbb_container->get('request');
+
+ /** @var \phpbb\template\template $template Template object */
+ $template = $phpbb_container->get('template');
+
+ /** @var string $thanks_table _thanks database table */
+ $thanks_table = $phpbb_container->getParameter('tables.thanks');
$this->tpl_name = 'acp_thanks_refresh';
$this->page_title = 'ACP_THANKS_REFRESH';
- $posts_delete_us = array();
+ $posts_delete_us = [];
$del_thanks = $end_thanks = $del_uthanks = $end_posts_thanks = $end_users_thanks = $thanks_update = 0;
$all_users_thanks = $all_thanks = $all_posts_number = $all_posts_thanks = 0;
- $thanks_table = $phpbb_container->getParameter('tables.thanks');
-
- // check mode
$refresh = $request->variable('refresh', false);
if (!$refresh)
{
@@ -40,7 +60,7 @@ function main($id, $mode)
$cache->destroy('_all_posts');
$cache->destroy('_all_posts_number');
- // count all posts, thanks, users
+ // Count all posts, thanks, users
$sql = 'SELECT COUNT(DISTINCT post_id) as all_posts_thanks
FROM ' . $thanks_table;
$result = $db->sql_query($sql);
@@ -59,21 +79,20 @@ function main($id, $mode)
$all_thanks = (int) $db->sql_fetchfield('total_match_count');
$db->sql_freeresult($result);
- $all_posts = array();
- $sql_ary = array(
+ $all_posts = [];
+ $sql_ary = [
'SELECT' => 't.*',
- 'FROM' => array(
- $thanks_table => 't',
- ),
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array(POSTS_TABLE => 'p'),
+ 'FROM' => [$thanks_table => 't'],
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [POSTS_TABLE => 'p'],
'ON' => 't.post_id = p.post_id',
- ),
- ),
+ ],
+ ],
'WHERE' => 'p.post_id IS NULL',
- );
+ ];
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
+
while ($row = $db->sql_fetchrow($result))
{
$all_posts[] = (int) $row['post_id'];
@@ -88,24 +107,23 @@ function main($id, $mode)
$cache->put('_all_posts', $all_posts);
$cache->put('_all_posts_number', $all_posts_number);
- $template->assign_vars(array(
+ $template->assign_vars([
'S_REFRESH' => false,
- 'L_WARNING' => sprintf($user->lang['WARNING']),
- ));
+ ]);
}
- //update
+
+ // Update
if ($refresh)
{
- // check mode
if (confirm_box(true))
{
$all_users_thanks = (int) $cache->get('_all_users_thanks');
$all_thanks = (int) $cache->get('_all_thanks');
- $all_posts = $cache->get('_all_posts');
+ $all_posts = (array) $cache->get('_all_posts');
$all_posts_number = (int) $cache->get('_all_posts_number');
$all_posts_thanks = (int) $cache->get('_all_posts_thanks');
- // update delete posts
+ // Update deleted posts thanks
if (!empty($all_posts))
{
$sql = 'DELETE FROM ' . $thanks_table ."
@@ -115,20 +133,18 @@ function main($id, $mode)
$end_thanks = $all_thanks - $del_thanks;
}
- // update delete users
- $sql_ary = array(
+ // Update deleted users thanks
+ $sql_ary = [
'SELECT' => 't.post_id',
- 'FROM' => array(
- $thanks_table => 't',
- ),
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array(POSTS_TABLE => 'p'),
+ 'FROM' => [$thanks_table => 't'],
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [POSTS_TABLE => 'p'],
'ON' => 't.post_id = p.post_id',
- ),
- ),
+ ],
+ ],
'WHERE' => 'p.poster_id = '. ANONYMOUS,
- );
+ ];
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
while ($row = $db->sql_fetchrow($result))
@@ -145,22 +161,21 @@ function main($id, $mode)
$db->sql_query($sql);
}
- //update move posts /topics /forums and change posters
- $sql_ary = array(
+ // Update moved posts /topics /forums and changed posters data
+ $sql_ary = [
'SELECT' => 'p.post_id',
- 'FROM' => array(
- POSTS_TABLE => 'p',
- ),
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array($thanks_table => 't'),
+ 'FROM' => [POSTS_TABLE => 'p'],
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [$thanks_table => 't'],
'ON' => 'p.post_id = t.post_id',
- ),
- ),
+ ],
+ ],
'WHERE' => 'p.topic_id <> t.topic_id OR p.forum_id <> t.forum_id OR p.poster_id <> t.poster_id',
- );
+ ];
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
- $thanks_update = 0;
+
+ $thanks_updated = 0;
if ($result)
{
while ($row = $db->sql_fetchrow($result))
@@ -172,25 +187,26 @@ function main($id, $mode)
$rows = $db->sql_fetchrow($results);
$db->sql_freeresult($results);
- $sql_ary = array(
+ $sql_ary = [
'post_id' => $rows['post_id'],
'forum_id' => $rows['forum_id'],
'topic_id' => $rows['topic_id'],
'poster_id' => $rows['poster_id'],
- );
+ ];
$sql = 'UPDATE ' . $thanks_table . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) .'
WHERE post_id = '. $sql_ary['post_id'];
$db->sql_query($sql);
- $thanks_update++;
+ $thanks_updated++;
}
}
$db->sql_freeresult($result);
$end_thanks = $end_thanks - $del_uthanks;
$del_thanks = $del_thanks + $del_uthanks;
- // delete thanks only first post
+
+ // Delete topic first posts thanks
if (isset($config['thanks_only_first_post']) ? $config['thanks_only_first_post'] : false)
{
$sql = 'SELECT topic_first_post_id
@@ -212,7 +228,8 @@ function main($id, $mode)
$del_thanks = $del_thanks + $del_nofirst_thanks;
}
}
- // delete thanks global announce
+
+ // Delete global announces thanks
if (isset($config['thanks_global_post']) ? !$config['thanks_global_post'] : false)
{
$sql = 'SELECT topic_id
@@ -235,12 +252,12 @@ function main($id, $mode)
$del_thanks = $del_thanks + $del_global_thanks;
}
}
- // delete selfthanks
+
+ // Delete selfthanks
$sql = 'DELETE FROM ' . $thanks_table .'
WHERE poster_id = user_id';
- $result = $db->sql_query($sql);
+ $db->sql_query($sql);
$del_selfthanks = $db->sql_affectedrows();
- $db->sql_freeresult($result);
$del_thanks = $del_thanks + $del_selfthanks;
$end_thanks = $end_thanks - $del_selfthanks;
@@ -257,22 +274,22 @@ function main($id, $mode)
$end_users_thanks = (int) $db->sql_fetchfield('end_users_thanks');
$db->sql_freeresult($result);
- $template->assign_vars(array(
+ $template->assign_vars([
'S_REFRESH' => true,
- ));
+ ]);
}
else
{
- $s_hidden_fields = build_hidden_fields(array(
+ $s_hidden_fields = build_hidden_fields([
'refresh' => true,
- )
- );
- //display mode
+ ]);
+
+ // Display mode
confirm_box(false, 'REFRESH_THANKS', $s_hidden_fields);
- trigger_error($user->lang['TRUNCATE_NO_THANKS'] . adm_back_link($this->u_action));
+ trigger_error($language->lang('TRUNCATE_NO_THANKS') . adm_back_link($this->u_action));
}
}
- $template->assign_vars(array(
+ $template->assign_vars([
'POSTS' => $all_posts_number,
'POSTSTHANKS' => $all_posts_thanks,
@@ -285,6 +302,6 @@ function main($id, $mode)
'POSTSEND' => $end_posts_thanks,
'USERSEND' => $end_users_thanks,
'THANKSEND' => $end_thanks,
- ));
+ ]);
}
}
diff --git a/acp/acp_thanks_reput_info.php b/acp/acp_thanks_reput_info.php
index 19b4979..e36d6f0 100644
--- a/acp/acp_thanks_reput_info.php
+++ b/acp/acp_thanks_reput_info.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -14,13 +16,13 @@ class acp_thanks_reput_info
{
function module()
{
- return array(
+ return [
'filename' => '\gfksx\thanksforposts\acp\acp_thanks_reput_module',
'title' => 'ACP_THANKS_REPUT_SETTINGS',
- 'version' => '1.3.4',
- 'modes' => array(
- 'thanks' => array('title' => 'ACP_THANKS_REPUT_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')),
- ),
- );
+ 'version' => '2.0.7',
+ 'modes' => [
+ 'thanks' => ['title' => 'ACP_THANKS_REPUT_SETTINGS', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']],
+ ],
+ ];
}
}
diff --git a/acp/acp_thanks_reput_module.php b/acp/acp_thanks_reput_module.php
index 625ebf6..8cb35a7 100644
--- a/acp/acp_thanks_reput_module.php
+++ b/acp/acp_thanks_reput_module.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -16,56 +18,75 @@
class acp_thanks_reput_module
{
var $u_action;
- var $new_config = array();
+ var $new_config = [];
function main($id, $mode)
{
- global $request, $user, $template, $config, $phpbb_root_path, $phpbb_container;
+ global $phpbb_container;
+
+ /** @var \phpbb\config\config $config Config object */
+ $config = $phpbb_container->get('config');
+
+ /** @var \phpbb\language\language $language Language object */
+ $language = $phpbb_container->get('language');
+
+ /** @var \phpbb\request\request $request Request object */
+ $request = $phpbb_container->get('request');
+
+ /** @var \phpbb\template\template $template Template object */
+ $template = $phpbb_container->get('template');
+
+ /** @var \phpbb\user $user User object */
+ $user = $phpbb_container->get('user');
+
+ /** @var string $phpbb_root_path phpbb_root_path */
+ $phpbb_root_path = $phpbb_container->getParameter('core.root_path');
$submit = $request->is_set_post('submit');
$form_key = 'acp_thanks_reput';
add_form_key($form_key);
+
/**
- * Validation types are:
- * string, int, bool,
- * script_path (absolute path in url - beginning with / and no trailing slash),
- * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
- */
- $display_vars = array(
+ * Validation types are:
+ * string, int, bool,
+ * script_path (absolute path in url - beginning with / and no trailing slash),
+ * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable)
+ */
+ $display_vars = [
'title' => 'ACP_THANKS_REPUT_SETTINGS',
- 'vars' => array(
- 'legend' => 'GENERAL_OPTIONS',
- 'thanks_post_reput_view' => array('lang' => 'THANKS_POST_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_topic_reput_view' => array('lang' => 'THANKS_TOPIC_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_forum_reput_view' => array('lang' => 'THANKS_FORUM_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_number_digits' => array('lang' => 'THANKS_NUMBER_DIGITS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
- 'thanks_number_row_reput' => array('lang' => 'THANKS_NUMBER_ROW_REPUT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
- 'legend1' => 'GRAPHIC_OPTIONS',
- 'thanks_reput_graphic' => array('lang' => 'THANKS_REPUT_GRAPHIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'thanks_reput_height' => array('lang' => 'THANKS_REPUT_HEIGHT', 'validate' => 'int:1:25', 'type' => 'text:4:6', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
- 'thanks_reput_level' => array('lang' => 'THANKS_REPUT_LEVEL', 'validate' => 'int:4:13', 'type' => 'text:4:4', 'explain' => true),
- 'thanks_reput_image' => array('lang' => 'THANKS_REPUT_IMAGE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
'),
- 'thanks_reput_image_back' => array('lang' => 'THANKS_REPUT_IMAGE_BACK', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
'),
- 'legend2' => 'GRAPHIC_DEFAULT',
- )
- );
+ 'vars' => [
+ 'legend' => 'GENERAL_OPTIONS',
+ 'thanks_post_reput_view' => ['lang' => 'THANKS_POST_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_topic_reput_view' => ['lang' => 'THANKS_TOPIC_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_forum_reput_view' => ['lang' => 'THANKS_FORUM_REPUT_VIEW', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_number_digits' => ['lang' => 'THANKS_NUMBER_DIGITS', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true],
+ 'thanks_number_row_reput' => ['lang' => 'THANKS_NUMBER_ROW_REPUT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true],
+ 'legend1' => 'GRAPHIC_OPTIONS',
+ 'thanks_reput_graphic' => ['lang' => 'THANKS_REPUT_GRAPHIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
+ 'thanks_reput_height' => ['lang' => 'THANKS_REPUT_HEIGHT', 'validate' => 'int:1:25', 'type' => 'text:4:6', 'explain' => true, 'append' => ' ' . $language->lang('PIXEL')],
+ 'thanks_reput_level' => ['lang' => 'THANKS_REPUT_LEVEL', 'validate' => 'int:4:13', 'type' => 'text:4:4', 'explain' => true],
+ 'thanks_reput_image' => ['lang' => 'THANKS_REPUT_IMAGE', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
'],
+ 'thanks_reput_image_back' => ['lang' => 'THANKS_REPUT_IMAGE_BACK', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true, 'append' => '
'],
+ 'legend2' => 'GRAPHIC_DEFAULT',
+ ]
+ ];
if (isset($display_vars['lang']))
{
- $phpbb_container->get('language')->add_lang($display_vars['lang']);
+ $language->add_lang($display_vars['lang']);
}
$this->new_config = $config;
- $cfg_array = ($request->is_set('config')) ? $request->variable('config', array('' => ''), true) : $this->new_config;
- $error = array();
+ $cfg_array = ($request->is_set('config')) ? $request->variable('config', ['' => ''], true) : $this->new_config;
+ $error = [];
// We validate the complete config if whished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key))
{
- $error[] = $user->lang['FORM_INVALID'];
+ $error[] = $language->lang('FORM_INVALID');
}
// Do not write values if there is an error
@@ -75,12 +96,13 @@ function main($id, $mode)
}
if (!empty($cfg_array['thanks_reput_image']) && !file_exists($phpbb_root_path . $config['thanks_reput_image']))
{
- $error[] = $user->lang['THANKS_REPUT_IMAGE_NOEXIST'];
+ $error[] = $language->lang('THANKS_REPUT_IMAGE_NOEXIST');
}
if (!empty($cfg_array['thanks_reput_image_back']) && !file_exists($phpbb_root_path . $config['thanks_reput_image_back']))
{
- $error[] = $user->lang['THANKS_REPUT_IMAGE_BACK_NOEXIST'];
+ $error[] = $language->lang('THANKS_REPUT_IMAGE_BACK_NOEXIST');
}
+
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
@@ -103,24 +125,24 @@ function main($id, $mode)
$phpbb_log = $phpbb_container->get('log');
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode));
- trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
+ trigger_error($language->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
$this->tpl_name = 'acp_thanks_reput';
$this->page_title = $display_vars['title'];
- $template->assign_vars(array(
- 'L_TITLE' => $user->lang[$display_vars['title']],
- 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'],
- 'GRAPHIC_STAR_BLUE_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BLUE'],
- 'GRAPHIC_STAR_GOLD_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_GOLD'],
- 'GRAPHIC_STAR_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_STAR_BACK'],
- 'GRAPHIC_BLOCK_RED_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_RED'],
- 'GRAPHIC_BLOCK_BACK_EXAMPLE' => $phpbb_root_path . $user->lang['GRAPHIC_BLOCK_BACK'],
- 'S_ERROR' => (sizeof($error)) ? true : false,
- 'ERROR_MSG' => implode('
', $error),
- 'U_ACTION' => $this->u_action)
- );
+ $template->assign_vars([
+ 'L_TITLE' => $language->lang($display_vars['title']),
+ 'L_TITLE_EXPLAIN' => $language->lang($display_vars['title'] . '_EXPLAIN'),
+ 'GRAPHIC_STAR_BLUE_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_STAR_BLUE'),
+ 'GRAPHIC_STAR_GOLD_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_STAR_GOLD'),
+ 'GRAPHIC_STAR_BACK_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_STAR_BACK'),
+ 'GRAPHIC_BLOCK_RED_EXAMPLE' => $phpbb_root_path . $language->lang('GRAPHIC_BLOCK_RED'),
+ 'GRAPHIC_BLOCK_BACK_EXAMPLE'=> $phpbb_root_path . $language->lang('GRAPHIC_BLOCK_BACK'),
+ 'S_ERROR' => (sizeof($error)) ? true : false,
+ 'ERROR_MSG' => implode('
', $error),
+ 'U_ACTION' => $this->u_action
+ ]);
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars)
@@ -132,40 +154,38 @@ function main($id, $mode)
if (strpos($config_key, 'legend') !== false)
{
- $template->assign_block_vars('options', array(
- 'S_LEGEND' => true,
- 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
- );
+ $template->assign_block_vars('options', [
+ 'S_LEGEND' => true,
+ 'LEGEND' => $language->lang($vars),
+ ]);
continue;
}
- $type = explode(':', $vars['type']);
+ $type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain']))
{
- $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
+ $l_explain = $language->lang($vars['lang_explain']);
}
else if ($vars['explain'])
{
- $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
+ $l_explain = $language->lang($vars['lang'] . '_EXPLAIN');
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
-
if (empty($content))
{
continue;
}
- $template->assign_block_vars('options', array(
+ $template->assign_block_vars('options', [
'KEY' => $config_key,
- 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
+ 'TITLE' => $language->lang($vars['lang']),
'S_EXPLAIN' => $vars['explain'],
'TITLE_EXPLAIN' => $l_explain,
'CONTENT' => $content,
- )
- );
+ ]);
unset($display_vars['vars'][$config_key]);
}
diff --git a/acp/acp_thanks_truncate_info.php b/acp/acp_thanks_truncate_info.php
index fa8f756..cc1f075 100644
--- a/acp/acp_thanks_truncate_info.php
+++ b/acp/acp_thanks_truncate_info.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -14,13 +16,13 @@ class acp_thanks_truncate_info
{
function module()
{
- return array(
+ return [
'filename' => '\gfksx\thanksforposts\acp\acp_thanks_truncate_module',
'title' => 'ACP_THANKS_TRUNCATE',
- 'version' => '1.3.4',
- 'modes' => array(
- 'thanks' => array('title' => 'ACP_THANKS_TRUNCATE', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => array('ACP_THANKS')),
- ),
- );
+ 'version' => '2.0.7',
+ 'modes' => [
+ 'thanks' => ['title' => 'ACP_THANKS_TRUNCATE', 'auth' => 'ext_gfksx/thanksforposts && acl_a_board', 'cat' => ['ACP_THANKS']],
+ ],
+ ];
}
}
diff --git a/acp/acp_thanks_truncate_module.php b/acp/acp_thanks_truncate_module.php
index 4db1601..8fcab31 100644
--- a/acp/acp_thanks_truncate_module.php
+++ b/acp/acp_thanks_truncate_module.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\acp;
@@ -19,13 +21,26 @@ class acp_thanks_truncate_module
function main($id, $mode)
{
- global $db, $request, $user, $template, $phpbb_container;
+ global $phpbb_container;
- $this->tpl_name = 'acp_thanks_truncate';
- $this->page_title = 'ACP_THANKS_TRUNCATE';
+ /** @var \phpbb\db\driver\driver_interface $db DBAL object */
+ $db = $phpbb_container->get('dbal.conn');
+
+ /** @var \phpbb\language\language $language Language object */
+ $language = $phpbb_container->get('language');
+
+ /** @var \phpbb\request\request $request Request object */
+ $request = $phpbb_container->get('request');
+
+ /** @var \phpbb\template\template $template Template object */
+ $template = $phpbb_container->get('template');
+ /** @var string $thanks_table _thanks database table */
$thanks_table = $phpbb_container->getParameter('tables.thanks');
+ $this->tpl_name = 'acp_thanks_truncate';
+ $this->page_title = 'ACP_THANKS_TRUNCATE';
+
$sql = 'SELECT COUNT(post_id) as total_match_count
FROM ' . $thanks_table;
$result = $db->sql_query($sql);
@@ -48,12 +63,10 @@ function main($id, $mode)
if ($truncate)
{
- // check mode
if (confirm_box(true))
{
$sql = 'DELETE FROM ' . $thanks_table;
- $result = $db->sql_query($sql);
- $db->sql_freeresult($result);
+ $db->sql_query($sql);
$sql = 'SELECT COUNT(post_id) as total_match_count
FROM ' . $thanks_table;
@@ -66,17 +79,17 @@ function main($id, $mode)
}
else
{
- $s_hidden_fields = build_hidden_fields(array(
+ $s_hidden_fields = build_hidden_fields([
'truncate' => true,
- )
- );
- //display mode
+ ]);
+
+ // Display mode
confirm_box(false, 'TRUNCATE_THANKS', $s_hidden_fields);
- trigger_error($user->lang['TRUNCATE_NO_THANKS'] . adm_back_link($this->u_action));
+ trigger_error($language->lang('TRUNCATE_NO_THANKS') . adm_back_link($this->u_action));
}
}
- $template->assign_vars(array(
+ $template->assign_vars([
'ALLTHANKS' => $all_thanks,
'POSTSTHANKS' => $all_posts_thanks,
'USERSTHANKS' => $all_users_thanks,
@@ -84,6 +97,6 @@ function main($id, $mode)
'USERSEND' => $end_users_thanks,
'THANKSEND' => $end_thanks,
'S_TRUNCATE' => $truncate,
- ));
+ ]);
}
}
diff --git a/config/services.yml b/config/services.yml
index 7cd1609..71d78e3 100644
--- a/config/services.yml
+++ b/config/services.yml
@@ -13,6 +13,7 @@ services:
- '@cache.driver'
- '@request'
- '@controller.helper'
+ - '@language'
- '%core.root_path%'
- '%core.php_ext%'
- '@gfksx.thanksforposts.helper'
@@ -31,9 +32,9 @@ services:
- '@notification_manager'
- '@controller.helper'
- '@dispatcher'
+ - '@language'
- '%core.root_path%'
- '%core.php_ext%'
- - '%core.table_prefix%'
- '%tables.thanks%'
- '%tables.users%'
- '%tables.posts%'
@@ -52,7 +53,9 @@ services:
- '@profilefields.manager'
- '@request'
- '@controller.helper'
+ - '%tables.posts%'
- '%tables.thanks%'
+ - '%tables.sessions%'
- '%tables.users%'
- '%core.root_path%'
- '%core.php_ext%'
@@ -72,6 +75,7 @@ services:
- '@gfksx.thanksforposts.helper'
- '@request'
- '@controller.helper'
+ - '%tables.forums%'
- '%tables.thanks%'
- '%tables.users%'
- '%tables.posts%'
diff --git a/controller/thankslist.php b/controller/thankslist.php
index b66b522..b36ccb4 100644
--- a/controller/thankslist.php
+++ b/controller/thankslist.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\controller;
@@ -45,6 +47,12 @@ class thankslist
/** @var \phpbb\controller\helper */
protected $controller_helper;
+ /** @var string POSTS_TABLE */
+ protected $posts_table;
+
+ /** @var string SESSIONS_TABLE */
+ protected $sessions_table;
+
/** @var string THANKS_TABLE */
protected $thanks_table;
@@ -71,13 +79,28 @@ class thankslist
* @param \phpbb\profilefields\manager $profilefields_manager Profile fields manager object
* @param \phpbb\request\request_interface $request Request object
* @param \phpbb\controller\helper $controller_helper Controller helper object
+ * @param string $posts_table POSTS_TABLE
+ * @param string $sessions_table SESSIONS_TABLE
* @param string $thanks_table THANKS_TABLE
* @param string $users_table USERS_TABLE
* @param string $phpbb_root_path phpbb_root_path
* @param string $php_ext phpEx
* @access public
*/
- public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\language\language $language, \phpbb\cache\driver\driver_interface $cache, \phpbb\pagination $pagination, \phpbb\profilefields\manager $profilefields_manager, \phpbb\request\request_interface $request, \phpbb\controller\helper $controller_helper, $thanks_table, $users_table, $phpbb_root_path, $php_ext)
+ public function __construct(
+ \phpbb\config\config $config,
+ \phpbb\db\driver\driver_interface $db,
+ \phpbb\auth\auth $auth,
+ \phpbb\template\template $template,
+ \phpbb\user $user,
+ \phpbb\language\language $language,
+ \phpbb\cache\driver\driver_interface $cache,
+ \phpbb\pagination $pagination,
+ \phpbb\profilefields\manager $profilefields_manager,
+ \phpbb\request\request_interface $request,
+ \phpbb\controller\helper $controller_helper,
+ $posts_table, $thanks_table, $sessions_table, $users_table, $phpbb_root_path, $php_ext
+ )
{
$this->config = $config;
$this->db = $db;
@@ -86,14 +109,16 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive
$this->user = $user;
$this->language = $language;
$this->cache = $cache;
- $this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
$this->pagination = $pagination;
$this->profilefields_manager = $profilefields_manager;
$this->request = $request;
$this->controller_helper = $controller_helper;
+ $this->sessions_table = $sessions_table;
$this->thanks_table = $thanks_table;
$this->users_table = $users_table;
+ $this->posts_table = $posts_table;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
}
public function main($mode, $author_id, $give)
@@ -103,10 +128,10 @@ public function main($mode, $author_id, $give)
// Grab data
$row_number = $total_users = 0;
- $givens = $reseved = $rowsp = $rowsu = $words = $where = array();
+ $givens = $reseved = $rowsp = $rowsu = $words = $where = [];
$sthanks = false;
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
- $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : false;
+ $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : false;
if (!$this->auth->acl_gets('u_viewthanks'))
{
@@ -114,8 +139,9 @@ public function main($mode, $author_id, $give)
{
trigger_error('NO_VIEW_USERS_THANKS');
}
- login_box('', ((isset($this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $this->user->lang['LOGIN_EXPLAIN_MEMBERLIST']));
+ login_box('', $this->language->lang('LOGIN_EXPLAIN_' . strtoupper($mode)));
}
+
$top = $this->request->variable('top', 0);
$start = $this->request->variable('start', 0);
$default_key = 'a';
@@ -129,30 +155,29 @@ public function main($mode, $author_id, $give)
{
case 'givens':
$per_page = $this->config['posts_per_page'];
- $page_title = $this->user->lang['SEARCH'];
+ $page_title = $this->language->lang('SEARCH');
$template_html = 'thanks_results.html';
switch ($give)
{
case 'true':
- $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $author_id, 'give' => 'true', 'tslash' => ''));
+ $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $author_id, 'give' => 'true', 'tslash' => '']);
- $sql = 'SELECT COUNT(user_id) AS total_match_count
- FROM ' . $this->thanks_table . '
- WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND user_id = ' . (int) $author_id;
- $where = 'user_id';
+ $sql = 'SELECT COUNT(user_id) AS total_match_count
+ FROM ' . $this->thanks_table . '
+ WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND user_id = ' . (int) $author_id;
+ $where = 'user_id';
break;
case 'false':
- $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $author_id, 'give' => 'false', 'tslash' => ''));
+ $u_search = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $author_id, 'give' => 'false', 'tslash' => '']);
- $sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count
- FROM ' . $this->thanks_table . '
- WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND poster_id = ' . (int) $author_id;
- $where = 'poster_id';
+ $sql = 'SELECT COUNT(DISTINCT post_id) as total_match_count
+ FROM ' . $this->thanks_table . '
+ WHERE (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0) AND poster_id = ' . (int) $author_id;
+ $where = 'poster_id';
break;
}
-
$result = $this->db->sql_query($sql);
if (!$row = $this->db->sql_fetchrow($result))
@@ -164,19 +189,21 @@ public function main($mode, $author_id, $give)
$total_match_count = (int) $row['total_match_count'];
$this->db->sql_freeresult($result);
- $sql_array = array(
+ $sql_array = [
'SELECT' => 'u.username, u.user_colour, p.poster_id, p.post_id, p.topic_id, p.forum_id, p.post_time, p.post_subject, p.post_text, p.post_username, p.bbcode_bitfield, p.bbcode_uid, p.post_attachment, p.enable_bbcode, p. enable_smilies, p.enable_magic_url',
- 'FROM' => array ($this->thanks_table => 't'),
- 'WHERE' => '('. $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0) AND t.' . $where . ' = ' . (int) $author_id,
- );
- $sql_array['LEFT_JOIN'][] = array(
- 'FROM' => array($this->users_table => 'u'),
- 'ON' => 't.poster_id = u.user_id'
- );
- $sql_array['LEFT_JOIN'][] = array(
- 'FROM' => array(POSTS_TABLE => 'p'),
- 'ON' => 't.post_id = p.post_id'
- );
+ 'FROM' => [$this->thanks_table => 't'],
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [$this->users_table => 'u'],
+ 'ON' => 't.poster_id = u.user_id',
+ ],
+ [
+ 'FROM' => [$this->posts_table => 'p'],
+ 'ON' => 't.post_id = p.post_id',
+ ],
+ ],
+ 'WHERE' => '(' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0) AND t.' . $where . ' = ' . (int) $author_id,
+ ];
$sql = $this->db->sql_build_query('SELECT_DISTINCT', $sql_array);
$result = $this->db->sql_query_limit($sql, $per_page, $start);
@@ -192,10 +219,11 @@ public function main($mode, $author_id, $give)
// We pre-process some variables here for later usage
$row['post_text'] = censor_text($row['post_text']);
$text_only_message = $row['post_text'];
- // make list items visible as such
+
+ // Make list items visible as such
if ($row['bbcode_uid'])
{
- // no BBCode in text only message
+ // No BBCode in text only message
strip_bbcode($text_only_message, $row['bbcode_uid']);
}
@@ -219,8 +247,8 @@ public function main($mode, $author_id, $give)
if ($row['display_text_only'])
{
- // limit the message length to return_chars value
- $row['post_text'] = get_context($row['post_text'], array(), $return_chars);
+ // Limit the message length to return_chars value
+ $row['post_text'] = get_context($row['post_text'], [], $return_chars);
$row['post_text'] = bbcode_nl2br($row['post_text']);
}
else
@@ -229,48 +257,48 @@ public function main($mode, $author_id, $give)
$row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags);
}
- $this->template->assign_block_vars('searchresults', array (
- 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
- 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
- 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
- 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
+ $this->template->assign_block_vars('searchresults', [
+ 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
+ 'POST_AUTHOR_COLOUR'=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
+ 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
+ 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_SUBJECT' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['post_subject'] : ((!empty($row['forum_id'])) ? '' : $row['post_subject']),
'POST_DATE' => (!empty($row['post_time'])) ? $this->user->format_date($row['post_time']) : '',
- 'MESSAGE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['post_text']),
+ 'MESSAGE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : $row['post_text']),
'FORUM_ID' => $row['forum_id'],
'TOPIC_ID' => $row['topic_id'],
'POST_ID' => $row['post_id'],
'U_VIEW_TOPIC' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 't=' . $row['topic_id']),
'U_VIEW_FORUM' => append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext", 'f=' . $row['forum_id']),
'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "t=" . $row['topic_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'] : '',
- ));
+ ]);
}
while ($row = $this->db->sql_fetchrow($result));
-
$this->db->sql_freeresult($result);
}
}
+
if ($total_match_count > 1000)
{
$total_match_count--;
- $l_search_matches = $this->user->lang('FOUND_MORE_SEARCH_MATCHES', $total_match_count);
+ $l_search_matches = $this->language->lang('FOUND_MORE_SEARCH_MATCHES', $total_match_count);
}
else
{
- $l_search_matches = $this->user->lang('FOUND_SEARCH_MATCHES', $total_match_count);
+ $l_search_matches = $this->language->lang('FOUND_SEARCH_MATCHES', $total_match_count);
}
$this->pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start);
- $this->template->assign_vars(array(
+ $this->template->assign_vars([
'PAGE_NUMBER' => $this->pagination->on_page($total_match_count, $per_page, $start),
'TOTAL_MATCHES' => $total_match_count,
'SEARCH_MATCHES' => $l_search_matches,
- 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('tslash' => '')),
- ));
+ 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['tslash' => '']),
+ ]);
break;
default:
- $page_title = $this->user->lang['THANKS_USER'];
+ $page_title = $this->language->lang('THANKS_USER');
$template_html = 'thankslist_body.html';
// Grab relevant data thanks
@@ -279,6 +307,7 @@ public function main($mode, $author_id, $give)
WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0
GROUP BY user_id';
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$givens[$row['user_id']] = $row['tally'];
@@ -290,6 +319,7 @@ public function main($mode, $author_id, $give)
WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0
GROUP BY poster_id';
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$reseved[$row['poster_id']] = $row['tally'];
@@ -297,12 +327,27 @@ public function main($mode, $author_id, $give)
$this->db->sql_freeresult($result);
// Sorting
- $sort_key_text = array('a' => $this->user->lang['SORT_USERNAME'], 'b' => $this->user->lang['SORT_LOCATION'], 'c' => $this->user->lang['SORT_JOINED'], 'd' => $this->user->lang['SORT_POST_COUNT'], 'e' => 'R_THANKS', 'f' => 'G_THANKS',);
- $sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'e' => 'count_thanks', 'f' => 'count_thanks');
+ $sort_key_text = [
+ 'a' => $this->language->lang('SORT_USERNAME'),
+ 'b' => $this->language->lang('SORT_LOCATION'),
+ 'c' => $this->language->lang('SORT_JOINED'),
+ 'd' => $this->language->lang('SORT_POST_COUNT'),
+ 'e' => 'R_THANKS',
+ 'f' => 'G_THANKS',
+ ];
+
+ $sort_key_sql = [
+ 'a' => 'u.username_clean',
+ 'b' => 'u.user_from',
+ 'c' => 'u.user_regdate',
+ 'd' => 'u.user_posts',
+ 'e' => 'count_thanks',
+ 'f' => 'count_thanks',
+ ];
if ($this->auth->acl_get('u_viewonline'))
{
- $sort_key_text['l'] = $this->user->lang['SORT_LAST_ACTIVE'];
+ $sort_key_text['l'] = $this->language->lang('SORT_LAST_ACTIVE');
$sort_key_sql['l'] = 'u.user_lastvisit';
}
@@ -315,11 +360,12 @@ public function main($mode, $author_id, $give)
$order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
// Build a relevant pagination_url
- $params = array();
- $check_params = array(
- 'sk' => array('sk', $default_key),
- 'sd' => array('sd', 'a'),
- );
+ $params = [];
+ $check_params = [
+ 'sk' => ['sk', $default_key],
+ 'sd' => ['sd', 'a'],
+ ];
+
foreach ($check_params as $key => $call)
{
if (!$this->request->is_set($key))
@@ -336,7 +382,7 @@ public function main($mode, $author_id, $give)
$sort_params[] = $param;
}
}
- $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array_merge($params, array('tslash' => '')));
+ $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array_merge($params, ['tslash' => '']));
// Grab relevant data
$sql = 'SELECT DISTINCT poster_id
@@ -382,17 +428,17 @@ public function main($mode, $author_id, $give)
break;
}
- $sql_array = array(
+ $sql_array = [
'SELECT' => 'u.*',
- 'FROM' => array($this->users_table => 'u'),
+ 'FROM' => [$this->users_table => 'u'],
'ORDER_BY' => $order_by,
- );
+ ];
if ($top)
{
$total_users = $top;
$start = 0;
- $page_title = $this->user->lang['REPUT_TOPLIST'];
+ $page_title = $this->language->lang('REPUT_TOPLIST');
}
else
{
@@ -401,17 +447,21 @@ public function main($mode, $author_id, $give)
if ($sortparam)
{
- $sql_array['FROM'] = array($this->thanks_table => 't');
- $sql_array['SELECT'].= ', count(t.'.$sortparam.'_id) as count_thanks';
- $sql_array['LEFT_JOIN'][] = array(
- 'FROM' => array($this->users_table => 'u'),
- 'ON' => 't.'.$sortparam.'_id = u.user_id'
- );
- $sql_array['GROUP_BY'] = 't.'.$sortparam.'_id';
+ $sql_array = [
+ 'FROM' => [$this->thanks_table => 't'],
+ 'SELECT' => $sql_array['SELECT'] .= ', count(t . ' . $sortparam . '_id) as count_thanks',
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [$this->users_table => 'u'],
+ 'ON' => 't . ' . $sortparam . '_id = u.user_id',
+ ],
+ ],
+ 'GROUP_BY' => 't.' . $sortparam.'_id',
+ ];
}
$where[] = $rows[0];
- for ($i = 1, $end = sizeof($rows); $i < $end; ++$i)
+ for ($i = 1, $end = count($rows); $i < $end; ++$i)
{
$where[] = $rows[$i];
}
@@ -426,25 +476,24 @@ public function main($mode, $author_id, $give)
else
{
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
- FROM ' . SESSIONS_TABLE . '
- WHERE session_time >= ' . (time() - $this->config['session_length']) . '
+ FROM ' . $this->sessions_table . '
+ WHERE session_time >= ' . (time() - (int) $this->config['session_length']) . '
AND ' . $this->db->sql_in_set('session_user_id', $where) . '
GROUP BY session_user_id';
$result_sessions = $this->db->sql_query($sql);
- $session_times = array();
+ $session_times = [];
while ($session = $this->db->sql_fetchrow($result_sessions))
{
$session_times[$session['session_user_id']] = $session['session_time'];
}
$this->db->sql_freeresult($result_sessions);
- $user_list = array();
- $id_cache = array();
+ $user_list = $id_cache = [];
do
{
- $row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0;
- $row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit'];
+ $row['session_time'] = (!empty($session_times[$row['user_id']])) ? (int) $session_times[$row['user_id']] : 0;
+ $row['last_visit'] = (!empty($row['session_time'])) ? (int) $row['session_time'] : (int) $row['user_lastvisit'];
$user_list[] = (int) $row['user_id'];
$id_cache[$row['user_id']] = $row;
}
@@ -476,8 +525,7 @@ public function main($mode, $author_id, $give)
}
}
- //do
- for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i)
+ for ($i = 0, $end = count($user_list); $i < $end; ++$i)
{
$user_id = $user_list[$i];
$row = $id_cache[$user_id];
@@ -491,28 +539,28 @@ public function main($mode, $author_id, $give)
get_user_rank($row['user_rank'], (($user_id == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src);
// Custom Profile Fields
- $cp_row = array();
- if ($this->config['load_cpf_memberlist'])
+ $cp_row = [];
+ if ($this->config['load_cpf_memberlist'] && isset($profile_fields_cache[$user_id]))
{
- $cp_row = isset($profile_fields_cache[$user_id]) ? $this->profilefields_manager->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array();
+ $cp_row = $this->profilefields_manager->generate_profile_fields_template_data($profile_fields_cache[$user_id], false);
}
- $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array(
+ $memberrow = array_merge(phpbb_show_profile($row, false, false, false), [
'ROW_NUMBER' => $row_number + ($start + 1),
'GIVENS' => (!isset($givens[$user_id])) ? 0 : $givens[$user_id],
'RECEIVED' => (!isset($reseved[$user_id])) ? 0 : $reseved[$user_id],
- 'U_SEARCH_USER_GIVENS' => ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'true', 'tslash' => '')) : '',
- 'U_SEARCH_USER_RECEIVED'=> ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'false', 'tslash' => '')) : ''
- ));
+ 'U_SEARCH_USER_GIVENS' => ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $user_id, 'give' => 'true', 'tslash' => '']) : '',
+ 'U_SEARCH_USER_RECEIVED'=> ($this->auth->acl_get('u_search')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $user_id, 'give' => 'false', 'tslash' => '']) : ''
+ ]);
- if (isset($cp_row['row']) && sizeof($cp_row['row']))
+ if (isset($cp_row['row']) && count($cp_row['row']))
{
$memberrow = array_merge($memberrow, $cp_row['row']);
}
$this->template->assign_block_vars('memberrow', $memberrow);
- if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow']))
+ if (isset($cp_row['blockrow']) && count($cp_row['blockrow']))
{
foreach ($cp_row['blockrow'] as $field_data)
{
@@ -522,27 +570,27 @@ public function main($mode, $author_id, $give)
$row_number++;
}
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $this->config['topics_per_page'], $start);
- $this->template->assign_vars(array(
- 'PAGE_NUMBER' => $this->pagination->on_page($total_users, $this->config['topics_per_page'], $start),
- 'U_SORT_POSTS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'd', 'sd' => (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')),
- 'U_SORT_USERNAME' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'a', 'sd' => (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')),
- 'U_SORT_FROM' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'b', 'sd' => (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')),
- 'U_SORT_JOINED' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'c', 'sd' => (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')),
- 'U_SORT_THANKS_R' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'e', 'sd' => (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'), 'tslash' => '')),
- 'U_SORT_THANKS_G' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'f', 'sd' => (($sort_key == 'f' && $sort_dir == 'd') ? 'a' : 'd'), 'tslash' => '')),
- 'U_SORT_ACTIVE' => ($this->auth->acl_get('u_viewonline')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('mode' => $mode, 'sk' => 'l', 'sd' => (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '')) : '',
- 'S_VIEWONLINE' => $this->auth->acl_get('u_viewonline')
- ));
+ $this->template->assign_vars([
+ 'PAGE_NUMBER' => $this->pagination->on_page($total_users, $this->config['topics_per_page'], $start),
+ 'U_SORT_POSTS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'd', 'sd' => (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '']),
+ 'U_SORT_USERNAME' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'a', 'sd' => (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '']),
+ 'U_SORT_FROM' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'b', 'sd' => (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '']),
+ 'U_SORT_JOINED' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'c', 'sd' => (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '']),
+ 'U_SORT_THANKS_R' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'e', 'sd' => (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'), 'tslash' => '']),
+ 'U_SORT_THANKS_G' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'f', 'sd' => (($sort_key == 'f' && $sort_dir == 'd') ? 'a' : 'd'), 'tslash' => '']),
+ 'U_SORT_ACTIVE' => ($this->auth->acl_get('u_viewonline')) ? $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['mode' => $mode, 'sk' => 'l', 'sd' => (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'), 'tslash' => '']) : '',
+ 'S_VIEWONLINE' => $this->auth->acl_get('u_viewonline'),
+ ]);
}
break;
}
// Output the page
- $this->template->assign_vars(array(
- 'TOTAL_USERS' => $this->user->lang('LIST_USERS', $total_users),
- 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('tslash' => '')),
+ $this->template->assign_vars([
+ 'TOTAL_USERS' => $this->language->lang('LIST_USERS', $total_users),
+ 'U_THANKS' => $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['tslash' => '']),
'S_THANKS' => $sthanks,
- ));
+ ]);
make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext"));
diff --git a/controller/toplist.php b/controller/toplist.php
index c79b5e4..0be8cfd 100644
--- a/controller/toplist.php
+++ b/controller/toplist.php
@@ -1,11 +1,14 @@
config = $config;
$this->db = $db;
@@ -95,6 +116,7 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive
$this->gfksx_helper = $gfksx_helper;
$this->request = $request;
$this->controller_helper = $controller_helper;
+ $this->forums_table = $forums_table;
$this->thanks_table = $thanks_table;
$this->users_table = $users_table;
$this->posts_table = $posts_table;
@@ -111,10 +133,10 @@ public function main()
$u_search_post = $u_search_topic = $u_search_forum = '';
$topic_id = $this->request->variable('t', 0);
$return_chars = $this->request->variable('ch', ($topic_id) ? -1 : 300);
- $words = array();
+ $words = [];
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
- $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : true;
- $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => $mode, 'tslash' => ''));
+ $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : true;
+ $pagination_url = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => $mode, 'tslash' => '']);
if (!$this->auth->acl_gets('u_viewtoplist'))
{
@@ -122,46 +144,51 @@ public function main()
{
trigger_error('RATING_NO_VIEW_TOPLIST');
}
- login_box('', ((isset($this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $this->user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $this->user->lang['RATING_LOGIN_EXPLAIN']));
+ login_box('', $this->language->lang('LOGIN_EXPLAIN_' . strtoupper($mode)));
}
+
$notoplist = true;
$start = $this->request->variable('start', 0);
$max_post_thanks = $this->config['thanks_post_reput_view'] ? $this->gfksx_helper->get_max_post_thanks() : 1;
$max_topic_thanks = $this->config['thanks_topic_reput_view'] ? $this->gfksx_helper->get_max_topic_thanks() : 1;
$max_forum_thanks = $this->config['thanks_forum_reput_view'] ? $this->gfksx_helper->get_max_forum_thanks() : 1;
+
switch ($mode)
{
case 'post':
- $sql = 'SELECT COUNT(DISTINCT post_id) as total_post_count
- FROM ' . $this->thanks_table .'
- WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true);
- $result = $this->db->sql_query($sql);
- $total_match_count = (int) $this->db->sql_fetchfield('total_post_count');
- $this->db->sql_freeresult($result);
- $full_post_rating = true;
- $notoplist = false;
+ $sql = 'SELECT COUNT(DISTINCT post_id) as total_post_count
+ FROM ' . $this->thanks_table .'
+ WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true);
+ $result = $this->db->sql_query($sql);
+ $total_match_count = (int) $this->db->sql_fetchfield('total_post_count');
+ $this->db->sql_freeresult($result);
+
+ $full_post_rating = true;
+ $notoplist = false;
break;
case 'topic':
- $sql = 'SELECT COUNT(DISTINCT topic_id) as total_topic_count
- FROM ' . $this->thanks_table .'
- WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true);
- $result = $this->db->sql_query($sql);
- $total_match_count = (int) $this->db->sql_fetchfield('total_topic_count');
- $this->db->sql_freeresult($result);
- $full_topic_rating = true;
- $notoplist = false;
+ $sql = 'SELECT COUNT(DISTINCT topic_id) as total_topic_count
+ FROM ' . $this->thanks_table .'
+ WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true);
+ $result = $this->db->sql_query($sql);
+ $total_match_count = (int) $this->db->sql_fetchfield('total_topic_count');
+ $this->db->sql_freeresult($result);
+
+ $full_topic_rating = true;
+ $notoplist = false;
break;
case 'forum':
- $sql = 'SELECT COUNT(DISTINCT forum_id) as total_forum_count
- FROM ' . $this->thanks_table .'
- WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true);
- $result = $this->db->sql_query($sql);
- $total_match_count = (int) $this->db->sql_fetchfield('total_forum_count');
- $this->db->sql_freeresult($result);
- $full_forum_rating = true;
- $notoplist = false;
+ $sql = 'SELECT COUNT(DISTINCT forum_id) as total_forum_count
+ FROM ' . $this->thanks_table .'
+ WHERE ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true);
+ $result = $this->db->sql_query($sql);
+ $total_match_count = (int) $this->db->sql_fetchfield('total_forum_count');
+ $this->db->sql_freeresult($result);
+
+ $full_forum_rating = true;
+ $notoplist = false;
break;
default:
@@ -169,32 +196,38 @@ public function main()
break;
}
- $page_title = $this->user->lang('REPUT_TOPLIST', $total_match_count);
+ $page_title = $this->language->lang('REPUT_TOPLIST', $total_match_count);
- //post rating
+ // Post rating
if (!$full_forum_rating && !$full_topic_rating && $this->config['thanks_post_reput_view'])
{
$end = ($full_post_rating) ? $this->config['topics_per_page'] : $this->config['thanks_number_row_reput'];
- $sql_p_array['FROM'] = array($this->thanks_table => 't');
- $sql_p_array['SELECT'] = 'u.user_id, u.username, u.user_colour, p.post_subject, p.post_id, p.post_time, p.poster_id, p.post_username, p.topic_id, p.forum_id, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.post_attachment';
- $sql_p_array['SELECT'] .= ', t.post_id, COUNT(*) AS post_thanks';
- $sql_p_array['LEFT_JOIN'][] = array(
- 'FROM' => array ($this->posts_table => 'p'),
- 'ON' => 't.post_id = p.post_id',
- );
- $sql_p_array['LEFT_JOIN'][] = array(
- 'FROM' => array($this->users_table => 'u'),
- 'ON' => 'p.poster_id = u.user_id'
- );
- $sql_p_array['GROUP_BY'] = 't.post_id, u.user_id, p.post_subject, p.post_id';
- $sql_p_array['ORDER_BY'] = 'post_thanks DESC';
- $sql_p_array['WHERE'] = $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true);
+ $sql_p_array = [
+ 'FROM' => [$this->thanks_table => 't'],
+ 'SELECT' => 'u.user_id, u.username, u.user_colour,
+ p.post_subject, p.post_id, p.post_time, p.poster_id, p.post_username,
+ p.topic_id, p.forum_id, p.post_text, p.bbcode_uid, p.bbcode_bitfield,
+ p.post_attachment, t.post_id, COUNT(*) AS post_thanks',
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [$this->posts_table => 'p'],
+ 'ON' => 't.post_id = p.post_id',
+ ],
+ [
+ 'FROM' => [$this->users_table => 'u'],
+ 'ON' => 'p.poster_id = u.user_id',
+ ],
+ ],
+ 'WHERE' => $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true),
+ 'GROUP_BY' => 't.post_id, u.user_id, p.post_subject, p.post_id',
+ 'ORDER_BY' => 'post_thanks DESC',
+ ];
$sql = $this->db->sql_build_query('SELECT',$sql_p_array);
$result = $this->db->sql_query_limit($sql, $end, $start);
- $u_search_post = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => 'post', 'tslash' => ''));
+ $u_search_post = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => 'post', 'tslash' => '']);
if (!$row = $this->db->sql_fetchrow($result))
{
@@ -209,11 +242,13 @@ public function main()
// We pre-process some variables here for later usage
$row['post_text'] = censor_text($row['post_text']);
$text_only_message = $row['post_text'];
- // make list items visible as such
+
+ // Make list items visible as such
if ($row['bbcode_uid'])
{
$text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $text_only_message);
- // no BBCode in text only message
+
+ // No BBCode in text only message
strip_bbcode($text_only_message, $row['bbcode_uid']);
}
@@ -237,11 +272,12 @@ public function main()
unset($text_only_message);
// Instantiate BBCode if needed
- if ($bbcode_bitfield !== '' and !class_exists('bbcode'))
+ if ($bbcode_bitfield !== '' && !class_exists('bbcode'))
{
include($this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext);
$bbcode = new \bbcode(base64_encode($bbcode_bitfield));
}
+
// Replace naughty words such as farty pants
$row['post_subject'] = censor_text($row['post_subject']);
@@ -263,50 +299,57 @@ public function main()
}
$post_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $row['post_id'] . '#p' . $row['post_id']);
- $this->template->assign_block_vars('toppostrow', array(
- 'MESSAGE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['post_text']),
+ $this->template->assign_block_vars('toppostrow', [
+ 'MESSAGE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_text'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''),
'POST_DATE' => !empty($row['post_time']) ? $this->user->format_date($row['post_time']) : '',
- 'MINI_POST_IMG' => phpbb_version_compare(PHPBB_VERSION, '3.2.0', '<') ? $this->user->img('icon_post_target', 'POST') : '',
'POST_ID' => $post_url,
- 'POST_SUBJECT' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_subject'] : ((!empty($row['forum_id'])) ? '' : $row['post_subject']),
+ 'POST_SUBJECT' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_subject'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''),
'POST_AUTHOR' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
- 'POST_REPUT' => round($row['post_thanks'] / ($max_post_thanks / 100), $this->config['thanks_number_digits']) . '%',
+ 'POST_REPUT' => round($row['post_thanks'] / ($max_post_thanks / 100), (int) $this->config['thanks_number_digits']) . '%',
'POST_THANKS' => $row['post_thanks'],
- 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false,
- 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false,
+ 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']),
+ 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']),
'THANKS_REPUT_HEIGHT' => (int) $this->config['thanks_reput_height'],
- 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level']*$this->config['thanks_reput_height'],
+ 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'],
'THANKS_REPUT_IMAGE' => isset($this->config['thanks_reput_image']) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '',
'THANKS_REPUT_IMAGE_BACK' => isset($this->config['thanks_reput_image_back']) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '',
- ));
+ ]);
}
while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
}
}
- //topic rating
+
+ // Topic rating
if (!$full_forum_rating && !$full_post_rating && $this->config['thanks_topic_reput_view'])
{
$end = ($full_topic_rating) ? $this->config['topics_per_page'] : $this->config['thanks_number_row_reput'];
- $sql_t_array['FROM'] = array($this->thanks_table => 'f');
- $sql_t_array['SELECT'] = 'u.user_id, u.username, u.user_colour, t.topic_title, t.topic_id, t.topic_time, t.topic_poster, t.topic_first_poster_name, t.topic_first_poster_colour, t.forum_id, t.topic_type, t.topic_status, t.poll_start';
- $sql_t_array['SELECT'] .= ', f.topic_id, COUNT(*) AS topic_thanks';
- $sql_t_array['LEFT_JOIN'][] = array(
- 'FROM' => array (TOPICS_TABLE => 't'),
- 'ON' => 'f.topic_id = t.topic_id',
- );
- $sql_t_array['LEFT_JOIN'][] = array(
- 'FROM' => array($this->users_table => 'u'),
- 'ON' => 't.topic_poster = u.user_id'
- );
- $sql_t_array['GROUP_BY'] = 'f.topic_id, u.user_id, t.topic_title, t.topic_id';
- $sql_t_array['ORDER_BY'] = 'topic_thanks DESC';
- $sql_t_array['WHERE'] = $this->db->sql_in_set('f.forum_id', $ex_fid_ary, true);
+ $sql_t_array = [
+ 'FROM' => [$this->thanks_table => 'f'],
+ 'SELECT' => 'u.user_id, u.username, u.user_colour, t.topic_title,
+ t.topic_id, t.topic_time, t.topic_poster, t.topic_first_poster_name,
+ t.topic_first_poster_colour, t.forum_id, t.topic_type, t.topic_status,
+ t.poll_start, f.topic_id, COUNT(*) AS topic_thanks',
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [TOPICS_TABLE => 't'],
+ 'ON' => 'f.topic_id = t.topic_id',
+ ],
+ [
+ 'FROM' => [$this->users_table => 'u'],
+ 'ON' => 't.topic_poster = u.user_id',
+ ],
+ ],
+ 'WHERE' => $this->db->sql_in_set('f.forum_id', $ex_fid_ary, true),
+ 'GROUP_BY' => 'f.topic_id, u.user_id, t.topic_title, t.topic_id',
+ 'ORDER_BY' => 'topic_thanks DESC',
+ ];
$sql = $this->db->sql_build_query('SELECT',$sql_t_array);
$result = $this->db->sql_query_limit($sql, $end, $start);
- $u_search_topic = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => 'topic', 'tslash' => ''));
+ $u_search_topic = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => 'topic', 'tslash' => '']);
+
if (!$row = $this->db->sql_fetchrow($result))
{
trigger_error('RATING_VIEW_TOPLIST_NO');
@@ -322,48 +365,54 @@ public function main()
{
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
}
+
topic_status($row, 0, false, $folder_img, $folder_alt, $topic_type);
$view_topic_url_params = 'f=' . (($row['forum_id']) ? $row['forum_id'] : '') . '&t=' . $row['topic_id'];
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", $view_topic_url_params);
- $this->template->assign_block_vars('toptopicrow', array(
+
+ $this->template->assign_block_vars('toptopicrow', [
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG_SRC' => $row['forum_id'] ? 'topic_read' : 'announce_read',
- 'TOPIC_TITLE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['topic_title'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['topic_title']),
+ 'TOPIC_TITLE' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['topic_title'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''),
'U_VIEW_TOPIC' => $view_topic_url,
'TOPIC_AUTHOR' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
'TOPIC_THANKS' => $row['topic_thanks'],
- 'TOPIC_REPUT' => round($row['topic_thanks'] / ($max_topic_thanks / 100), $this->config['thanks_number_digits']) . '%',
- 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']) ? $this->config['thanks_topic_reput_view'] : false,
- 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false,
+ 'TOPIC_REPUT' => round($row['topic_thanks'] / ($max_topic_thanks / 100), (int) $this->config['thanks_number_digits']) . '%',
+ 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']),
+ 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']),
'THANKS_REPUT_HEIGHT' => (int) $this->config['thanks_reput_height'],
- 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level']*$this->config['thanks_reput_height'],
+ 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'],
'THANKS_REPUT_IMAGE' => (isset($this->config['thanks_reput_image'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '',
'THANKS_REPUT_IMAGE_BACK' => (isset($this->config['thanks_reput_image_back'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '',
- ));
+ ]);
}
while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
}
}
- //forum rating
+
+ // Forum rating
if (!$full_topic_rating && !$full_post_rating && $this->config['thanks_forum_reput_view'])
{
- $end = ($full_forum_rating) ? $this->config['topics_per_page'] : $this->config['thanks_number_row_reput'];
-
- $sql_f_array['FROM'] = array($this->thanks_table => 't');
- $sql_f_array['SELECT'] = 'f.forum_name, f.forum_id';
- $sql_f_array['SELECT'] .= ', t.forum_id, COUNT(*) AS forum_thanks';
- $sql_f_array['LEFT_JOIN'][] = array(
- 'FROM' => array (FORUMS_TABLE => 'f'),
- 'ON' => 't.forum_id = f.forum_id',
- );
- $sql_f_array['GROUP_BY'] = 't.forum_id, f.forum_name, f.forum_id';
- $sql_f_array['ORDER_BY'] = 'forum_thanks DESC';
- $sql_f_array['WHERE'] = $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true);
+ $end = ($full_forum_rating) ? (int) $this->config['topics_per_page'] : (int) $this->config['thanks_number_row_reput'];
+
+ $sql_f_array = [
+ 'FROM' => [$this->thanks_table => 't'],
+ 'SELECT' => 'f.forum_name, f.forum_id, t.forum_id, COUNT(*) AS forum_thanks',
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [$this->forums_table => 'f'],
+ 'ON' => 't.forum_id = f.forum_id',
+ ],
+ ],
+ 'WHERE' => $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true),
+ 'GROUP_BY' => 't.forum_id, f.forum_name, f.forum_id',
+ 'ORDER_BY' => 'forum_thanks DESC',
+ ];
$sql = $this->db->sql_build_query('SELECT',$sql_f_array);
$result = $this->db->sql_query_limit($sql, $end, $start);
- $u_search_forum = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('mode' => 'forum', 'tslash' => ''));
+ $u_search_forum = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['mode' => 'forum', 'tslash' => '']);
if (!$row = $this->db->sql_fetchrow($result))
{
@@ -378,48 +427,49 @@ public function main()
{
$u_viewforum = append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext", 'f=' . $row['forum_id']);
$folder_image = 'forum_read';
- $this->template->assign_block_vars('topforumrow', array(
+ $this->template->assign_block_vars('topforumrow', [
'FORUM_FOLDER_IMG_SRC' => $this->user->img('forum_read', 'NO_NEW_POSTS', false, '', 'src'),
'FORUM_IMG_STYLE' => $folder_image,
- 'FORUM_NAME' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['forum_name'] : ((!empty($row['forum_id'])) ? $this->user->lang['SORRY_AUTH_READ'] : $row['forum_name']),
+ 'FORUM_NAME' => ($this->auth->acl_get('f_read', $row['forum_id'])) ? $row['forum_name'] : ((!empty($row['forum_id'])) ? $this->language->lang('SORRY_AUTH_READ') : ''),
'U_VIEW_FORUM' => $u_viewforum,
'FORUM_THANKS' => $row['forum_thanks'],
- 'FORUM_REPUT' => round($row['forum_thanks'] / ($max_forum_thanks / 100), $this->config['thanks_number_digits']) . '%',
- 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']) ? $this->config['thanks_forum_reput_view'] : false,
- 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false,
+ 'FORUM_REPUT' => round($row['forum_thanks'] / ($max_forum_thanks / 100), (int) $this->config['thanks_number_digits']) . '%',
+ 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']),
+ 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']),
'THANKS_REPUT_HEIGHT' => (int) $this->config['thanks_reput_height'],
- 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level']*$this->config['thanks_reput_height'],
+ 'THANKS_REPUT_GRAPHIC_WIDTH'=> (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'],
'THANKS_REPUT_IMAGE' => (isset($this->config['thanks_reput_image'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '',
'THANKS_REPUT_IMAGE_BACK' => (isset($this->config['thanks_reput_image_back'])) ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '',
- ));
+ ]);
}
}
while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
}
}
+
if ($notoplist)
{
trigger_error('RATING_VIEW_TOPLIST_NO');
}
- $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_match_count, $this->config['topics_per_page'], $start);
+ $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_match_count, (int) $this->config['topics_per_page'], $start);
// Output the page
- $this->template->assign_vars(array(
- 'PAGE_NUMBER' => $this->pagination->on_page($total_match_count, $this->config['posts_per_page'], $start),
+ $this->template->assign_vars([
+ 'PAGE_NUMBER' => $this->pagination->on_page($total_match_count, (int) $this->config['posts_per_page'], $start),
'PAGE_TITLE' => $page_title,
'PHPBB_VERSION' => phpbb_version_compare(PHPBB_VERSION, '3.2.0', '>=') ? '3.2' : '3.1',
- 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']) ? $this->config['thanks_forum_reput_view'] : false,
- 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']) ? $this->config['thanks_topic_reput_view'] : false,
- 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false,
+ 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']),
+ 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']),
+ 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']),
'S_FULL_POST_RATING' => $full_post_rating,
'S_FULL_TOPIC_RATING' => $full_topic_rating,
'S_FULL_FORUM_RATING' => $full_forum_rating,
'U_SEARCH_POST' => $u_search_post,
'U_SEARCH_TOPIC' => $u_search_topic,
'U_SEARCH_FORUM' => $u_search_forum,
- ));
+ ]);
make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.$this->php_ext"));
diff --git a/core/helper.php b/core/helper.php
index 4ee1f2e..87b96ab 100644
--- a/core/helper.php
+++ b/core/helper.php
@@ -1,22 +1,24 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\core;
class helper
{
/** @var array thankers */
- protected $thankers = array();
+ protected $thankers = [];
/** @var array forum_thanks */
- protected $forum_thanks = array();
+ protected $forum_thanks = [];
/** @var int max_post_thanks */
protected $max_post_thanks;
@@ -60,15 +62,15 @@ class helper
/** @var \phpbb\event\dispatcher_interface */
protected $phpbb_dispatcher;
+ /** @var \phpbb\language\language */
+ protected $language;
+
/** @var string phpbb_root_path */
protected $phpbb_root_path;
/** @var string phpEx */
protected $php_ext;
- /** @var string table_prefix */
- protected $table_prefix;
-
/** @var string THANKS_TABLE */
protected $thanks_table;
@@ -82,28 +84,41 @@ class helper
protected $notifications_table;
/**
- * Constructor
- *
- * @param \phpbb\config\config $config Config object
- * @param \phpbb\db\driver\driver_interface $db DBAL object
- * @param \phpbb\auth\auth $auth User object
- * @param \phpbb\template\template $template Template object
- * @param \phpbb\user $user User object
- * @param \phpbb\cache\driver\driver_interface $cache Cache driver object
- * @param \phpbb\request\request_interface $request Request object
- * @param \phpbb\request\request_interface $request Request object
- * @param \phpbb\controller\helper $controller_helper Controller helper object
- * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
- * @param string $phpbb_root_path phpbb_root_path
- * @param string $php_ext phpEx
- * @param string $table_prefix Tables prefix
- * @param string $thanks_table THANKS_TABLE
- * @param string $users_table USERS_TABLE
- * @param string $posts_table POSTS_TABLE
- * @param string $notifications_table NOTIFICATIONS_TABLE
- * @access public
- */
- public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\request\request_interface $request, \phpbb\notification\manager $notification_manager, \phpbb\controller\helper $controller_helper, \phpbb\event\dispatcher_interface $phpbb_dispatcher, $phpbb_root_path, $php_ext, $table_prefix, $thanks_table, $users_table, $posts_table, $notifications_table)
+ * Constructor
+ *
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver_interface $db DBAL object
+ * @param \phpbb\auth\auth $auth User object
+ * @param \phpbb\template\template $template Template object
+ * @param \phpbb\user $user User object
+ * @param \phpbb\cache\driver\driver_interface $cache Cache driver object
+ * @param \phpbb\request\request_interface $request Request object
+ * @param \phpbb\request\request_interface $request Request object
+ * @param \phpbb\controller\helper $controller_helper Controller helper object
+ * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
+ * @param \phpbb\language\language $language Language object
+ * @param string $phpbb_root_path phpbb_root_path
+ * @param string $php_ext phpEx
+ * @param string $thanks_table THANKS_TABLE
+ * @param string $users_table USERS_TABLE
+ * @param string $posts_table POSTS_TABLE
+ * @param string $notifications_table NOTIFICATIONS_TABLE
+ * @access public
+ */
+ public function __construct(
+ \phpbb\config\config $config,
+ \phpbb\db\driver\driver_interface $db,
+ \phpbb\auth\auth $auth,
+ \phpbb\template\template $template,
+ \phpbb\user $user,
+ \phpbb\cache\driver\driver_interface $cache,
+ \phpbb\request\request_interface $request,
+ \phpbb\notification\manager $notification_manager,
+ \phpbb\controller\helper $controller_helper,
+ \phpbb\event\dispatcher_interface $phpbb_dispatcher,
+ \phpbb\language\language $language,
+ $phpbb_root_path, $php_ext, $thanks_table, $users_table, $posts_table, $notifications_table
+ )
{
$this->config = $config;
$this->db = $db;
@@ -115,9 +130,9 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive
$this->notification_manager = $notification_manager;
$this->controller_helper = $controller_helper;
$this->phpbb_dispatcher = $phpbb_dispatcher;
+ $this->language = $language;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
- $this->table_prefix = $table_prefix;
$this->thanks_table = $thanks_table;
$this->users_table = $users_table;
$this->posts_table = $posts_table;
@@ -158,9 +173,10 @@ public function get_thanks($post_id)
if ($further_thanks > 0)
{
- $further_thanks_text = $this->user->lang('FURTHER_THANKS', $further_thanks);
+ $further_thanks_text = $this->language->lang('FURTHER_THANKS', $further_thanks);
}
$return = ($return == '') ? false : ($return . $further_thanks_text);
+
return $return;
}
@@ -182,34 +198,35 @@ public function insert_thanks($post_id, $user_id, $forum_id)
$to_id = $this->request->variable('to_id', 0);
$from_id = $this->request->variable('from_id', 0);
$row = $this->get_post_info($post_id);
+
if ($this->user->data['user_type'] != USER_IGNORE && !empty($to_id))
{
if ($row['poster_id'] != $user_id && $row['poster_id'] == $to_id && !$this->already_thanked($post_id, $user_id) && ($this->auth->acl_get('f_thanks', $row['forum_id']) || (!$row['forum_id'] && $this->config['thanks_global_post'])) && $from_id == $user_id)
{
- $thanks_data = array(
- 'user_id' => (int) $this->user->data['user_id'],
- 'post_id' => $post_id,
- 'poster_id' => $to_id,
- 'topic_id' => (int) $row['topic_id'],
- 'forum_id' => (int) $row['forum_id'],
+ $thanks_data = [
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'post_id' => $post_id,
+ 'poster_id' => $to_id,
+ 'topic_id' => (int) $row['topic_id'],
+ 'forum_id' => (int) $row['forum_id'],
'thanks_time' => time(),
- );
+ ];
$sql = 'INSERT INTO ' . $this->thanks_table . ' ' . $this->db->sql_build_array('INSERT', $thanks_data);
$this->db->sql_query($sql);
$lang_act = 'GIVE';
- $thanks_data = array_merge($thanks_data, array(
- 'username' => $this->user->data['username'],
- 'lang_act' => $lang_act,
+ $thanks_data = array_merge($thanks_data, [
+ 'username' => $this->user->data['username'],
+ 'lang_act' => $lang_act,
'post_subject' => $row['post_subject'],
- ));
+ ]);
$this->add_notification($thanks_data);
if ($this->config['thanks_info_page'])
{
meta_refresh (1, append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id .'&p=' . $post_id . '#p' . $post_id));
- trigger_error($this->user->lang['THANKS_INFO_'.$lang_act] . '
' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id .'&p=' . $post_id . '#p' . $post_id) . '">', ''));
+ trigger_error($this->language->lang('THANKS_INFO_' . $lang_act) . '
' . $this->language->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id .'&p=' . $post_id . '#p' . $post_id) . '">', ''));
}
else
{
@@ -218,146 +235,115 @@ public function insert_thanks($post_id, $user_id, $forum_id)
}
else if (!$row['forum_id'] && !$this->config['thanks_global_post'])
{
- trigger_error($this->user->lang['GLOBAL_INCORRECT_THANKS'] . '
' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', ''));
+ trigger_error($this->language->lang('GLOBAL_INCORRECT_THANKS') . '
' . $this->language->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', ''));
}
else
{
- trigger_error($this->user->lang['INCORRECT_THANKS'] . '
' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', ''));
+ trigger_error($this->language->lang('INCORRECT_THANKS') . '
' . $this->language->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $post_id . '#p' . $post_id) . '">', ''));
}
}
return;
}
- public function clear_list_thanks($object_id, $list_thanks = '')
+ public function clear_list_thanks($object_id, $mode = '')
{
- $s_hidden_fields = build_hidden_fields(array(
- 'list_thanks' => $list_thanks,
- )
- );
- $lang_act = $field_act = '';
- if (confirm_box(true))
+ if (empty($mode) || !in_array($mode, ['give', 'receive', 'post']))
{
- if (!empty($list_thanks) && $this->auth->acl_get('m_thanks'))
- {
- if ($list_thanks === 'give')
- {
- $lang_act = 'GIVE';
- $field_act = 'user_id';
- }
- else if ($list_thanks === 'receive')
- {
- $lang_act = 'RECEIVE';
- $field_act = 'poster_id';
- }
- else if ($list_thanks === 'post')
- {
- $lang_act = 'POST';
- $field_act = 'post_id';
- }
+ trigger_error($this->language->lang('INCORRECT_THANKS'));
+ }
- if (!empty($field_act))
- {
- $sql = "DELETE FROM " . $this->thanks_table . '
- WHERE ' . $field_act . ' = ' . (int) $object_id;
- $result = $this->db->sql_query($sql);
+ if (!$this->auth->acl_get('m_thanks'))
+ {
+ trigger_error($this->language->lang('NOT_AUTHORISED'));
+ }
- if ($result != 0)
- {
- if ($this->config['thanks_info_page'])
- {
- if ($list_thanks === 'post')
- {
- meta_refresh (1, append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id));
- trigger_error($this->user->lang['CLEAR_LIST_THANKS_' . $lang_act] . '
' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id) . '">', ''));
- }
- else
- {
- meta_refresh (1, append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id));
- trigger_error($this->user->lang['CLEAR_LIST_THANKS_'.$lang_act] . '
' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}memberlist.$this->php_ext",'mode=viewprofile&u=' . $object_id) . '">', ''));
- }
- }
- else
- {
- if ($list_thanks === 'post')
- {
- redirect(append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id));
- }
- else
- {
- redirect(append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id));
- }
- }
- }
- }
- }
- else
+ $s_hidden_fields = build_hidden_fields([
+ 'list_thanks' => $mode,
+ ]);
+
+ $redirect_url = append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . (string) $object_id);
+
+ switch ($mode)
+ {
+ case 'give':
+ $field_act = 'user_id';
+ break;
+
+ case 'receive':
+ $field_act = 'poster_id';
+ break;
+
+ case 'post':
+ $field_act = 'post_id';
+ $redirect_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . (string) $object_id . '#p' . (string) $object_id);
+ break;
+ }
+
+ if (confirm_box(true))
+ {
+ $sql = "DELETE FROM " . $this->thanks_table . '
+ WHERE ' . $field_act . ' = ' . (int) $object_id;
+
+ if ($this->db->sql_query($sql))
{
- if ($list_thanks === 'post')
+ if ($this->config['thanks_info_page'])
{
- trigger_error($this->user->lang['INCORRECT_THANKS'] . '
' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id) . '">', ''));
+ meta_refresh (1, $redirect_url);
+ trigger_error($this->language->lang('CLEAR_LIST_THANKS_' . strtoupper($mode)) . '
' . $this->language->lang('BACK_TO_PREV', '', ''));
}
else
{
- trigger_error($this->user->lang['INCORRECT_THANKS'] . '
' . $this->user->lang('BACK_TO_PREV', 'phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id) . '">', ''));
+ redirect($redirect_url);
}
}
}
else
{
confirm_box(false, 'CLEAR_LIST_THANKS', $s_hidden_fields);
- if ($list_thanks === 'post')
- {
- redirect(append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $object_id . '#p' . $object_id));
- }
- else
- {
- redirect(append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $object_id));
- }
+ redirect($redirect_url);
}
+
return;
}
public function delete_thanks($post_id, $forum_id)
{
$to_id = $this->request->variable('to_id', 0);
- $forum_id = ($forum_id) ?: $this->request->variable('f', 0);
- $row = $this->get_post_info($post_id);
- $hidden = build_hidden_fields(array(
+ $forum_id = ((int) $forum_id) ?: $this->request->variable('f', 0);
+ $row = $this->get_post_info((int) $post_id);
+ $redirect_url = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id");
+
+ $hidden = build_hidden_fields([
'to_id' => $to_id,
'rthanks' => $post_id,
- )
- );
+ ]);
/**
- * This event allows to interrupt before a thanks is deleted
- *
- * @event gfksx.thanksforposts.delete_thanks_before
- * @var int post_id The post id
- * @var int forum_id The forum id
- * @since 2.0.3
- */
- $vars = array(
- 'post_id',
- 'forum_id',
- );
+ * This event allows to interrupt before a thanks is deleted
+ *
+ * @event gfksx.thanksforposts.delete_thanks_before
+ * @var int post_id The post id
+ * @var int forum_id The forum id
+ * @since 2.0.3
+ */
+ $vars = ['post_id', 'forum_id'];
extract($this->phpbb_dispatcher->trigger_event('gfksx.thanksforposts.delete_thanks_before', compact($vars)));
if (!$this->config['remove_thanks'])
{
- trigger_error($this->user->lang['DISABLE_REMOVE_THANKS'] . '
' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id") . '">', ''));
+ trigger_error($this->language->lang('DISABLE_REMOVE_THANKS') . '
' . $this->language->lang('RETURN_POST', '', ''));
}
if (confirm_box(true, 'REMOVE_THANKS', $hidden))
{
if ($this->user->data['user_type'] != USER_IGNORE && !empty($to_id) && $this->auth->acl_get('f_thanks', $forum_id))
{
- $sql = "DELETE FROM " . $this->thanks_table . '
- WHERE post_id ='. (int) $post_id ." AND user_id = " . (int) $this->user->data['user_id'];
+ $sql = 'DELETE FROM ' . $this->thanks_table . '
+ WHERE post_id =' . (int) $post_id . ' AND user_id = ' . (int) $this->user->data['user_id'];
$this->db->sql_query($sql);
- $result = $this->db->sql_affectedrows();
- if ($result != 0)
+
+ if ($this->db->sql_affectedrows())
{
- $lang_act = 'REMOVE';
$thanks_data = array(
'user_id' => (int) $this->user->data['user_id'],
'post_id' => $post_id,
@@ -366,143 +352,108 @@ public function delete_thanks($post_id, $forum_id)
'forum_id' => $forum_id,
'thanks_time' => time(),
'username' => $this->user->data['username'],
- 'lang_act' => $lang_act,
+ 'lang_act' => 'REMOVE',
'post_subject' => $row['post_subject'],
);
$this->add_notification($thanks_data, 'gfksx.thanksforposts.notification.type.thanks_remove');
if ($this->config['thanks_info_page'])
{
- meta_refresh (1, append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id"));
- trigger_error($this->user->lang['THANKS_INFO_' . $lang_act] . '
' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id") . '">', ''));
+ meta_refresh (1, $redirect_url);
+ trigger_error($this->language->lang('THANKS_INFO_REMOVE') . '
' . $this->language->lang('RETURN_POST', '', ''));
}
else
{
- redirect (append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id"));
+ redirect ($redirect_url);
}
}
else
{
- trigger_error($this->user->lang['INCORRECT_THANKS'] . '
' . $this->user->lang('RETURN_POST', 'phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id") . '">', ''));
+ trigger_error($this->language->lang('INCORRECT_THANKS') . '
' . $this->language->lang('RETURN_POST', '', ''));
}
}
}
else
{
confirm_box(false, 'REMOVE_THANKS', $hidden);
- redirect(append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", "f=$forum_id&p=$post_id#p$post_id"));
+ redirect($redirect_url);
}
+
return;
}
- // display the text/image saying either to add or remove thanks
+ // Display the text/image saying either to add or remove thanks
public function get_thanks_text($post_id)
{
- if ($this->already_thanked($post_id, $this->user->data['user_id']))
- {
- return array(
- 'THANK_ALT' => $this->user->lang['REMOVE_THANKS'],
- 'THANK_ALT_SHORT' => $this->user->lang['REMOVE_THANKS_SHORT'],
- 'THANKED' => true,
- );
- }
- return array(
- 'THANK_ALT' => $this->user->lang['THANK_POST'],
- 'THANK_ALT_SHORT' => $this->user->lang['THANK_POST_SHORT'],
- 'THANKED' => false,
- );
+ $already_thanked = $this->already_thanked($post_id, $this->user->data['user_id']);
+ return [
+ 'THANK_ALT' => $this->language->lang($already_thanked ? 'REMOVE_THANKS' : 'THANK_POST'),
+ 'THANK_ALT_SHORT' => $this->language->lang($already_thanked ? 'REMOVE_THANKS_SHORT' : 'THANK_POST_SHORT'),
+ 'THANKED' => $already_thanked,
+ ];
}
- // change the variable sent via the link to avoid odd errors
+ // Change the variable sent via the link to avoid odd errors
public function get_thanks_link($post_id)
{
- if ($this->already_thanked($post_id, $this->user->data['user_id']))
- {
- return 'rthanks';
- }
- return 'thanks';
+ return $this->already_thanked($post_id, $this->user->data['user_id']) ? 'rthanks' : 'thanks';
}
- // check if the user has already thanked that post
+ // Check if the user has already thanked that post
public function already_thanked($post_id, $user_id)
{
- $thanked = false;
+ $already_thanked = false;
foreach ($this->thankers as $thanker)
{
if ($thanker['post_id'] == $post_id && $thanker['user_id'] == $user_id)
{
- $thanked = true;
+ $already_thanked = true;
+ break;
}
}
- return $thanked;
+
+ return $already_thanked;
}
public function output_thanks_memberlist($user_id, $ex_fid_ary)
{
- $thankers_member = $thankered_member = array();
+ $user_thankers = $user_thanked = [];
$poster_limit = (int) $this->config['thanks_number'];
- $sql = 'SELECT poster_id, COUNT(*) AS poster_receive_count
- FROM ' . $this->thanks_table . '
- WHERE poster_id = ' . (int) $user_id. ' AND (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0)
- GROUP BY poster_id';
- $result = $this->db->sql_query($sql);
- $poster_receive_count = (int) $this->db->sql_fetchfield('poster_receive_count');
- $this->db->sql_freeresult($result);
-
- $sql_array = array(
- 'SELECT' => 't.*, u.username, u.user_colour',
- 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'),
- );
- $sql_array['WHERE'] = 't.poster_id =' . (int) $user_id .' AND ';
- $sql_array['WHERE'] .= 'u.user_id = t.user_id AND ';
- $sql_array['WHERE'] .= '('. $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)';
- $sql_array['ORDER_BY'] = 't.post_id DESC LIMIT ' . $poster_limit;
+ $sql_array = [
+ 'SELECT' => 't.user_id, t.post_id, u.username, u.user_colour',
+ 'FROM' => [$this->thanks_table => 't', $this->users_table => 'u'],
+ 'WHERE' => 't.poster_id =' . (int) $user_id .' AND u.user_id = t.user_id AND (' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)',
+ 'ORDER_BY' => 't.post_id DESC LIMIT ' . $poster_limit,
+ ];
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
- $thankers_member[] = array(
+ $user_thankers[] = [
'user_id' => $row['user_id'],
- 'poster_id' => $row['poster_id'],
'post_id' => $row['post_id'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
- );
+ ];
}
$this->db->sql_freeresult($result);
-
- $user_list = array();
- $i=0;
- foreach ($thankers_member as $key => $value)
- {
- if ($thankers_member[$key]['poster_id'] == $user_id)
- {
- $i++;
- $user_list[$i] = array(
- 'username' => $thankers_member[$key]['username'],
- 'user_id' => $thankers_member[$key]['user_id'],
- 'user_colour' => $thankers_member[$key]['user_colour'],
- 'post_id' => $thankers_member[$key]['post_id'],
- );
- }
- }
- unset ($value);
+ $poster_receive_count = count($user_thankers);
$collim = ($poster_limit > $poster_receive_count)? ceil($poster_receive_count/4) : ceil($poster_limit/4);
- $thanked_row = array();
+ $thanked_row = [];
$i = $j = 0;
-
- foreach ($user_list as $value)
+ foreach ($user_thankers as $thanker)
{
$i++;
if ($i <= $poster_limit)
{
- $thanked_row[$i]['USERNAME_FULL'] = get_username_string('full', $value['user_id'], $value['username'], $value['user_colour']);
- $thanked_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $value['post_id']. '#p' . $value['post_id']);
+ $thanked_row[$i]['USERNAME_FULL'] = get_username_string('full', $thanker['user_id'], $thanker['username'], $thanker['user_colour']);
+ $thanked_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $thanker['post_id']. '#p' . $thanker['post_id']);
+
$j++;
- if ($j > $collim or $i == $poster_receive_count or $i == $poster_limit)
+ if ($j > $collim || $i == $poster_receive_count || $i == $poster_limit)
{
$thanked_row[$i]['S_SWITCH_COLUMN'] = true;
$j = 0;
@@ -514,72 +465,47 @@ public function output_thanks_memberlist($user_id, $ex_fid_ary)
if ($poster_receive_count > $poster_limit)
{
$further_thanks = $poster_receive_count - $poster_limit;
- $further_thanks_text = $this->user->lang('FURTHER_THANKS', $further_thanks);
+ $further_thanks_text = $this->language->lang('FURTHER_THANKS', $further_thanks);
$this->template->assign_var('FURTHER_THANKS_TEXT', $further_thanks_text);
}
- unset ($value);
- $sql = 'SELECT user_id, COUNT(*) AS poster_give_count
- FROM ' . $this->thanks_table . "
- WHERE user_id = " . (int) $user_id. ' AND (' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . ' OR forum_id = 0)
- GROUP BY user_id';
- $result = $this->db->sql_query($sql);
- $poster_give_count = (int) $this->db->sql_fetchfield('poster_give_count');
- $this->db->sql_freeresult($result);
-
- $sql_array = array(
- 'SELECT' => 't.*, u.username, u.user_colour',
- 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'),
- );
- $sql_array['WHERE'] = 't.user_id =' . (int) $user_id . ' AND ';
- $sql_array['WHERE'] .= 'u.user_id = t.poster_id AND ';
- $sql_array['WHERE'] .= '(' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)';
- $sql_array['ORDER_BY'] = 't.post_id DESC LIMIT ' . (int) $poster_limit;
+ $sql_array = [
+ 'SELECT' => 't.poster_id, t.post_id, u.username, u.user_colour',
+ 'FROM' => [$this->thanks_table => 't', $this->users_table => 'u'],
+ 'WHERE' => 't.user_id =' . (int) $user_id . ' AND u.user_id = t.poster_id AND (' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0)',
+ 'ORDER_BY' => 't.post_id DESC LIMIT ' . (int) $poster_limit,
+ ];
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
- $thankered_member[] = array(
- 'user_id' => $row['user_id'],
+ $user_thanked[] = array(
'poster_id' => $row['poster_id'],
'post_id' => $row['post_id'],
- 'username' => $row['username'],
- 'user_colour' => $row['user_colour'],
+ 'postername' => $row['username'],
+ 'poster_colour' => $row['user_colour'],
);
}
$this->db->sql_freeresult($result);
+ $poster_give_count = count($user_thanked);
- $post_list = array();
- $i=0;
- foreach ($thankered_member as $key => $value)
- {
- if ($thankered_member[$key]['user_id'] == $user_id)
- {
- $i++;
- $post_list[$i] = array(
- 'postername' => $thankered_member[$key]['username'],
- 'poster_id' => $thankered_member[$key]['poster_id'],
- 'poster_colour' => $thankered_member[$key]['user_colour'],
- 'post_id' => $thankered_member[$key]['post_id'],
- );
- }
- }
- unset ($value);
- $collim = ($poster_limit > $poster_give_count)? ceil($poster_give_count/4) : ceil($poster_limit/4);
+ $collim = ($poster_limit > $poster_give_count) ? ceil($poster_give_count/4) : ceil($poster_limit/4);
$thanks_row = array();
$i = $j = 0;
- foreach ($post_list as $value)
+ foreach ($user_thanked as $thanked)
{
$i++;
if ($i <= $poster_limit)
{
- $thanks_row[$i]['USERNAME_FULL'] = get_username_string('full', $value['poster_id'], $value['postername'], $value['poster_colour']);
- $thanks_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $value['post_id']. '#p' . $value['post_id']);
+ $thanks_row[$i]['USERNAME_FULL'] = get_username_string('full', $thanked['poster_id'], $thanked['postername'], $thanked['poster_colour']);
+ $thanks_row[$i]['U_POST_LINK'] = append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'p=' . $thanked['post_id']. '#p' . $thanked['post_id']);
+
$j++;
- if ($j > $collim or $i == $poster_give_count or $i == $poster_limit)
+ if ($j > $collim || $i == $poster_give_count || $i == $poster_limit)
{
$j = 0;
- if ($i < $poster_limit and $i < $poster_give_count)
+ if ($i < $poster_limit && $i < $poster_give_count)
{
$thanks_row[$i]['S_SWITCH_COLUMN'] = true;
}
@@ -591,22 +517,21 @@ public function output_thanks_memberlist($user_id, $ex_fid_ary)
if ($poster_give_count > $poster_limit)
{
$further_thanks = $poster_give_count - $poster_limit;
- $further_thanks_text = $this->user->lang('FURTHER_THANKS', $further_thanks);
+ $further_thanks_text = $this->language->lang('FURTHER_THANKS', $further_thanks);
$this->template->assign_var('FURTHER_THANKS_TEXT', $further_thanks_text);
}
- unset ($value);
- $l_poster_receive_count = ($poster_receive_count) ? $this->user->lang('THANKS', $poster_receive_count) : '';
- $l_poster_give_count = ($poster_give_count) ? $this->user->lang('THANKS', $poster_give_count) : '';
- $this->template->assign_vars(array(
- 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->user->lang['CLEAR_LIST_THANKS']),
+ $l_poster_receive_count = ($poster_receive_count) ? $this->language->lang('THANKS', $poster_receive_count) : '';
+ $l_poster_give_count = ($poster_give_count) ? $this->language->lang('THANKS', $poster_give_count) : '';
+ $this->template->assign_vars([
+ 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->language->lang('CLEAR_LIST_THANKS')),
'POSTER_RECEIVE_COUNT' => $l_poster_receive_count,
'POSTER_GIVE_COUNT' => $l_poster_give_count,
'THANKS_PROFILELIST_VIEW' => $this->config['thanks_profilelist_view'],
'S_MOD_THANKS' => $this->auth->acl_get('m_thanks'),
'U_CLEAR_LIST_THANKS_GIVE' => append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $user_id . '&list_thanks=give'),
'U_CLEAR_LIST_THANKS_RECEIVE' => append_sid("{$this->phpbb_root_path}memberlist.$this->php_ext", 'mode=viewprofile&u=' . $user_id . '&list_thanks=receive'),
- ));
+ ]);
}
public function output_thanks($poster_id, &$postrow, $row, $topic_data, $forum_id)
@@ -616,50 +541,50 @@ public function output_thanks($poster_id, &$postrow, $row, $topic_data, $forum_i
$thanks_text = $this->get_thanks_text($row['post_id']);
$thank_mode = $this->get_thanks_link($row['post_id']);
$already_thanked = $this->already_thanked($row['post_id'], $this->user->data['user_id']);
- $l_poster_receive_count = (isset($this->poster_list_count[$poster_id]['R']) && $this->poster_list_count[$poster_id]['R']) ? $this->user->lang('THANKS', (int) $this->poster_list_count[$poster_id]['R']) : '';
- $l_poster_give_count = (isset($this->poster_list_count[$poster_id]['G']) && $this->poster_list_count[$poster_id]['G']) ? $this->user->lang('THANKS', (int) $this->poster_list_count[$poster_id]['G']) : '';
+ $l_poster_receive_count = (isset($this->poster_list_count[$poster_id]['R']) && $this->poster_list_count[$poster_id]['R']) ? $this->language->lang('THANKS', (int) $this->poster_list_count[$poster_id]['R']) : '';
+ $l_poster_give_count = (isset($this->poster_list_count[$poster_id]['G']) && $this->poster_list_count[$poster_id]['G']) ? $this->language->lang('THANKS', (int) $this->poster_list_count[$poster_id]['G']) : '';
// Correctly form URLs
- $u_receive_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $poster_id, 'give' => 'false', 'tslash' => ''));
- $u_give_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $poster_id, 'give' => 'true', 'tslash' => ''));
+ $u_receive_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $poster_id, 'give' => 'false', 'tslash' => '']);
+ $u_give_count_url = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller_user', ['mode' => 'givens', 'author_id' => $poster_id, 'give' => 'true', 'tslash' => '']);
- $postrow = array_merge($postrow, $thanks_text, array(
- 'COND' => ($already_thanked) ? true : false,
+ $postrow = array_merge($postrow, $thanks_text, [
+ 'COND' => $already_thanked,
'THANKS' => $this->get_thanks($row['post_id']),
'THANK_MODE' => $thank_mode,
'THANKS_LINK' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $row['post_id'] . '&' . $thank_mode . '=' . $row['post_id'] . '&to_id=' . $poster_id . '&from_id=' . $this->user->data['user_id']),
- 'THANK_TEXT' => $this->user->lang['THANK_TEXT_1'],
- 'THANK_TEXT_2' => ($this->get_thanks_number($row['post_id']) != 1) ? sprintf($this->user->lang['THANK_TEXT_2PL'], $this->get_thanks_number($row['post_id'])) : $this->user->lang['THANK_TEXT_2'],
- 'THANKS_FROM' => $this->user->lang['THANK_FROM'],
+ 'THANK_TEXT' => $this->language->lang('THANK_TEXT_1'),
+ 'THANK_TEXT_2' => ($this->get_thanks_number($row['post_id']) != 1) ? $this->language->lang('THANK_TEXT_2PL', $this->get_thanks_number((int) $row['post_id'])) : $this->language->lang('THANK_TEXT_2'),
+ 'THANKS_FROM' => $this->language->lang('THANK_FROM'),
'POSTER_RECEIVE_COUNT' => $l_poster_receive_count,
'POSTER_GIVE_COUNT' => $l_poster_give_count,
'POSTER_RECEIVE_COUNT_LINK' => $u_receive_count_url,
'POSTER_GIVE_COUNT_LINK' => $u_give_count_url,
- 'S_IS_OWN_POST' => ($this->user->data['user_id'] == $poster_id) ? true : false,
- 'S_POST_ANONYMOUS' => ($poster_id == ANONYMOUS) ? true : false,
- 'THANK_IMG' => ($already_thanked) ? $this->user->img('removethanks', $this->user->lang['REMOVE_THANKS']. get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : $this->user->img('thankposts', $this->user->lang['THANK_POST']. get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])),
- 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->user->lang['CLEAR_LIST_THANKS']),
+ 'S_IS_OWN_POST' => $this->user->data['user_id'] == $poster_id,
+ 'S_POST_ANONYMOUS' => $poster_id == ANONYMOUS,
+ 'THANK_IMG' => ($already_thanked) ? $this->user->img('removethanks', $this->language->lang('REMOVE_THANKS') . get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : $this->user->img('thankposts', $this->language->lang('THANK_POST') . get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])),
+ 'DELETE_IMG' => $this->user->img('icon_post_delete', $this->language->lang('CLEAR_LIST_THANKS')),
'THANKS_POSTLIST_VIEW' => $this->config['thanks_postlist_view'],
'THANKS_COUNTERS_VIEW' => $this->config['thanks_counters_view'],
'S_ALREADY_THANKED' => $already_thanked,
- 'S_REMOVE_THANKS' => $this->config['remove_thanks'],
- 'S_FIRST_POST_ONLY' => $this->config['thanks_only_first_post'],
+ 'S_REMOVE_THANKS' => (bool) $this->config['remove_thanks'],
+ 'S_FIRST_POST_ONLY' => (bool) $this->config['thanks_only_first_post'],
'POST_REPUT' => ($this->get_thanks_number($row['post_id']) != 0) ? round($this->get_thanks_number($row['post_id']) / ($this->max_post_thanks / 100), (int) $this->config['thanks_number_digits']) . '%' : '',
'S_THANKS_POST_REPUT_VIEW' => (bool) $this->config['thanks_post_reput_view'],
- 'S_THANKS_REPUT_GRAPHIC' => $this->config['thanks_reput_graphic'],
+ 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'],
'THANKS_REPUT_HEIGHT' => $this->config['thanks_reput_height'] ?: false,
'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'] : false,
'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '',
'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '',
- 'S_GLOBAL_POST_THANKS' => ($topic_data['topic_type'] == POST_GLOBAL) ? !$this->config['thanks_global_post'] : false,
+ 'S_GLOBAL_POST_THANKS' => ($topic_data['topic_type'] == POST_GLOBAL) ? (bool) !$this->config['thanks_global_post'] : false,
'U_CLEAR_LIST_THANKS_POST' => append_sid("{$this->phpbb_root_path}viewtopic.$this->php_ext", 'f=' . $forum_id . '&p=' . $row['post_id'] . '&list_thanks=post'),
'S_MOD_THANKS' => $this->auth->acl_get('m_thanks'),
- 'S_ONLY_TOPICSTART' => ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false,
- ));
+ 'S_ONLY_TOPICSTART' => $topic_data['topic_first_post_id'] == $row['post_id'],
+ ]);
}
}
- //refresh counts if post delete
+ // Refresh counts if post delete
public function delete_post_thanks($post_ids)
{
$sql = 'DELETE FROM ' . $this->thanks_table . '
@@ -667,12 +592,12 @@ public function delete_post_thanks($post_ids)
$this->db->sql_query($sql);
}
- // create an array of all thanks info
+ // Create an array of all thanks info
public function array_all_thanks($post_list, $forum_id)
{
- $poster_list = array();
+ $poster_list = [];
- // max post thanks
+ // Max post thanks
if ($this->config['thanks_post_reput_view'])
{
$sql = 'SELECT MAX(tally) AS max_post_thanks
@@ -686,20 +611,21 @@ public function array_all_thanks($post_list, $forum_id)
$this->max_post_thanks = 1;
}
- //array all user who say thanks on viewtopic page
+ // Array all user who say thanks on viewtopic page
if ($this->auth->acl_get('f_thanks', $forum_id))
{
- $sql_array = array(
+ $sql_array = [
'SELECT' => 't.*, u.username, u.username_clean, u.user_colour',
- 'FROM' => array($this->thanks_table => 't', $this->users_table => 'u'),
+ 'FROM' => [$this->thanks_table => 't', $this->users_table => 'u'],
'WHERE' => 'u.user_id = t.user_id AND ' . $this->db->sql_in_set('t.post_id', $post_list),
'ORDER_BY' => 't.thanks_time ASC',
- );
+ ];
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
- $this->thankers[] = array(
+ $this->thankers[] = [
'user_id' => $row['user_id'],
'poster_id' => $row['poster_id'],
'post_id' => $row['post_id'],
@@ -707,16 +633,17 @@ public function array_all_thanks($post_list, $forum_id)
'username' => $row['username'],
'username_clean' => $row['username_clean'],
'user_colour' => $row['user_colour'],
- );
+ ];
}
$this->db->sql_freeresult($result);
}
- //array thanks_count for all poster on viewtopic page
+ // Array thanks_count for all poster on viewtopic page
if ($this->config['thanks_counters_view'])
{
$sql = 'SELECT DISTINCT poster_id FROM '. $this->posts_table . ' WHERE ' . $this->db->sql_in_set('post_id', $post_list);
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$poster_list[] = $row['poster_id'];
@@ -725,13 +652,14 @@ public function array_all_thanks($post_list, $forum_id)
$this->db->sql_freeresult($result);
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
- $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : false;
+ $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : false;
$sql = 'SELECT poster_id, COUNT(poster_id) AS poster_count FROM ' . $this->thanks_table . '
WHERE ' . $this->db->sql_in_set('poster_id', $poster_list) . '
AND ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . '
GROUP BY poster_id';
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$this->poster_list_count[$row['poster_id']]['R'] = $row['poster_count'];
@@ -743,31 +671,33 @@ public function array_all_thanks($post_list, $forum_id)
AND ' . $this->db->sql_in_set('forum_id', $ex_fid_ary, true) . '
GROUP BY user_id';
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$this->poster_list_count[$row['user_id']]['G'] = $row['user_count'];
}
$this->db->sql_freeresult($result);
}
+
return;
}
public function get_thanks_topic_reput($topic_id, $max_topic_thanks, $topic_thanks)
{
- return array(
+ return [
'TOPIC_REPUT' => (isset($topic_thanks[$topic_id])) ? round((int) $topic_thanks[$topic_id] / ($max_topic_thanks / 100), (int) $this->config['thanks_number_digits']) . '%' : '',
'S_THANKS_TOPIC_REPUT_VIEW' => (bool) $this->config['thanks_topic_reput_view'],
- 'S_THANKS_REPUT_GRAPHIC' => $this->config['thanks_reput_graphic'],
+ 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'],
'THANKS_REPUT_HEIGHT' => $this->config['thanks_reput_height'] ?: false,
'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'] : false,
'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '',
'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '',
- );
+ ];
}
public function get_thanks_topic_number($topic_list)
{
- $topic_thanks = array();
+ $topic_thanks = [];
if ($this->config['thanks_topic_reput_view'])
{
$sql = 'SELECT topic_id, COUNT(*) AS topic_thanks
@@ -775,16 +705,18 @@ public function get_thanks_topic_number($topic_list)
WHERE " . $this->db->sql_in_set('topic_id', $topic_list) . '
GROUP BY topic_id';
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$topic_thanks[$row['topic_id']] = $row['topic_thanks'];
}
$this->db->sql_freeresult($result);
- return $topic_thanks;
}
+
+ return $topic_thanks;
}
- // max topic thanks
+ // Max topic thanks
public function get_max_topic_thanks()
{
if ($this->config['thanks_topic_reput_view'])
@@ -798,7 +730,7 @@ public function get_max_topic_thanks()
}
}
- // max post thanks for toplist
+ // Max post thanks for toplist
public function get_max_post_thanks()
{
$sql = 'SELECT MAX(tally) AS max_post_thanks
@@ -809,48 +741,47 @@ public function get_max_post_thanks()
return $this->max_post_thanks;
}
- // Generate thankslist if required ...
+ // Generate thankslist if required
public function get_toplist_index($ex_fid_ary)
{
- $thanks_list = '';
- $sql_ary = array(
+ $sql_ary = [
'SELECT' => 't.poster_id, COUNT(t.user_id) AS tally, u.user_id, u.username, u.user_colour',
- 'FROM' => array(
- $this->users_table => 'u',
- ),
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array($this->thanks_table => 't'),
+ 'FROM' => [$this->users_table => 'u'],
+ 'LEFT_JOIN' => [
+ [
+ 'FROM' => [$this->thanks_table => 't'],
'ON' => 'u.user_id = t.poster_id',
- ),
- ),
+ ],
+ ],
'WHERE' => $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) . ' OR t.forum_id = 0',
'GROUP_BY' => 't.poster_id, u.user_id',
'ORDER_BY' => 'tally DESC',
- );
+ ];
$cache_ttl = 86400; // Cache thanks toplist on index for 24 hours
$result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), (int) $this->config['thanks_top_number'], 0, $cache_ttl);
+ $thanks_list = '';
while ($row = $this->db->sql_fetchrow($result))
{
$thanks_list .= (($thanks_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) . ' (' . $row['tally'] . ')';
}
$this->db->sql_freeresult($result);
+
return $thanks_list;
}
public function get_thanks_forum_reput($forum_id)
{
- return array(
- 'FORUM_REPUT' => (isset($this->forum_thanks[$forum_id])) ? round($this->forum_thanks[$forum_id] / ($this->max_forum_thanks / 100), ((int) $this->config['thanks_number_digits'])) . '%' : '',
+ return [
+ 'FORUM_REPUT' => (isset($this->forum_thanks[$forum_id])) ? round($this->forum_thanks[$forum_id] / ($this->max_forum_thanks / 100), (int) $this->config['thanks_number_digits']) . '%' : '',
'S_THANKS_FORUM_REPUT_VIEW' => (bool) $this->config['thanks_forum_reput_view'],
- 'S_THANKS_REPUT_GRAPHIC' => $this->config['thanks_reput_graphic'],
+ 'S_THANKS_REPUT_GRAPHIC' => (bool) $this->config['thanks_reput_graphic'],
'THANKS_REPUT_HEIGHT' => $this->config['thanks_reput_height'] ? $this->config['thanks_reput_height'] : false,
'THANKS_REPUT_GRAPHIC_WIDTH'=> ($this->config['thanks_reput_level'] && $this->config['thanks_reput_height']) ? (int) $this->config['thanks_reput_level'] * (int) $this->config['thanks_reput_height'] : false,
'THANKS_REPUT_IMAGE' => $this->config['thanks_reput_image'] ? generate_board_url() . '/' . $this->config['thanks_reput_image'] : '',
'THANKS_REPUT_IMAGE_BACK' => $this->config['thanks_reput_image_back'] ? generate_board_url() . '/' . $this->config['thanks_reput_image_back'] : '',
- );
+ ];
}
public function get_thanks_forum_number()
@@ -864,12 +795,14 @@ public function get_thanks_forum_number()
WHERE " . $this->db->sql_in_set('forum_id', $forum_thanks_rating) . '
GROUP BY forum_id';
$result = $this->db->sql_query($sql);
+
while ($row = $this->db->sql_fetchrow($result))
{
$this->forum_thanks[$row['forum_id']] = $row['forum_thanks'];
}
$this->db->sql_freeresult($result);
}
+
return $this->forum_thanks;
}
}
@@ -884,6 +817,7 @@ public function get_max_forum_thanks()
$result = $this->db->sql_query($sql);
$this->max_forum_thanks = (int) $this->db->sql_fetchfield('max_forum_thanks');
$this->db->sql_freeresult($result);
+
return $this->max_forum_thanks;
}
}
@@ -926,17 +860,19 @@ public function get_post_info($post_id = false)
{
if (!$post_id)
{
- return array();
+ return [];
}
- $sql_array = array(
+
+ $sql_array = [
'SELECT' => 'p.post_id, p.poster_id, p.topic_id, p.forum_id, p.post_subject',
- 'FROM' => array ($this->posts_table => 'p'),
- 'WHERE' => 'p.post_id =' . (int) $post_id);
+ 'FROM' => [$this->posts_table => 'p'],
+ 'WHERE' => 'p.post_id =' . (int) $post_id
+ ];
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
- return ($row) ?: array();
+ return ($row) ?: [];
}
}
diff --git a/event/listener.php b/event/listener.php
index 82295a0..318518e 100644
--- a/event/listener.php
+++ b/event/listener.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\event;
@@ -18,10 +20,10 @@
class listener implements EventSubscriberInterface
{
/** @var array topic_thanks */
- protected $topic_thanks;
+ protected $topic_thanks = [];
/** @var int max_topic_thanks */
- protected $max_topic_thanks;
+ protected $max_topic_thanks = 0;
/** @var \phpbb\config\config */
protected $config;
@@ -47,6 +49,9 @@ class listener implements EventSubscriberInterface
/** @var \phpbb\controller\helper */
protected $controller_helper;
+ /** @var \phpbb\language\language */
+ protected $language;
+
/** @var string phpbb_root_path */
protected $phpbb_root_path;
@@ -57,21 +62,34 @@ class listener implements EventSubscriberInterface
protected $helper;
/**
- * Constructor
- *
- * @param \phpbb\config\config $config Config object
- * @param \phpbb\db\driver\driver_interface $db DBAL object
- * @param \phpbb\auth\auth $auth Auth object
- * @param \phpbb\template\template $template Template object
- * @param \phpbb\user $user User object
- * @param \phpbb\cache\driver\driver_interface $cache Cache driver object
- * @param \phpbb\request\request_interface $request Request object
- * @param string $phpbb_root_path phpbb_root_path
- * @param string $php_ext phpEx
- * @param rxu\PostsMerging\core\helper $helper The extension helper object
- * @access public
- */
- public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\request\request_interface $request, \phpbb\controller\helper $controller_helper, $phpbb_root_path, $php_ext, $helper)
+ * Constructor
+ *
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver_interface $db DBAL object
+ * @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\template\template $template Template object
+ * @param \phpbb\user $user User object
+ * @param \phpbb\cache\driver\driver_interface $cache Cache driver object
+ * @param \phpbb\request\request_interface $request Request object
+ * @param \phpbb\controller\helper $controller_helper Controller helper object
+ * @param \phpbb\language\language $language Language object
+ * @param string $phpbb_root_path phpbb_root_path
+ * @param string $php_ext phpEx
+ * @param rxu\PostsMerging\core\helper $helper The extension helper object
+ * @access public
+ */
+ public function __construct(
+ \phpbb\config\config $config,
+ \phpbb\db\driver\driver_interface $db,
+ \phpbb\auth\auth $auth,
+ \phpbb\template\template $template,
+ \phpbb\user $user,
+ \phpbb\cache\driver\driver_interface $cache,
+ \phpbb\request\request_interface $request,
+ \phpbb\controller\helper $controller_helper,
+ \phpbb\language\language $language,
+ $phpbb_root_path, $php_ext, $helper
+ )
{
$this->config = $config;
$this->db = $db;
@@ -81,51 +99,50 @@ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\drive
$this->cache = $cache;
$this->request = $request;
$this->controller_helper = $controller_helper;
+ $this->language = $language;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->helper = $helper;
- $this->topic_thanks = array();
- $this->max_topic_thanks = 0;
}
static public function getSubscribedEvents()
{
return array(
- 'core.index_modify_page_title' => 'get_thanks_list',
- 'core.memberlist_view_profile' => 'memberlist_viewprofile',
- 'core.delete_posts_in_transaction' => 'delete_post_thanks',
- 'core.viewforum_modify_topicrow' => 'viewforum_output_topics_reput',
- 'core.viewforum_modify_topics_data' => 'viewforum_get_topics_reput',
+ 'core.index_modify_page_title' => 'get_thanks_list',
+ 'core.memberlist_view_profile' => 'memberlist_viewprofile',
+ 'core.delete_posts_in_transaction' => 'delete_post_thanks',
+ 'core.viewforum_modify_topicrow' => 'viewforum_output_topics_reput',
+ 'core.viewforum_modify_topics_data' => 'viewforum_get_topics_reput',
// Set lower priority for the case another ext want to change $post_list first
- 'core.viewtopic_get_post_data' => array('viewtopic_handle_thanks', -2),
- 'core.viewtopic_modify_post_row' => 'viewtopic_modify_postrow',
- 'core.display_forums_before' => 'forumlist_display_rating',
- 'core.display_forums_modify_template_vars' => 'forumlist_modify_template_vars',
- 'core.user_setup' => 'load_language_on_setup',
- 'core.page_header_after' => 'add_header_quicklinks',
- 'core.viewtopic_modify_page_title' => 'markread',
- 'core.viewtopic_assign_template_vars_before' => 'viewtopic_check_f_thanks_auth',
- 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_output_topics_reput',
- 'paybas.recenttopics.modify_topics_list'=> 'recenttopics_get_topics_reput',
- 'core.permissions' => 'add_permission',
+ 'core.viewtopic_get_post_data' => ['viewtopic_handle_thanks', -2],
+ 'core.viewtopic_modify_post_row' => 'viewtopic_modify_postrow',
+ 'core.display_forums_before' => 'forumlist_display_rating',
+ 'core.display_forums_modify_template_vars' => 'forumlist_modify_template_vars',
+ 'core.user_setup' => 'load_language_on_setup',
+ 'core.page_header_after' => 'add_header_quicklinks',
+ 'core.viewtopic_modify_page_title' => 'markread',
+ 'core.viewtopic_assign_template_vars_before'=> 'viewtopic_check_f_thanks_auth',
+ 'paybas.recenttopics.modify_tpl_ary' => 'recenttopics_output_topics_reput',
+ 'paybas.recenttopics.modify_topics_list' => 'recenttopics_get_topics_reput',
+ 'core.permissions' => 'add_permission',
);
}
public function get_thanks_list($event)
{
- // Generate thankslist if required ...
+ // Generate thankslist if required
$thanks_list = '';
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
- $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : 0;
+ $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : [0];
if ($this->config['thanks_top_number'])
{
$thanks_list = $this->helper->get_toplist_index($ex_fid_ary);
}
- $this->template->assign_vars(array(
+ $this->template->assign_vars([
'THANKS_LIST' => ($thanks_list != '') ? $thanks_list : false,
- 'S_THANKS_LIST' => ($this->config['thanks_top_number'] && $thanks_list != '') ? true : false,
- 'L_TOP_THANKS_LIST' => $this->config['thanks_top_number'] ? sprintf($this->user->lang['REPUT_TOPLIST'], (int) $this->config['thanks_top_number']) : false,
- ));
+ 'S_THANKS_LIST' => $this->config['thanks_top_number'] && $thanks_list != '',
+ 'L_TOP_THANKS_LIST' => $this->config['thanks_top_number'] ? $this->language->lang('REPUT_TOPLIST', (int) $this->config['thanks_top_number']) : false,
+ ]);
}
public function memberlist_viewprofile($event)
@@ -134,7 +151,7 @@ public function memberlist_viewprofile($event)
$user_id = (int) $member['user_id'];
$ex_fid_ary = array_keys($this->auth->acl_getf('!f_read', true));
- $ex_fid_ary = (sizeof($ex_fid_ary)) ? $ex_fid_ary : false;
+ $ex_fid_ary = (count($ex_fid_ary)) ? $ex_fid_ary : false;
if ($this->request->is_set('list_thanks'))
{
@@ -212,7 +229,7 @@ public function forumlist_display_rating($event)
{
$forum_rows = $event['forum_rows'];
$this->helper->get_max_forum_thanks();
- $forum_thanks_rating = array();
+ $forum_thanks_rating = [];
foreach ($forum_rows as $row)
{
$forum_thanks_rating[] = $row['forum_id'];
@@ -237,25 +254,25 @@ public function forumlist_modify_template_vars($event)
public function load_language_on_setup($event)
{
$lang_set_ext = $event['lang_set_ext'];
- $lang_set_ext[] = array(
+ $lang_set_ext[] = [
'ext_name' => 'gfksx/thanksforposts',
'lang_set' => 'thanks_mod',
- );
+ ];
$event['lang_set_ext'] = $lang_set_ext;
}
public function add_header_quicklinks($event)
{
- $u_thankslist = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', array('tslash' => ''));
- $u_toplist = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', array('tslash' => ''));
- $this->template->assign_vars(array(
- 'U_THANKS_LIST' => $u_thankslist,
- 'U_REPUT_TOPLIST' => $u_toplist,
+ $u_thankslist = $this->controller_helper->route('gfksx_thanksforposts_thankslist_controller', ['tslash' => '']);
+ $u_toplist = $this->controller_helper->route('gfksx_thanksforposts_toplist_controller', ['tslash' => '']);
+ $this->template->assign_vars([
+ 'U_THANKS_LIST' => $u_thankslist,
+ 'U_REPUT_TOPLIST' => $u_toplist,
'S_DISPLAY_THANKSLIST' => $this->auth->acl_get('u_viewthanks'),
'S_DISPLAY_TOPLIST' => $this->auth->acl_get('u_viewtoplist') && ($this->config['thanks_post_reput_view'] || $this->config['thanks_topic_reput_view'] || $this->config['thanks_forum_reput_view']),
- 'MINI_THANKS_IMG' => $this->user->img('icon_mini_thanks', $this->user->lang['GRATITUDES']),
- 'MINI_TOPLIST_IMG' => $this->user->img('icon_mini_toplist', $this->user->lang['TOPLIST']),
- ));
+ 'MINI_THANKS_IMG' => $this->user->img('icon_mini_thanks', $this->language->lang('GRATITUDES')),
+ 'MINI_TOPLIST_IMG' => $this->user->img('icon_mini_toplist', $this->language->lang('TOPLIST')),
+ ]);
}
public function markread($event)
@@ -267,9 +284,9 @@ public function markread($event)
public function viewtopic_check_f_thanks_auth($event)
{
$forum_id = (int) $event['forum_id'];
- $this->template->assign_vars(array(
+ $this->template->assign_vars([
'S_FORUM_THANKS' => (bool) ($this->auth->acl_get('f_thanks', $forum_id)),
- ));
+ ]);
}
public function recenttopics_output_topics_reput($event)
@@ -295,11 +312,12 @@ public function recenttopics_get_topics_reput($event)
public function add_permission($event)
{
- $permissions = $event['permissions'];
- $permissions['f_thanks'] = array('lang' => 'ACL_F_THANKS', 'cat' => 'misc');
- $permissions['m_thanks'] = array('lang' => 'ACL_M_THANKS', 'cat' => 'misc');
- $permissions['u_viewthanks'] = array('lang' => 'ACL_U_VIEWTHANKS', 'cat' => 'misc');
- $permissions['u_viewtoplist'] = array('lang' => 'ACL_U_VIEWTOPLIST', 'cat' => 'misc');
+ $permissions = array_merge($event['permissions'], [
+ 'f_thanks' => ['lang' => 'ACL_F_THANKS', 'cat' => 'misc'],
+ 'm_thanks' => ['lang' => 'ACL_M_THANKS', 'cat' => 'misc'],
+ 'u_viewthanks' => ['lang' => 'ACL_U_VIEWTHANKS', 'cat' => 'misc'],
+ 'u_viewtoplist' => ['lang' => 'ACL_U_VIEWTOPLIST', 'cat' => 'misc'],
+ ]);
$event['permissions'] = $permissions;
}
}
diff --git a/ext.php b/ext.php
index 7b18205..1d86329 100644
--- a/ext.php
+++ b/ext.php
@@ -1,37 +1,39 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts;
/**
-* Extension class for custom enable/disable/purge actions
-*
-* NOTE TO EXTENSION DEVELOPERS:
-* Normally it is not necessary to define any functions inside the ext class below.
-* The ext class may contain special (un)installation commands in the methods
-* enable_step(), disable_step() and purge_step(). As it is, these methods are defined
-* in phpbb_extension_base, which this class extends, but you can overwrite them to
-* give special instructions for those cases. This extension must do this because it uses
-* the notifications system, which requires the methods enable_notifications(),
-* disable_notifications() and purge_notifications() be run to properly manage the
-* notifications created by it when enabling, disabling or deleting this extension.
-*/
+ * Extension class for custom enable/disable/purge actions
+ *
+ * NOTE TO EXTENSION DEVELOPERS:
+ * Normally it is not necessary to define any functions inside the ext class below.
+ * The ext class may contain special (un)installation commands in the methods
+ * enable_step(), disable_step() and purge_step(). As it is, these methods are defined
+ * in phpbb_extension_base, which this class extends, but you can overwrite them to
+ * give special instructions for those cases. This extension must do this because it uses
+ * the notifications system, which requires the methods enable_notifications(),
+ * disable_notifications() and purge_notifications() be run to properly manage the
+ * notifications created by it when enabling, disabling or deleting this extension.
+ */
class ext extends \phpbb\extension\base
{
/**
- * Overwrite enable_step to enable notifications
- * before any included migrations are installed.
- *
- * @param mixed $old_state State returned by previous call of this method
- * @return mixed Returns false after last step, otherwise temporary state
- */
+ * Overwrite enable_step to enable notifications
+ * before any included migrations are installed.
+ *
+ * @param mixed $old_state State returned by previous call of this method
+ * @return mixed Returns false after last step, otherwise temporary state
+ */
function enable_step($old_state)
{
switch ($old_state)
@@ -56,12 +58,12 @@ function enable_step($old_state)
}
/**
- * Overwrite disable_step to disable notifications
- * before the extension is disabled.
- *
- * @param mixed $old_state State returned by previous call of this method
- * @return mixed Returns false after last step, otherwise temporary state
- */
+ * Overwrite disable_step to disable notifications
+ * before the extension is disabled.
+ *
+ * @param mixed $old_state State returned by previous call of this method
+ * @return mixed Returns false after last step, otherwise temporary state
+ */
function disable_step($old_state)
{
switch ($old_state)
@@ -86,12 +88,12 @@ function disable_step($old_state)
}
/**
- * Overwrite purge_step to purge notifications before
- * any included and installed migrations are reverted.
- *
- * @param mixed $old_state State returned by previous call of this method
- * @return mixed Returns false after last step, otherwise temporary state
- */
+ * Overwrite purge_step to purge notifications before
+ * any included and installed migrations are reverted.
+ *
+ * @param mixed $old_state State returned by previous call of this method
+ * @return mixed Returns false after last step, otherwise temporary state
+ */
function purge_step($old_state)
{
switch ($old_state)
diff --git a/language/ca/info_acp_thanks.php b/language/ca/info_acp_thanks.php
index ca0dea8..8e407d4 100644
--- a/language/ca/info_acp_thanks.php
+++ b/language/ca/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Gràcies esborrades',
'ACP_POSTS' => 'Tots els missatges',
'ACP_POSTSEND' => 'Missatges agraïts',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Operació cancel·lada',
'ALLOW_THANKS_PM_ON' => 'Envia\'m un PM si s\'agraeix un missatge meu',
'ALLOW_THANKS_EMAIL_ON' => 'Envia\'m un email si s\'agraeix un missatge meu',
-));
+]);
diff --git a/language/ca/permissions_thanks.php b/language/ca/permissions_thanks.php
index fb6bd49..250b7a7 100644
--- a/language/ca/permissions_thanks.php
+++ b/language/ca/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Pot agraïr missatges',
'ACL_M_THANKS' => 'Pot esborrar la llista d\'agraïments',
'ACL_U_VIEWTHANKS' => 'Pot veure la llista de tots els agraïments',
'ACL_U_VIEWTOPLIST' => 'Pot veure la llista de més agraïts',
-));
+]);
diff --git a/language/ca/thanks_mod.php b/language/ca/thanks_mod.php
index 3205c95..fc28baf 100644
--- a/language/ca/thanks_mod.php
+++ b/language/ca/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Esborrar la llista d\'agraïments',
'CLEAR_LIST_THANKS_CONFIRM' => 'Realment vols esborrar la llista d\'agraïments de l\'usuari?',
'CLEAR_LIST_THANKS_GIVE' => 'S\'ha esborrat la llista d\'agraïments fets per l\'usuari.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Vés al tema',
'FOR_MESSAGE' => ' per missatge',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' i un usuari més',
2 => ' i %d usuaris més',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'No tens permís per veure la llista d\'agraïments.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Agraïment rebut de %1$s pel missatge:',
2 => 'Agraïments rebuts de %1$s pel missatge:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Agraïment cancel·lat de %1$s pel missatge:',
2 => 'Agraïments cancel·lats de %1$s pel missatge:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Algú ha agraït un missatge teu',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Algú ha cancel·lat un agraïment en un missatge teu',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' pel missatge (%d en total):',
'THANK_POST' => 'Agraeix l\'autor del missatge: ',
'THANK_POST_SHORT' => 'Gràcies',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d cop',
2 => '%d cops',
- ),
+ ],
'THANKS_BACK' => 'Torna',
'THANKS_INFO_GIVE' => 'Acabes d\'agrair el missatge.',
'THANKS_INFO_REMOVE' => 'Acabes de cancel·lar el teu agraïment.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Cancel·la l\'agraïment',
'THANKS_USER' => 'Llista d\'agraïments',
'TOPLIST' => 'Llista de més agraïts',
-));
+]);
diff --git a/language/cs/info_acp_thanks.php b/language/cs/info_acp_thanks.php
index 0a432a5..c59add7 100644
--- a/language/cs/info_acp_thanks.php
+++ b/language/cs/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Vymazaná zaznamemaná poděkování',
'ACP_POSTS' => 'Celkem příspěvků',
'ACP_POSTSEND' => 'Zbývající příspěvky s poděkováními',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Operace zrušena',
'ALLOW_THANKS_PM_ON' => 'Oznámit mi soukromou zprávou, pokud někdo poděkuje za můj příspěvek',
'ALLOW_THANKS_EMAIL_ON' => 'Oznámit mi e-mailem, pokud někdo poděkuje za můj příspěvek',
-));
+]);
diff --git a/language/cs/permissions_thanks.php b/language/cs/permissions_thanks.php
index 59eaf70..970246d 100644
--- a/language/cs/permissions_thanks.php
+++ b/language/cs/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Může děkovat za příspěvky',
'ACL_M_THANKS' => 'Může vymazat seznam poděkování',
'ACL_U_VIEWTHANKS' => 'Může zobrazit seznam poděkování',
'ACL_U_VIEWTOPLIST' => 'Může zobrazit toplist',
-));
+]);
diff --git a/language/cs/thanks_mod.php b/language/cs/thanks_mod.php
index d2ec04d..2068663 100644
--- a/language/cs/thanks_mod.php
+++ b/language/cs/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Vymazat seznam poděkování',
'CLEAR_LIST_THANKS_CONFIRM' => 'Opravdu chcete uživatelův seznam poděkování?',
'CLEAR_LIST_THANKS_GIVE' => 'Seznam poděkování udělených uživatelem byl vymazán.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Přejdi na vlákno',
'FOR_MESSAGE' => ' za příspěvěk',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' a jeden další uživatel',
2 => ' a %d dalších uživatelů',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Nemáte oprávnění zobrazit seznam poděkování.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Obdrženo poděkování od %1$s za příspěvek:',
2 => 'Obdržena poděkování od %1$s za příspěvek:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Odebráno poděkování od %1$s za příspěvěk:',
2 => 'Odebrána poděkování od %1$s za příspěvek:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Někdo poděkoval za váš příspěvek',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Někdo odebral poděkování za váš příspěvek',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' za příspěvky (celkem %d):',
'THANK_POST' => 'Poděkujte autorovi příspěvku: ',
'THANK_POST_SHORT' => 'Poděkujte',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d poděkování',
2 => '%d poděkování',
- ),
+ ],
'THANKS_BACK' => 'Zpět',
'THANKS_INFO_GIVE' => 'Poděkoval jste za tuto zprávu.',
'THANKS_INFO_REMOVE' => 'Odebral jste poděkování.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Odebrané poděkování za příspěvek',
'THANKS_USER' => 'Seznam poděkování',
'TOPLIST' => 'Toplist',
-));
+]);
diff --git a/language/de/info_acp_thanks.php b/language/de/info_acp_thanks.php
index 5fe91f3..12734cd 100644
--- a/language/de/info_acp_thanks.php
+++ b/language/de/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Entfernte Danksagungen',
'ACP_POSTS' => 'Beiträge insgesamt',
'ACP_POSTSEND' => 'Verbleibende Beiträge mit Danksagungen',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Aktion wurde abgebrochen',
'ALLOW_THANKS_PM_ON' => 'Mich mittels Privater Nachricht benachrichtigen, wenn sich jemand bei mir bedankt.',
'ALLOW_THANKS_EMAIL_ON' => 'Mich mittels E-Mail benachrichtigen, wenn sich jemand bei mir bedankt.',
-));
+]);
diff --git a/language/de/permissions_thanks.php b/language/de/permissions_thanks.php
index b0ab47c..828eab7 100644
--- a/language/de/permissions_thanks.php
+++ b/language/de/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Kann sich für Beiträge bedanken',
'ACL_M_THANKS' => 'Kann die Liste der Danksagungen löschen',
'ACL_U_VIEWTHANKS' => 'Kann die Liste aller Danksagungen sehen',
'ACL_U_VIEWTOPLIST' => 'Kann die Topliste sehen',
-));
+]);
diff --git a/language/de/thanks_mod.php b/language/de/thanks_mod.php
index c06ac97..38dfe10 100644
--- a/language/de/thanks_mod.php
+++ b/language/de/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Die Liste der Danksagungen löschen',
'CLEAR_LIST_THANKS_CONFIRM' => 'Möchtest du wirklich die Liste der Danksagungen des Benutzers löschen?',
'CLEAR_LIST_THANKS_GIVE' => 'Die Liste der Danksagungen des Benutzers wurde gelöscht',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Zum Thema wechseln',
'FOR_MESSAGE' => ' für den Beitrag',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' und ein weiterer Benutzer',
2 => ' und %d weitere Benutzer',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Du hast keine Berechtigung, die Liste der Danksagungen zu sehen.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Danksagung erhalten von %1$s für den Beitrag:',
2 => 'Danksagungen erhalten von %1$s für den Beitrag:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Danksagung entfernt von %1$s für den Beitrag:',
2 => 'Danksagungen entfernt von %1$s für den Beitrag:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Jemand hat sich für deinen Beitrag bedankt.',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Jemand hat seine Danksagung für deinen Beitrag entfernt.',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' für den Beitrag (Insgesamt %d):',
'THANK_POST' => 'Bedanke dich beim Autor des Beitrags: ',
'THANK_POST_SHORT' => 'Danke',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d Mal',
2 => '%d Mal',
- ),
+ ],
'THANKS_BACK' => 'Zurück',
'THANKS_INFO_GIVE' => 'Du hast dich für den Beitrag bedankt.',
'THANKS_INFO_REMOVE' => 'Du hast deine Danksagung entfernt.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Danksagung entfernt für den Beitrag',
'THANKS_USER' => 'Liste der Danksagungen',
'TOPLIST' => 'Beitragstopliste',
-));
+]);
diff --git a/language/de_x_sie/info_acp_thanks.php b/language/de_x_sie/info_acp_thanks.php
index e4d95e7..5e70b76 100644
--- a/language/de_x_sie/info_acp_thanks.php
+++ b/language/de_x_sie/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Entfernte Danksagungen',
'ACP_POSTS' => 'Beiträge insgesamt',
'ACP_POSTSEND' => 'Verbleibende Beiträge mit Danksagungen',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Aktion wurde abgebrochen',
'ALLOW_THANKS_PM_ON' => 'Mich mittels Privater Nachricht benachrichtigen, wenn sich jemand bei mir bedankt.',
'ALLOW_THANKS_EMAIL_ON' => 'Mich mittels E-Mail benachrichtigen, wenn sich jemand bei mir bedankt.',
-));
+]);
diff --git a/language/de_x_sie/permissions_thanks.php b/language/de_x_sie/permissions_thanks.php
index b0ab47c..828eab7 100644
--- a/language/de_x_sie/permissions_thanks.php
+++ b/language/de_x_sie/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Kann sich für Beiträge bedanken',
'ACL_M_THANKS' => 'Kann die Liste der Danksagungen löschen',
'ACL_U_VIEWTHANKS' => 'Kann die Liste aller Danksagungen sehen',
'ACL_U_VIEWTOPLIST' => 'Kann die Topliste sehen',
-));
+]);
diff --git a/language/de_x_sie/thanks_mod.php b/language/de_x_sie/thanks_mod.php
index 44d545e..bf30ef4 100644
--- a/language/de_x_sie/thanks_mod.php
+++ b/language/de_x_sie/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Die Liste der Danksagungen löschen',
'CLEAR_LIST_THANKS_CONFIRM' => 'Möchten Sie wirklich die Liste der Danksagungen des Benutzers löschen?',
'CLEAR_LIST_THANKS_GIVE' => 'Die Liste der Danksagungen des Benutzers wurde gelöscht',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Zum Thema wechseln',
'FOR_MESSAGE' => ' für den Beitrag',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' und ein weiterer Benutzer',
2 => ' und %d weitere Benutzer',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Sie haben keine Berechtigung, die Liste der Danksagungen zu sehen.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Danksagung erhalten von %1$s für den Beitrag:',
2 => 'Danksagungen erhalten von %1$s für den Beitrag:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Danksagung entfernt von %1$s für den Beitrag:',
2 => 'Danksagungen entfernt von %1$s für den Beitrag:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Jemand hat sich für Ihren Beitrag bedankt.',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Jemand hat seine Danksagung für Ihren Beitrag entfernt.',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' für den Beitrag (Insgesamt %d):',
'THANK_POST' => 'Bedanken Sie sich beim Autor des Beitrags: ',
'THANK_POST_SHORT' => 'Danke',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d Mal',
2 => '%d Mal',
- ),
+ ],
'THANKS_BACK' => 'Zurück',
'THANKS_INFO_GIVE' => 'Sie haben sich für den Beitrag bedankt.',
'THANKS_INFO_REMOVE' => 'Sie haben Ihre Danksagung entfernt.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Danksagung entfernt für den Beitrag',
'THANKS_USER' => 'Liste der Danksagungen',
'TOPLIST' => 'Beitragstopliste',
-));
+]);
diff --git a/language/en/info_acp_thanks.php b/language/en/info_acp_thanks.php
index ea53203..0af9450 100644
--- a/language/en/info_acp_thanks.php
+++ b/language/en/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Deleted recorded thanks',
'ACP_POSTS' => 'Total posts',
'ACP_POSTSEND' => 'Remaining posts with thanks',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Operation canceled',
'ALLOW_THANKS_PM_ON' => 'Notify me PM if someone thanks my post',
'ALLOW_THANKS_EMAIL_ON' => 'Notify me e-mail if someone thanks my post',
-));
+]);
diff --git a/language/en/permissions_thanks.php b/language/en/permissions_thanks.php
index 91562ef..8c4ce2f 100644
--- a/language/en/permissions_thanks.php
+++ b/language/en/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Can thank for posts',
'ACL_M_THANKS' => 'Can clear the thanks list',
'ACL_U_VIEWTHANKS' => 'Can view list of all thanks',
'ACL_U_VIEWTOPLIST' => 'Can view toplist',
-));
+]);
diff --git a/language/en/thanks_mod.php b/language/en/thanks_mod.php
index 9bcc6f0..b6bed43 100644
--- a/language/en/thanks_mod.php
+++ b/language/en/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Clear Thanks List',
'CLEAR_LIST_THANKS_CONFIRM' => 'Do you really want to clear the user`s Thanks List?',
'CLEAR_LIST_THANKS_GIVE' => 'List of thanks issued by the user was cleared.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Jump to topic',
'FOR_MESSAGE' => ' for post',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' and one more user',
2 => ' and %d more users',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'You are not authorised to view the Thanks List.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => '%1$s has thanked you for this post:',
2 => '%1$s has thanked you for this post:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Removed thank from %1$s for the post:',
2 => 'Removed thanks from %1$s for the post:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Someone thanks you for a post',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Someone removed thanks for your post',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' for the post (total %d):',
'THANK_POST' => 'Say Thanks to the author of the post: ',
'THANK_POST_SHORT' => 'Thanks',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d time',
2 => '%d times',
- ),
+ ],
'THANKS_BACK' => 'Return',
'THANKS_INFO_GIVE' => 'You have just thanked for the post.',
'THANKS_INFO_REMOVE' => 'You have just removed your thank.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Removed thank for the post',
'THANKS_USER' => 'List of thanks',
'TOPLIST' => 'Posts toplist',
-));
+]);
diff --git a/language/es/info_acp_thanks.php b/language/es/info_acp_thanks.php
index 01d3749..968da41 100644
--- a/language/es/info_acp_thanks.php
+++ b/language/es/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Eliminar gracias',
'ACP_POSTS' => 'Mensajes totales',
'ACP_POSTSEND' => 'Mensajes con agradecimientos',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Operación cancelada',
'ALLOW_THANKS_PM_ON' => 'Notificar por MP si se agradece cualquiera de mis mensajes',
'ALLOW_THANKS_EMAIL_ON' => 'Notificar por email si se agradece cualquiera de mis mensajes',
-));
+]);
diff --git a/language/es/permissions_thanks.php b/language/es/permissions_thanks.php
index 1fcf714..cdcde57 100644
--- a/language/es/permissions_thanks.php
+++ b/language/es/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Puede agradecer mensajes',
'ACL_M_THANKS' => 'Puede limpiar la lista de agradecimientos',
'ACL_U_VIEWTHANKS' => 'Puede ver la lista de todos los agradecimientos',
'ACL_U_VIEWTOPLIST' => 'Puede ver la lista TOP',
-));
+]);
diff --git a/language/es/thanks_mod.php b/language/es/thanks_mod.php
index 619e649..37d6edc 100644
--- a/language/es/thanks_mod.php
+++ b/language/es/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Limpiar lista de gracias',
'CLEAR_LIST_THANKS_CONFIRM' => '¿De verdad quieren limpiar la lista gracias a un usuario?',
'CLEAR_LIST_THANKS_GIVE' => 'La lista de gracias ha sido limpiada.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Ir al tema',
'FOR_MESSAGE' => ' por mensaje',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' y otro usario',
2 => ' y d% usuarios más',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'No está autorizado para ver la lista de gracias.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Agradecimiento recibido de %1$s por el mensaje:',
2 => 'Agradecimientos recibidos de %1$s por el mensaje:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Agradecimiento eliminado de %1$s por el mensaje:',
2 => 'Agradecimientos eliminados de %1$s por el mensaje:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Alguien le dio las gracias por su mensaje',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Alguien elimino el agradecimientos por su mensaje',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' por el mensaje (total %d):',
'THANK_POST' => 'De las gracias al autor del mensaje: ',
'THANK_POST_SHORT' => 'Gracias',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d vez',
2 => '%d veces',
- ),
+ ],
'THANKS_BACK' => 'Volver',
'THANKS_INFO_GIVE' => 'Acaba de dar gracias por el mensaje.',
'THANKS_INFO_REMOVE' => 'Acaba de eliminar el agradecimiento.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Eliminar gracias',
'THANKS_USER' => 'Lista de gracias',
'TOPLIST' => 'Lista TOP de mensajes',
-));
+]);
diff --git a/language/fr/info_acp_thanks.php b/language/fr/info_acp_thanks.php
index 197c1bb..a146555 100644
--- a/language/fr/info_acp_thanks.php
+++ b/language/fr/info_acp_thanks.php
@@ -1,13 +1,14 @@
'Nombre de remerciements supprimés',
'ACP_POSTS' => 'Nombre de messages',
'ACP_POSTSEND' => 'Nombre de messages remerciés restants à prendre en compte',
@@ -136,4 +137,4 @@
'TRUNCATE_NO_THANKS' => 'L’opération a été annulée.',
'ALLOW_THANKS_PM_ON' => 'Notifier moi par message privé si quelqu’un remercie un de mes messages',
'ALLOW_THANKS_EMAIL_ON' => 'Notifier moi par e-mail si un quelqu’un remercie un de mes messages',
-));
+]);
diff --git a/language/fr/permissions_thanks.php b/language/fr/permissions_thanks.php
index 68bb53c..6030888 100644
--- a/language/fr/permissions_thanks.php
+++ b/language/fr/permissions_thanks.php
@@ -1,13 +1,14 @@
'Peut remercier les messages.',
'ACL_M_THANKS' => 'Peut purger la liste des remerciements.',
'ACL_U_VIEWTHANKS' => 'Peut voir la liste des remerciements.',
'ACL_U_VIEWTOPLIST' => 'Peut voir le Top du classement des remerciements.',
-));
+]);
diff --git a/language/fr/thanks_mod.php b/language/fr/thanks_mod.php
index 8ac2f34..cc72351 100644
--- a/language/fr/thanks_mod.php
+++ b/language/fr/thanks_mod.php
@@ -1,13 +1,14 @@
'Purger la liste des remerciements',
'CLEAR_LIST_THANKS_CONFIRM' => 'Confirmer la purge de la liste des remerciements.',
'CLEAR_LIST_THANKS_GIVE' => 'La liste des remerciements de cet utilisateur a été purgée.',
@@ -57,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Aller au sujet',
'FOR_MESSAGE' => ' pour le message',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' et un autre utilisateur',
2 => ' et %d autres utilisateurs',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Vous n’êtes pas autorisé à voir la liste des remerciements.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Remerciement reçu de %1$s pour le message :',
2 => 'Remerciements reçus de %1$s pour le message :',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Remerciement retiré de %1$s pour le message : ',
2 => 'Remerciements retirés de %1$s pour le message : ',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Quelqu’un vous a remercié pour votre message.',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Quelqu’un a retiré son remerciement pour votre message.',
@@ -98,10 +99,10 @@
'THANK_TEXT_2PL' => ' pour son message (%d au total) : ',
'THANK_POST' => 'Remercier l’auteur de ce message : ',
'THANK_POST_SHORT' => 'Remercier',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d fois',
2 => '%d fois',
- ),
+ ],
'THANKS_BACK' => 'Retour',
'THANKS_INFO_GIVE' => 'Vous venez de remercier l’auteur de ce message.',
'THANKS_INFO_REMOVE' => 'Vous venez de supprimer votre remerciement pour l’auteur de ce message.',
@@ -112,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Remerciement supprimé pour le message',
'THANKS_USER' => 'Liste des remerciements',
'TOPLIST' => 'Top du classement des remerciements',
-));
+]);
diff --git a/language/hr/info_acp_thanks.php b/language/hr/info_acp_thanks.php
index b27dff3..56fc659 100644
--- a/language/hr/info_acp_thanks.php
+++ b/language/hr/info_acp_thanks.php
@@ -1,12 +1,15 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
+
/**
* DO NOT CHANGE
*/
@@ -14,10 +17,12 @@
{
exit;
}
+
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
+
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
@@ -29,7 +34,7 @@
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Obrisanih zapisa zahvala',
'ACP_POSTS' => 'Ukupno postova',
'ACP_POSTSEND' => 'Preostalo postova sa zahvalama',
@@ -121,4 +126,4 @@
'TRUNCATE_NO_THANKS' => 'Operacija poništena',
'ALLOW_THANKS_PM_ON' => 'Obavijesti me u PP ako mi netko zahvali na postu',
'ALLOW_THANKS_EMAIL_ON' => 'Obavijesti me na e-mail ako mi netko zahvali na postu',
-));
+]);
diff --git a/language/hr/permissions_thanks.php b/language/hr/permissions_thanks.php
index b8f68a6..29aaa07 100644
--- a/language/hr/permissions_thanks.php
+++ b/language/hr/permissions_thanks.php
@@ -1,12 +1,15 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
+
/**
* DO NOT CHANGE
*/
@@ -14,10 +17,12 @@
{
exit;
}
+
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
+
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
@@ -29,9 +34,9 @@
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Možeš zahvaliti na post',
'ACL_M_THANKS' => 'Možeš obrisati listu zahvala',
'ACL_U_VIEWTHANKS' => 'Možeš vidjeti listu svih zahvala',
'ACL_U_VIEWTOPLIST' => 'Možeš vidjeti toplistu',
-));
+]);
diff --git a/language/hr/thanks_mod.php b/language/hr/thanks_mod.php
index d79a1d7..fdfcbcd 100644
--- a/language/hr/thanks_mod.php
+++ b/language/hr/thanks_mod.php
@@ -1,12 +1,15 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
+
/**
* DO NOT CHANGE
*/
@@ -14,10 +17,12 @@
{
exit;
}
+
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
+
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
@@ -33,7 +38,7 @@
// Some characters you may want to copy&paste:
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Brisanje liste zahvala',
'CLEAR_LIST_THANKS_CONFIRM' => 'Zaista želiš obrisati korisničku listu zahvala?',
'CLEAR_LIST_THANKS_GIVE' => 'Lista zahvala izdana korisnicima je obrisana.',
@@ -47,22 +52,23 @@
'JUMP_TO_FORUM' => 'Prebaci se na forum',
'JUMP_TO_TOPIC' => 'Prebaci se na temu',
'FOR_MESSAGE' => ' za post',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' i još jedan korisnik',
2 => ' i još %d korisnika',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Nemaš ovlasti vidjeti Listu zahvala.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Primljena zahvala od %1$s za post:',
2 => 'Primljene zahvale od %1$s za post:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Uklonjena zahvala od %1$s za post:',
2 => 'Uklonjene zahvale od %1$s za post:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Netko je zahvalio na tvojem postu',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Netko je uklonio zahvalu s tvojeg posta',
+
'RECEIVED' => ' pohvaljen',
'REMOVE_THANKS' => 'Ukloni svoje zahvale: ',
'REMOVE_THANKS_CONFIRM' => 'Zaista želiš ukloniti svoje zahvale?',
@@ -86,10 +92,10 @@
'THANK_TEXT_2PL' => ' za post (ukupno %d):',
'THANK_POST' => 'Zahvali se autoru posta: ',
'THANK_POST_SHORT' => 'Hvala',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d put',
2 => '%d puta',
- ),
+ ],
'THANKS_BACK' => 'Povrat',
'THANKS_INFO_GIVE' => 'Upravo si zahvalio na postu.',
'THANKS_INFO_REMOVE' => 'upravo si uklonio zahvalu.',
@@ -100,4 +106,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Ukloni zahvalu s posta',
'THANKS_USER' => 'Lista zahvala',
'TOPLIST' => 'Toplista postova',
-));
+]);
diff --git a/language/pt/info_acp_thanks.php b/language/pt/info_acp_thanks.php
index 478af8e..f97d447 100644
--- a/language/pt/info_acp_thanks.php
+++ b/language/pt/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Registos de mensagens de agradecimento apagados',
'ACP_POSTS' => 'Total de mensagens',
'ACP_POSTSEND' => 'Restantes mensagens com agradecimentos',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Operação cancelada',
'ALLOW_THANKS_PM_ON' => 'Notificar-me por Mensagem Privada dos agradecimentos às minhas mensagens',
'ALLOW_THANKS_EMAIL_ON' => 'Notificar-me por email dos agradecimentos às minhas mensagens',
-));
+]);
diff --git a/language/pt/permissions_thanks.php b/language/pt/permissions_thanks.php
index 6fefc1a..9788a2a 100644
--- a/language/pt/permissions_thanks.php
+++ b/language/pt/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Pode agradecer pela mensagem',
'ACL_M_THANKS' => 'Pode eliminar os agradecimentos da lista',
'ACL_U_VIEWTHANKS' => 'Pode ver a lista de todos os agradecimentos',
'ACL_U_VIEWTOPLIST' => 'Pode ver a Toplist',
-));
+]);
diff --git a/language/pt/thanks_mod.php b/language/pt/thanks_mod.php
index acf6dff..bc6a698 100644
--- a/language/pt/thanks_mod.php
+++ b/language/pt/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Limpar lista de agradecimentos',
'CLEAR_LIST_THANKS_CONFIRM' => 'Tem a certeza que deseja limpar a sua lista de agradecimentos?',
'CLEAR_LIST_THANKS_GIVE' => 'Lista de agradecimentos dados foi limpa.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Ir para o Tópico',
'FOR_MESSAGE' => ' pela mensagem',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' e mais um utilizador',
2 => ' em mais %d utilizadores',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Não tem autorização para ver a lista de agradecimentos.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Agradecimento recebido de %1$s pela mensagem:',
2 => 'Agradecimentos recebidos de %1$s pela mensagem:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Agradecimento eliminado de %1$s pela mensagem:',
2 => 'Agradecimentos eliminados de %1$s pela mensagem:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Alguém agradece pela mensagem',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Alguém eliminou o agradecimento da mensagem ',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' pela mensagem (total %d):',
'THANK_POST' => 'Agradecer por esta mensagem ao autor: ',
'THANK_POST_SHORT' => 'Obrigado',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d vez',
2 => '%d vezes',
- ),
+ ],
'THANKS_BACK' => 'Voltar',
'THANKS_INFO_GIVE' => 'Agradeceu ao autor.',
'THANKS_INFO_REMOVE' => 'Retirou agradecimentos ao autor.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Retirar agradecimento',
'THANKS_USER' => 'Lista de agradecimentos',
'TOPLIST' => 'TOP lista mensagens',
-));
+]);
diff --git a/language/pt_br/info_acp_thanks.php b/language/pt_br/info_acp_thanks.php
index 6421ed5..29f033b 100644
--- a/language/pt_br/info_acp_thanks.php
+++ b/language/pt_br/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Deleted recorded thanks',
'ACP_POSTS' => 'Total posts',
'ACP_POSTSEND' => 'Remaining posts with thanks',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'Operation canceled',
'ALLOW_THANKS_PM_ON' => 'Notify me PM if someone thanks my post',
'ALLOW_THANKS_EMAIL_ON' => 'Notify me e-mail if someone thanks my post',
-));
+]);
diff --git a/language/pt_br/permissions_thanks.php b/language/pt_br/permissions_thanks.php
index cbc3500..524995c 100644
--- a/language/pt_br/permissions_thanks.php
+++ b/language/pt_br/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Pode agradecer por posts',
'ACL_M_THANKS' => 'Pode limpar a lista de agradecimentos',
'ACL_U_VIEWTHANKS' => 'Pode ver a lista de agradecimentos',
'ACL_U_VIEWTOPLIST' => 'Pode ver a toplist de agradecimentos',
-));
+]);
diff --git a/language/pt_br/thanks_mod.php b/language/pt_br/thanks_mod.php
index 96c90f6..ef41fee 100644
--- a/language/pt_br/thanks_mod.php
+++ b/language/pt_br/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Limpar Lista de Agradecimento',
'CLEAR_LIST_THANKS_CONFIRM' => 'Quer realmente limpar esta lista?',
'CLEAR_LIST_THANKS_GIVE' => 'Lista de agradecimentos foi limpa.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Ir ao tópico',
'FOR_MESSAGE' => ' pelo post',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' e mais um usuário',
2 => ' e mais %d usuários',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Você não tem autorização para ver a lista de agradecimentos.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Recebeu agradecimento de %1$s pelo post:',
2 => 'Recebeu agradecimentos de %1$s pelo post:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Removido agradecimento de %1$s pelo post:',
2 => 'Removidos agradecimentos de %1$s pelo post:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Alguém agradeceu seu post',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Alguém removeu o agradecimento pelo seu post',
@@ -98,10 +100,10 @@
'THANK_TEXT_2PL' => ' pelo post (total %d):',
'THANK_POST' => 'Agradeça ao autor pelo post: ',
'THANK_POST_SHORT' => 'Agradeça',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d vez',
2 => '%d vezes',
- ),
+ ],
'THANKS_BACK' => 'Voltar',
'THANKS_INFO_GIVE' => 'Você agradeceu o post.',
'THANKS_INFO_REMOVE' => 'Você removeu seu agradecimento.',
@@ -112,4 +114,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Removido agradecimento pelo post',
'THANKS_USER' => 'Lista de agradecimentos',
'TOPLIST' => 'Posts toplist',
-));
+]);
diff --git a/language/ru/info_acp_thanks.php b/language/ru/info_acp_thanks.php
index 447424b..2a3b808 100644
--- a/language/ru/info_acp_thanks.php
+++ b/language/ru/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Удалено учтённых благодарностей',
'ACP_POSTS' => 'Всего сообщений',
'ACP_POSTSEND' => 'Осталось сообщений с благодарностями',
@@ -130,4 +132,4 @@
'TRUNCATE_NO_THANKS' => 'Действие отменено',
'ALLOW_THANKS_PM_ON' => 'Получать уведомления о благодарностях в ЛС',
'ALLOW_THANKS_EMAIL_ON' => 'Получать уведомления о благодарностях по Email',
-));
+]);
diff --git a/language/ru/permissions_thanks.php b/language/ru/permissions_thanks.php
index b616f0d..f727e73 100644
--- a/language/ru/permissions_thanks.php
+++ b/language/ru/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Может благодарить за сообщения',
'ACL_M_THANKS' => 'Может очищать список благодарностей',
'ACL_U_VIEWTHANKS' => 'Может просматривать лист всех благодарностей',
'ACL_U_VIEWTOPLIST' => 'Может просматривать топлист',
-));
+]);
diff --git a/language/ru/thanks_mod.php b/language/ru/thanks_mod.php
index 395618b..4dd9ee1 100644
--- a/language/ru/thanks_mod.php
+++ b/language/ru/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Очистить список благодарностей',
'CLEAR_LIST_THANKS_CONFIRM' => 'Вы действительно хотите очистить список благодарностей пользователя?',
'CLEAR_LIST_THANKS_GIVE' => 'Cписок благодарностей, выданных пользователем, очищен.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Перейти в тему',
'FOR_MESSAGE' => ' за сообщение',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' и ещё один',
2 => ' и ещё %d',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'У вас нет доступа к просмотру списка благодарностей.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Получена благодарность от пользователя %1$s за сообщение:',
2 => 'Получены благодарности от пользователей %1$s за сообщение:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Удалена благодарность от пользователя %1$s за сообщение:',
2 => 'Удалены благодарности от пользователей %1$s за сообщение:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Вас поблагодарили за сообщение',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Удалена благодарность за ваше сообщение',
@@ -97,11 +99,11 @@
'THANK_TEXT_1' => 'За это сообщение автора ',
'THANK_TEXT_2' => ' поблагодарил:',
'THANK_TEXT_2PL' => ' поблагодарили (всего %d):',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d раз',
2 => '%d раза',
3 => '%d раз',
- ),
+ ],
'THANKS_BACK' => 'Вернуться к листу благодарностей',
'THANKS_INFO_GIVE' => 'Вы поблагодарили автора сообщения',
'THANKS_INFO_REMOVE' => 'Вы отменили благодарность автору',
@@ -112,4 +114,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Благодарность за сообщение отменена',
'THANKS_USER' => 'Лист благодарностей',
'TOPLIST' => 'Топлист сообщений',
-));
+]);
diff --git a/language/tr/info_acp_thanks.php b/language/tr/info_acp_thanks.php
index fcb0d2d..81c5804 100644
--- a/language/tr/info_acp_thanks.php
+++ b/language/tr/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Kayıtlı teşekkürler silindi',
'ACP_POSTS' => 'Toplam mesaj',
'ACP_POSTSEND' => 'Remaining posts with thanks',
@@ -131,4 +133,4 @@
'TRUNCATE_NO_THANKS' => 'İşlem iptal edildi',
'ALLOW_THANKS_PM_ON' => 'Mesajıma teşekkür edilirse ÖM ile bildir',
'ALLOW_THANKS_EMAIL_ON' => 'Mesajıma teşekkür edilirse email ile bildir',
-));
+]);
diff --git a/language/tr/permissions_thanks.php b/language/tr/permissions_thanks.php
index 619d552..ff8e340 100644
--- a/language/tr/permissions_thanks.php
+++ b/language/tr/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'MEsajlara teşekkür edebilir',
'ACL_M_THANKS' => 'Teşekkür listesini temizleyebilir',
'ACL_U_VIEWTHANKS' => 'Teşekkür listesini görüntüleyebilir',
'ACL_U_VIEWTOPLIST' => 'Toplisti görebilir',
-));
+]);
diff --git a/language/tr/thanks_mod.php b/language/tr/thanks_mod.php
index c14509d..4e49c10 100644
--- a/language/tr/thanks_mod.php
+++ b/language/tr/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Teşekkür Listesini Temizle',
'CLEAR_LIST_THANKS_CONFIRM' => 'Kullanıcı Teşekkür Listesini gerçekten silmek istiyor musunuz?',
'CLEAR_LIST_THANKS_GIVE' => 'Kullanıcı tarafından verilen teşekkürlerin listesi temizlendi.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Konuya git',
'FOR_MESSAGE' => ' mesaj için',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' ve bir kullanıcı için',
2 => ' ve %d kullanıcı için',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'Teşekkürler Listesini görüntüleme izniniz yok.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Mesaj için %1$s kişisinden teşekkür aldı:',
2 => 'Mesaj için %1$s kişilerden teşekkür aldı:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Mesajdan %1$s kişisinin teşekkürü kaldırıldı:',
2 => 'Mesajdan %1$s kişisinin teşekkürü kaldırıldı:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Birisi mesajınız için teşekkür ediyor',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Birisi mesajınızdan için teşekkürü kaldırdı',
@@ -97,10 +99,10 @@
'THANK_TEXT_2PL' => ' mesaj için (toplam %d):',
'THANK_POST' => 'Mesaj yazarına teşekkür et: ',
'THANK_POST_SHORT' => 'Teşekkür et',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d',
2 => '%d',
- ),
+ ],
'THANKS_BACK' => 'Geri dön',
'THANKS_INFO_GIVE' => 'Mesaja teşekkür ettin.',
'THANKS_INFO_REMOVE' => 'Mesajdan teşekkürü kaldırdın.',
@@ -111,4 +113,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Mesajdan teşekkürü kaldır',
'THANKS_USER' => 'Teşekkür listesi',
'TOPLIST' => 'Mesaj toplisti',
-));
+]);
diff --git a/language/uk/info_acp_thanks.php b/language/uk/info_acp_thanks.php
index 469ff89..e014f62 100644
--- a/language/uk/info_acp_thanks.php
+++ b/language/uk/info_acp_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,7 +35,7 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACP_DELTHANKS' => 'Видалено врахованих подяк',
'ACP_POSTS' => 'Всього повідомлень',
'ACP_POSTSEND' => 'Залишилося повідомлень з подяками',
@@ -130,4 +132,4 @@
'TRUNCATE_NO_THANKS' => 'Дія скасована',
'ALLOW_THANKS_PM_ON' => 'Отримувати повідомлення про подяках в ПП',
'ALLOW_THANKS_EMAIL_ON' => 'Отримувати повідомлення про подяках на Email',
-));
+]);
diff --git a/language/uk/permissions_thanks.php b/language/uk/permissions_thanks.php
index 89b66ac..689b6d8 100644
--- a/language/uk/permissions_thanks.php
+++ b/language/uk/permissions_thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -33,9 +35,9 @@
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'ACL_F_THANKS' => 'Може дякувати за повідомлення',
'ACL_M_THANKS' => 'Може очищати список подяк',
'ACL_U_VIEWTHANKS' => 'Може переглядати лист всіх подяк',
'ACL_U_VIEWTOPLIST' => 'Може переглядати топ лист',
-));
+]);
diff --git a/language/uk/thanks_mod.php b/language/uk/thanks_mod.php
index 14289f6..9b0958c 100644
--- a/language/uk/thanks_mod.php
+++ b/language/uk/thanks_mod.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
/**
* DO NOT CHANGE
@@ -18,7 +20,7 @@
if (empty($lang) || !is_array($lang))
{
- $lang = array();
+ $lang = [];
}
// DEVELOPERS PLEASE NOTE
@@ -37,7 +39,7 @@
// ’ » “ ” …
//
-$lang = array_merge($lang, array(
+$lang = array_merge($lang, [
'CLEAR_LIST_THANKS' => 'Очистити список подяк',
'CLEAR_LIST_THANKS_CONFIRM' => 'Ви дійсно хочете очистити список подяк користувача?',
'CLEAR_LIST_THANKS_GIVE' => 'Cписок подяк, виданих користувачем, очищений.',
@@ -56,21 +58,21 @@
'JUMP_TO_TOPIC' => 'Перейти в тему',
'FOR_MESSAGE' => ' за повідомлення',
- 'FURTHER_THANKS' => array(
+ 'FURTHER_THANKS' => [
1 => ' і ще один',
2 => ' і ще %d',
- ),
+ ],
'NO_VIEW_USERS_THANKS' => 'У вас немає доступу до перегляду списку подяк.',
- 'NOTIFICATION_THANKS_GIVE' => array(
+ 'NOTIFICATION_THANKS_GIVE' => [
1 => 'Отримана подяка від користувача %1$s за повідомлення:',
2 => 'Отримані подяки від користувачів %1$s за повідомлення:',
- ),
- 'NOTIFICATION_THANKS_REMOVE'=> array(
+ ],
+ 'NOTIFICATION_THANKS_REMOVE'=> [
1 => 'Вилучена подяка від користувача %1$s за повідомлення:',
2 => 'Вилучені подяки від користувачів %1$s за повідомлення:',
- ),
+ ],
'NOTIFICATION_TYPE_THANKS_GIVE' => 'Вам подякували за повідомлення',
'NOTIFICATION_TYPE_THANKS_REMOVE' => 'Вилучено подяку за ваше повідомлення',
@@ -97,11 +99,11 @@
'THANK_TEXT_1' => 'За це повідомлення автора ',
'THANK_TEXT_2' => ' подякував:',
'THANK_TEXT_2PL' => ' подякували (всього %d):',
- 'THANKS' => array(
+ 'THANKS' => [
1 => '%d раз',
2 => '%d рази',
3 => '%d разів',
- ),
+ ],
'THANKS_BACK' => 'Повернутися до листу подяк',
'THANKS_INFO_GIVE' => 'Ви подякували автора повідомлення',
'THANKS_INFO_REMOVE' => 'Ви скасували подяку автору',
@@ -112,4 +114,4 @@
'THANKS_PM_SUBJECT_REMOVE' => 'Подяка за повідомлення скасована',
'THANKS_USER' => 'Лист подяк',
'TOPLIST' => 'Топ лист повідомлень',
-));
+]);
diff --git a/migrations/v_0_4_0.php b/migrations/v_0_4_0.php
index a5a0ec7..2dd6a49 100644
--- a/migrations/v_0_4_0.php
+++ b/migrations/v_0_4_0.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -19,25 +21,25 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\dev');
+ return ['\phpbb\db\migration\data\v310\dev'];
}
public function update_schema()
{
if (!$this->db_tools->sql_table_exists($this->table_prefix . 'thanks'))
{
- return array(
- 'add_tables' => array(
- $this->table_prefix . 'thanks' => array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', 0),
- 'poster_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => array('post_id', 'user_id'),
- ),
- ),
- );
+ return [
+ 'add_tables' => [
+ $this->table_prefix . 'thanks' => [
+ 'COLUMNS' => [
+ 'post_id' => ['UINT', 0],
+ 'poster_id' => ['UINT', 0],
+ 'user_id' => ['UINT', 0],
+ ],
+ 'PRIMARY_KEY' => ['post_id', 'user_id'],
+ ],
+ ],
+ ];
}
// If the thanks table exists but 'poster_id' column doesn't, most likely this is an upgrade
// from the 3.0 'Thank Post Mod 0.4.0' https://www.phpbb.com/community/viewtopic.php?f=434&t=543797
@@ -45,35 +47,34 @@ public function update_schema()
// which is the one 'Thanks for posts MOD' by Палыч was initially based on
else if (!$this->db_tools->sql_column_exists($this->table_prefix . 'thanks', 'poster_id'))
{
- return array(
- 'add_columns' => array(
- $this->table_prefix . 'thanks' => array(
- 'poster_id' => array('UINT', 0),
- ),
- ),
- 'add_primary_keys' => array(
- $this->table_prefix . 'thanks' => array('post_id, user_id'),
- ),
- );
+ return [
+ 'add_columns' => [
+ $this->table_prefix . 'thanks' => [
+ 'poster_id' => ['UINT', 0],
+ ],
+ ],
+ 'add_primary_keys' => [
+ $this->table_prefix . 'thanks' =>['post_id, user_id'],
+ ],
+ ];
}
- return array(
- );
+ return [];
}
public function revert_schema()
{
- return array(
- 'drop_tables' => array($this->table_prefix . 'thanks'),
- );
+ return [
+ 'drop_tables' => [$this->table_prefix . 'thanks'],
+ ];
}
public function revert_data()
{
- return array(
+ return [
// Remove configs
- array('config.remove', array('thanks_for_posts_version')),
- array('config.remove', array('thanks_mod_version')),
- );
+ ['config.remove', ['thanks_for_posts_version']],
+ ['config.remove', ['thanks_mod_version']],
+ ];
}
}
diff --git a/migrations/v_1_2_5.php b/migrations/v_1_2_5.php
index 4828e5a..569dd7f 100644
--- a/migrations/v_1_2_5.php
+++ b/migrations/v_1_2_5.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -22,29 +24,29 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_0_4_0');
+ return ['\gfksx\thanksforposts\migrations\v_0_4_0'];
}
public function update_data()
{
- return array(
+ return [
// Add configs
- array('config.add', array('remove_thanks', 1)),
- array('config.add', array('thanks_postlist_view', 1)),
- array('config.add', array('thanks_profilelist_view', 1)),
- array('config.add', array('thanks_counters_view', 1)),
- array('config.add', array('thanks_number', 100)),
- array('config.add', array('thanks_info_page', 1)),
- array('config.add', array('thanks_only_first_post', 0)),
+ ['config.add', ['remove_thanks', 1]],
+ ['config.add', ['thanks_postlist_view', 1]],
+ ['config.add', ['thanks_profilelist_view', 1]],
+ ['config.add', ['thanks_counters_view', 1]],
+ ['config.add', ['thanks_number', 100]],
+ ['config.add', ['thanks_info_page', 1]],
+ ['config.add', ['thanks_only_first_post', 0]],
// Add permissions
- array('permission.add', array('f_thanks', false)),
- array('permission.add', array('u_viewthanks', true)),
+ ['permission.add', ['f_thanks', false]],
+ ['permission.add', ['u_viewthanks', true]],
// Add permissions sets
- array('permission.permission_set', array('ROLE_USER_STANDARD', 'u_viewthanks', 'role', true)),
- array('permission.permission_set', array('REGISTERED', 'u_viewthanks', 'group', true)),
- array('permission.permission_set', array('ROLE_FORUM_STANDARD', 'f_thanks', 'role', true)),
- );
+ ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_viewthanks', 'role', true]],
+ ['permission.permission_set', ['REGISTERED', 'u_viewthanks', 'group', true]],
+ ['permission.permission_set', ['ROLE_FORUM_STANDARD', 'f_thanks', 'role', true]],
+ ];
}
}
diff --git a/migrations/v_1_2_6.php b/migrations/v_1_2_6.php
index 2239844..72761e5 100644
--- a/migrations/v_1_2_6.php
+++ b/migrations/v_1_2_6.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -19,17 +21,17 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_2_5');
+ return ['\gfksx\thanksforposts\migrations\v_1_2_5'];
}
public function update_data()
{
- return array(
+ return [
// Add configs
- array('config.add', array('thanks_number_post', 10)),
+ ['config.add', ['thanks_number_post', 10]],
// Remove ACP module
- array('module.remove', array('acp', 'ACP_MESSAGES', 'ACP_THANKS')),
- );
+ ['module.remove', ['acp', 'ACP_MESSAGES', 'ACP_THANKS']],
+ ];
}
}
diff --git a/migrations/v_1_2_8.php b/migrations/v_1_2_8.php
index d2e3e74..32992f4 100644
--- a/migrations/v_1_2_8.php
+++ b/migrations/v_1_2_8.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -21,62 +23,62 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_2_6');
+ return ['\gfksx\thanksforposts\migrations\v_1_2_6'];
}
public function update_schema()
{
- return array(
- 'add_columns' => array(
- $this->table_prefix . 'thanks' => array(
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'thanks_time' => array('UINT:11', 0),
- ),
- ),
- );
+ return [
+ 'add_columns' => [
+ $this->table_prefix . 'thanks' => [
+ 'topic_id' => ['UINT', 0],
+ 'forum_id' => ['UINT', 0],
+ 'thanks_time' => ['UINT:11', 0],
+ ],
+ ],
+ ];
}
public function revert_schema()
{
- return array(
- 'drop_columns' => array(
- $this->table_prefix . 'thanks' => array(
+ return [
+ 'drop_columns' => [
+ $this->table_prefix . 'thanks' => [
'topic_id',
'forum_id',
'thanks_time',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
public function update_data()
{
- return array(
+ return [
// Add configs
- array('config.add', array('thanks_post_reput_view', 1)),
- array('config.add', array('thanks_topic_reput_view', 1)),
- array('config.add', array('thanks_forum_reput_view', 0)),
- array('config.add', array('thanks_reput_height', 15)),
- array('config.add', array('thanks_reput_level', 10)),
- array('config.add', array('thanks_number_digits', 2)),
- array('config.add', array('thanks_number_row_reput', 5)),
- array('config.add', array('thanks_reput_graphic', 1)),
- array('config.add', array('thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif')),
- array('config.add', array('thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif')),
- array('config.add', array('thanks_time_view', 1)),
- array('config.add', array('thanks_top_number', 0)),
+ ['config.add', ['thanks_post_reput_view', 1]],
+ ['config.add', ['thanks_topic_reput_view', 1]],
+ ['config.add', ['thanks_forum_reput_view', 0]],
+ ['config.add', ['thanks_reput_height', 15]],
+ ['config.add', ['thanks_reput_level', 10]],
+ ['config.add', ['thanks_number_digits', 2]],
+ ['config.add', ['thanks_number_row_reput', 5]],
+ ['config.add', ['thanks_reput_graphic', 1]],
+ ['config.add', ['thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif']],
+ ['config.add', ['thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif']],
+ ['config.add', ['thanks_time_view', 1]],
+ ['config.add', ['thanks_top_number', 0]],
// Add permissions
- array('permission.add', array('u_viewtoplist', true)),
+ ['permission.add', ['u_viewtoplist', true]],
// Add permissions sets
- array('permission.permission_set', array('REGISTERED', 'u_viewtoplist', 'group', true)),
- array('permission.permission_set', array('ROLE_USER_STANDARD', 'u_viewtoplist', 'role', true)),
+ ['permission.permission_set', ['REGISTERED', 'u_viewtoplist', 'group', true]],
+ ['permission.permission_set', ['ROLE_USER_STANDARD', 'u_viewtoplist', 'role', true]],
// Update thanks for posts table
- array('custom', array(array($this, 'update_thanks_table'))),
- );
+ ['custom', [[$this, 'update_thanks_table']]],
+ ];
}
public function update_thanks_table()
diff --git a/migrations/v_1_3_1.php b/migrations/v_1_3_1.php
index 548a0a9..8a1944a 100644
--- a/migrations/v_1_3_1.php
+++ b/migrations/v_1_3_1.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -14,18 +16,18 @@ class v_1_3_1 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_2_8');
+ return ['\gfksx\thanksforposts\migrations\v_1_2_8'];
}
public function update_data()
{
- return array(
+ return [
// Add permissions
- array('permission.add', array('m_thanks', true)),
+ ['permission.add', ['m_thanks', true]],
// Add permissions sets
- array('permission.permission_set', array('ROLE_MOD_FULL', 'm_thanks', 'role', true)),
- array('permission.permission_set', array('GLOBAL_MODERATORS', 'm_thanks', 'group', true)),
- );
+ ['permission.permission_set', ['ROLE_MOD_FULL', 'm_thanks', 'role', true]],
+ ['permission.permission_set', ['GLOBAL_MODERATORS', 'm_thanks', 'group', true]],
+ ];
}
}
diff --git a/migrations/v_1_3_2.php b/migrations/v_1_3_2.php
index c9b0984..50ec4a2 100644
--- a/migrations/v_1_3_2.php
+++ b/migrations/v_1_3_2.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -19,15 +21,15 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_3_1');
+ return ['\gfksx\thanksforposts\migrations\v_1_3_1'];
}
public function update_data()
{
- return array(
+ return [
// Add configs
- array('config.add', array('thanks_forum_reput_view_column', 0)),
- array('config.add', array('thanks_topic_reput_view_column', 0)),
- );
+ ['config.add', ['thanks_forum_reput_view_column', 0]],
+ ['config.add', ['thanks_topic_reput_view_column', 0]],
+ ];
}
}
diff --git a/migrations/v_1_3_3.php b/migrations/v_1_3_3.php
index d11da74..40d7804 100644
--- a/migrations/v_1_3_3.php
+++ b/migrations/v_1_3_3.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -14,14 +16,14 @@ class v_1_3_3 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_3_2');
+ return ['\gfksx\thanksforposts\migrations\v_1_3_2'];
}
public function update_data()
{
- return array(
+ return [
// Add permissions sets
- array('permission.permission_set', array('ROLE_FORUM_FULL', 'f_thanks', 'role', true)),
- );
+ ['permission.permission_set', ['ROLE_FORUM_FULL', 'f_thanks', 'role', true]],
+ ];
}
}
diff --git a/migrations/v_1_3_4.php b/migrations/v_1_3_4.php
index 3a93f03..c462891 100644
--- a/migrations/v_1_3_4.php
+++ b/migrations/v_1_3_4.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -19,58 +21,58 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_3_3');
+ return ['\gfksx\thanksforposts\migrations\v_1_3_3'];
}
public function update_schema()
{
- return array(
- 'add_index' => array(
- $this->table_prefix . 'thanks' => array(
- 'post_id' => array('post_id'),
- 'topic_id' => array('topic_id'),
- 'forum_id' => array('forum_id'),
- 'user_id' => array('user_id'),
- 'poster_id' => array('poster_id'),
- ),
- ),
- );
+ return [
+ 'add_index' => [
+ $this->table_prefix . 'thanks' => [
+ 'post_id' => ['post_id'],
+ 'topic_id' => ['topic_id'],
+ 'forum_id' => ['forum_id'],
+ 'user_id' => ['user_id'],
+ 'poster_id' => ['poster_id'],
+ ],
+ ],
+ ];
}
public function revert_schema()
{
- return array(
- 'drop_keys' => array(
- $this->table_prefix . 'thanks' => array(
+ return [
+ 'drop_keys' => [
+ $this->table_prefix . 'thanks' => [
'post_id',
'topic_id',
'forum_id',
'user_id',
'poster_id',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
public function update_data()
{
- return array(
+ return [
// Add configs
- array('config.add', array('thanks_global_announce', 1)),
+ ['config.add', ['thanks_global_announce', 1]],
// Add permissions sets
- array('permission.permission_set', array('ROLE_FORUM_FULL', 'f_thanks', 'role', true)),
- array('permission.permission_set', array('ROLE_FORUM_POLLS', 'f_thanks', 'role', true)),
- array('permission.permission_set', array('ROLE_FORUM_LIMITED', 'f_thanks', 'role', true)),
- array('permission.permission_set', array('ROLE_FORUM_LIMITED_POLLS', 'f_thanks', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_FULL', 'u_viewtoplist', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_LIMITED', 'u_viewtoplist', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_NOPM', 'u_viewtoplist', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_NOAVATAR', 'u_viewtoplist', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_FULL', 'u_viewthanks', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_LIMITED', 'u_viewthanks', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_NOPM', 'u_viewthanks', 'role', true)),
- array('permission.permission_set', array('ROLE_USER_NOAVATAR', 'u_viewthanks', 'role', true)),
- );
+ ['permission.permission_set', ['ROLE_FORUM_FULL', 'f_thanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_FORUM_POLLS', 'f_thanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_FORUM_LIMITED', 'f_thanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_FORUM_LIMITED_POLLS', 'f_thanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_FULL', 'u_viewtoplist', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_LIMITED', 'u_viewtoplist', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_NOPM', 'u_viewtoplist', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_NOAVATAR', 'u_viewtoplist', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_FULL', 'u_viewthanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_LIMITED', 'u_viewthanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_NOPM', 'u_viewthanks', 'role', true]],
+ ['permission.permission_set', ['ROLE_USER_NOAVATAR', 'u_viewthanks', 'role', true]],
+ ];
}
}
diff --git a/migrations/v_2_0_0.php b/migrations/v_2_0_0.php
index fad8bfc..63b3690 100644
--- a/migrations/v_2_0_0.php
+++ b/migrations/v_2_0_0.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -19,87 +21,87 @@ public function effectively_installed()
static public function depends_on()
{
- return array('\gfksx\thanksforposts\migrations\v_1_3_4');
+ return ['\gfksx\thanksforposts\migrations\v_1_3_4'];
}
public function update_data()
{
// Remove phpBB 3.0 Thanks for posts ACP modules
- $remove_modules = array(
- array('module.remove', array('acp', 'ACP_THANKS', array(
+ $remove_modules = [
+ ['module.remove', ['acp', 'ACP_THANKS', [
'module_basename' => 'thanks',
'module_langname' => 'ACP_THANKS_SETTINGS',
'module_mode' => 'thanks',
'module_auth' => 'acl_a_board',
- ))),
- array('module.remove', array('acp', 'ACP_THANKS', array(
+ ]]],
+ ['module.remove', ['acp', 'ACP_THANKS', [
'module_basename' => 'thanks_refresh',
'module_langname' => 'ACP_THANKS_REFRESH',
'module_mode' => 'thanks',
'module_auth' => 'acl_a_board',
- ))),
- array('module.remove', array('acp', 'ACP_THANKS', array(
+ ]]],
+ ['module.remove', ['acp', 'ACP_THANKS', [
'module_basename' => 'thanks_truncate',
'module_langname' => 'ACP_THANKS_TRUNCATE',
'module_mode' => 'thanks',
'module_auth' => 'acl_a_board',
- ))),
- );
+ ]]],
+ ];
if (isset($this->config['thanks_mod_version']) && version_compare($this->config['thanks_mod_version'], '1.2.8', '>='))
{
$remove_modules = array_merge(
$remove_modules,
- array(
- array('module.remove', array('acp', 'ACP_THANKS', array(
+ [
+ ['module.remove', ['acp', 'ACP_THANKS', [
'module_basename' => 'thanks_reput',
'module_langname' => 'ACP_THANKS_REPUT_SETTINGS',
'module_mode' => 'thanks',
'module_auth' => 'acl_a_board',
- ))),
- )
+ ]]],
+ ]
);
}
$remove_modules = array_merge(
$remove_modules,
- array(
- array('module.remove', array('acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS')),
- )
+ [
+ ['module.remove', ['acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS']],
+ ]
);
// Add ACP modules
- $add_modules = array(
- array('module.add', array('acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS')),
- array('module.add', array('acp', 'ACP_THANKS', array(
+ $add_modules = [
+ ['module.add', ['acp', 'ACP_CAT_DOT_MODS', 'ACP_THANKS']],
+ ['module.add', ['acp', 'ACP_THANKS', [
'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_module',
'module_langname' => 'ACP_THANKS_SETTINGS',
'module_mode' => 'thanks',
'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board',
- ))),
- array('module.add', array('acp', 'ACP_THANKS', array(
+ ]]],
+ ['module.add', ['acp', 'ACP_THANKS', [
'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_refresh_module',
'module_langname' => 'ACP_THANKS_REFRESH',
'module_mode' => 'thanks',
'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board',
- ))),
- array('module.add', array('acp', 'ACP_THANKS', array(
+ ]]],
+ ['module.add', ['acp', 'ACP_THANKS', [
'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_truncate_module',
'module_langname' => 'ACP_THANKS_TRUNCATE',
'module_mode' => 'thanks',
'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board',
- ))),
- array('module.add', array('acp', 'ACP_THANKS', array(
+ ]]],
+ ['module.add', ['acp', 'ACP_THANKS', [
'module_basename' => '\gfksx\thanksforposts\acp\acp_thanks_reput_module',
'module_langname' => 'ACP_THANKS_REPUT_SETTINGS',
'module_mode' => 'thanks',
'module_auth' => 'ext_gfksx/thanksforposts && acl_a_board',
- ))),
- );
+ ]]],
+ ];
// Update config values
- $update_config = array(
+ $update_config = [
// Remove phpBB 3.0 Thanks for posts MOD config entry
- array('config.remove', array('thanks_mod_version')),
- );
+ ['config.remove', ['thanks_mod_version']],
+ ];
return (isset($this->config['thanks_mod_version']) && version_compare($this->config['thanks_mod_version'], '1.2.7', '>=')) ?
array_merge($remove_modules, $add_modules, $update_config) : array_merge($add_modules, $update_config);
diff --git a/migrations/v_2_0_1.php b/migrations/v_2_0_1.php
index dc7aa33..15793a7 100644
--- a/migrations/v_2_0_1.php
+++ b/migrations/v_2_0_1.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -20,55 +22,55 @@ public function effectively_installed()
static public function depends_on()
{
- return array(
+ return [
'\gfksx\thanksforposts\migrations\v_2_0_0',
'\phpbb\db\migration\data\v310\notifications_use_full_name',
- );
+ ];
}
public function update_schema()
{
- return array(
- 'drop_columns' => array(
- $this->table_prefix . 'users' => array(
+ return [
+ 'drop_columns' => [
+ $this->table_prefix . 'users' => [
'user_allow_thanks_email',
'user_allow_thanks_pm',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
public function revert_schema()
{
- return array(
- 'add_columns' => array(
- $this->table_prefix . 'users' => array(
- 'user_allow_thanks_email' => array('BOOL', 0),
- 'user_allow_thanks_pm' => array('BOOL', 0),
- ),
- ),
- );
+ return [
+ 'add_columns' => [
+ $this->table_prefix . 'users' => [
+ 'user_allow_thanks_email' => ['BOOL', 0],
+ 'user_allow_thanks_pm' => ['BOOL', 0],
+ ],
+ ],
+ ];
}
public function update_data()
{
- return array(
+ return [
// Update notification names
- array('custom', array(array($this, 'update_notifications_name'))),
- );
+ ['custom', [[$this, 'update_notifications_name']]],
+ ];
}
public function update_notifications_name()
{
// New notification_type_name and re-enable
- $sql_ary[] = array(
+ $sql_ary[] = [
'notification_type_name' => 'gfksx.thanksforposts.notification.type.thanks',
'notification_type_enabled' => 1,
- );
- $sql_ary[] = array(
+ ];
+ $sql_ary[] = [
'notification_type_name' => 'gfksx.thanksforposts.notification.type.thanks_remove',
'notification_type_enabled' => 1,
- );
+ ];
foreach ($sql_ary as $sql)
{
diff --git a/migrations/v_2_0_2.php b/migrations/v_2_0_2.php
index b1dbbf1..edc26fb 100644
--- a/migrations/v_2_0_2.php
+++ b/migrations/v_2_0_2.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -19,17 +21,15 @@ public function effectively_installed()
static public function depends_on()
{
- return array(
- '\gfksx\thanksforposts\migrations\v_2_0_1',
- );
+ return ['\gfksx\thanksforposts\migrations\v_2_0_1'];
}
public function update_data()
{
- return array(
+ return [
// This config value was missing from the original MOD ver. 1.3.4
// installation script, so fix and add that
- array('config.add', array('thanks_global_post', 0)),
- );
+ ['config.add', ['thanks_global_post', 0]],
+ ];
}
}
diff --git a/migrations/v_2_0_3.php b/migrations/v_2_0_3.php
index 64c3c55..e857ec8 100644
--- a/migrations/v_2_0_3.php
+++ b/migrations/v_2_0_3.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -20,16 +22,14 @@ public function effectively_installed()
static public function depends_on()
{
- return array(
- '\gfksx\thanksforposts\migrations\v_2_0_2',
- );
+ return ['\gfksx\thanksforposts\migrations\v_2_0_2'];
}
public function update_data()
{
- return array(
- array('config.remove', array('thanks_topic_reput_view_column')),
- array('config.remove', array('thanks_forum_reput_view_column')),
- );
+ return [
+ ['config.remove', ['thanks_topic_reput_view_column']],
+ ['config.remove', ['thanks_forum_reput_view_column']],
+ ];
}
}
diff --git a/migrations/v_2_0_6.php b/migrations/v_2_0_6.php
index d72a28b..d66c51a 100644
--- a/migrations/v_2_0_6.php
+++ b/migrations/v_2_0_6.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\migrations;
@@ -20,19 +22,17 @@ public function effectively_installed()
static public function depends_on()
{
- return array(
- '\gfksx\thanksforposts\migrations\v_2_0_3',
- );
+ return ['\gfksx\thanksforposts\migrations\v_2_0_3'];
}
public function update_data()
{
- return array(
+ return [
// Remove stale configs
- array('config.remove', array('thanks_for_posts_version')),
- array('config.remove', array('thanks_mod_version')),
- array('config.update', array('thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif')),
- array('config.update', array('thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif')),
- );
+ ['config.remove', ['thanks_for_posts_version']],
+ ['config.remove', ['thanks_mod_version']],
+ ['config.update', ['thanks_reput_image', 'ext/gfksx/thanksforposts/images/rating/reput_star_gold.gif']],
+ ['config.update', ['thanks_reput_image_back', 'ext/gfksx/thanksforposts/images/rating/reput_star_back.gif']],
+ ];
}
}
diff --git a/notification/thanks.php b/notification/thanks.php
index 2009d0a..e316acf 100644
--- a/notification/thanks.php
+++ b/notification/thanks.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\notification;
@@ -40,10 +42,10 @@ public function get_type()
* @var bool|array False if the service should use it's default data
* Array of data (including keys 'id', 'lang', and 'group')
*/
- public static $notification_option = array(
+ public static $notification_option = [
'lang' => 'NOTIFICATION_TYPE_THANKS_GIVE',
'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS',
- );
+ ];
/** @var string */
protected $notifications_table;
@@ -97,13 +99,13 @@ public static function get_item_parent_id($thanks_data)
*
* @return array
*/
- public function find_users_for_notification($thanks_data, $options = array())
+ public function find_users_for_notification($thanks_data, $options = [])
{
- $options = array_merge(array(
- 'ignore_users' => array(),
- ), $options);
+ $options = array_merge([
+ 'ignore_users' => [],
+ ], $options);
- $users = array((int) $thanks_data['poster_id']);
+ $users = [(int) $thanks_data['poster_id']];
return $this->check_user_notification_options($users, $options);
}
@@ -113,7 +115,7 @@ public function find_users_for_notification($thanks_data, $options = array())
public function get_avatar()
{
$thankers = $this->get_data('thankers');
- return (sizeof($thankers) == 1) ? $this->user_loader->get_avatar($thankers[0]['user_id']) : '';
+ return (count($thankers) == 1) ? $this->user_loader->get_avatar($thankers[0]['user_id']) : '';
}
/**
@@ -124,16 +126,16 @@ public function get_avatar()
public function get_title()
{
$thankers = $this->get_data('thankers');
- $usernames = array();
+ $usernames = [];
if (!is_array($thankers))
{
- $thankers = array();
+ $thankers = [];
}
- $thankers_cnt = sizeof($thankers);
+ $thankers_cnt = count($thankers);
$thankers = $this->trim_user_ary($thankers);
- $trimmed_thankers_cnt = $thankers_cnt - sizeof($thankers);
+ $trimmed_thankers_cnt = $thankers_cnt - count($thankers);
foreach ($thankers as $thanker)
{
@@ -164,9 +166,9 @@ public function get_title()
public function users_to_query()
{
$thankers = $this->get_data('thankers');
- $users = array(
+ $users = [
$this->get_data('user_id'),
- );
+ ];
if (is_array($thankers))
{
@@ -229,7 +231,7 @@ public function get_reference()
*/
public function trim_user_ary($users)
{
- if (sizeof($users) > 4)
+ if (count($users) > 4)
{
array_splice($users, 3);
}
@@ -245,14 +247,14 @@ public function get_email_template_variables()
{
$username = $this->user_loader->get_username($this->get_data('poster_id'), 'username');
- return array(
- 'THANKS_SUBG' => htmlspecialchars_decode($this->language->lang('THANKS_PM_SUBJECT_'. $this->get_data('lang_act'))),
+ return [
+ 'THANKS_SUBG' => htmlspecialchars_decode($this->language->lang('THANKS_PM_SUBJECT_' . $this->get_data('lang_act'))),
'USERNAME' => htmlspecialchars_decode($this->user->data['username']),
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))),
- 'POST_THANKS' => htmlspecialchars_decode($this->language->lang('THANKS_PM_MES_'. $this->get_data('lang_act'))),
+ 'POST_THANKS' => htmlspecialchars_decode($this->language->lang('THANKS_PM_MES_' . $this->get_data('lang_act'))),
'POSTER_NAME' => htmlspecialchars_decode($username),
'U_POST_THANKS' => generate_board_url() . '/viewtopic.' . $this->php_ext . "?p={$this->item_id}#p{$this->item_id}",
- );
+ ];
}
/**
@@ -264,11 +266,11 @@ public function get_email_template_variables()
*
* @return array Array of data ready to be inserted into the database
*/
- public function create_insert_array($thanks_data, $pre_create_data = array())
+ public function create_insert_array($thanks_data, $pre_create_data = [])
{
- $thankers = (isset($thanks_data['thankers'])) ? $thanks_data['thankers'] : array();
+ $thankers = (isset($thanks_data['thankers'])) ? $thanks_data['thankers'] : [];
$thankers = array_merge(
- array(array('user_id' => $thanks_data['user_id'])),
+ [['user_id' => $thanks_data['user_id']]],
$thankers
);
$this->set_data('thankers', $thankers);
@@ -298,7 +300,7 @@ public function create_update_array($thanks_data)
if ($row = $this->db->sql_fetchrow($result))
{
$data = unserialize($row['notification_data']);
- $thanks_data['thankers'] = (!empty($data['thankers'])) ? $data['thankers'] : array();
+ $thanks_data['thankers'] = (!empty($data['thankers'])) ? $data['thankers'] : [];
}
$this->create_insert_array($thanks_data);
diff --git a/notification/thanks_remove.php b/notification/thanks_remove.php
index 1d7ad25..3b138e4 100644
--- a/notification/thanks_remove.php
+++ b/notification/thanks_remove.php
@@ -1,12 +1,14 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-*/
+ *
+ * Thanks For Posts.
+ * Adds the ability to thank the author and to use per posts/topics/forum rating system based on the count of thanks.
+ * An extension for the phpBB Forum Software package.
+ *
+ * @copyright (c) 2020, rxu, https://www.phpbbguru.net
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ */
namespace gfksx\thanksforposts\notification;
@@ -40,10 +42,10 @@ public function get_type()
* @var bool|array False if the service should use it's default data
* Array of data (including keys 'id', 'lang', and 'group')
*/
- public static $notification_option = array(
+ public static $notification_option = [
'lang' => 'NOTIFICATION_TYPE_THANKS_REMOVE',
'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS',
- );
+ ];
/**
* Get the id of the parent
diff --git a/styles/prosilver/template/toplist_body.html b/styles/prosilver/template/toplist_body.html
index 3a69633..1151fc9 100644
--- a/styles/prosilver/template/toplist_body.html
+++ b/styles/prosilver/template/toplist_body.html
@@ -32,10 +32,9 @@