Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #2

Open
wants to merge 47 commits into
base: develop-3.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
82693c0
Add version check. Closes #68.
rxu Jul 15, 2018
3dce150
Temporarily allow master branch to fail because of the tests framewor…
rxu Jul 15, 2018
cd76971
Update thanks_mod.php
SiavaRu Nov 9, 2018
bd4e39c
Merge pull request #102 from SiavaRu/patch-2
rxu Nov 9, 2018
ffef971
Fix possible incorrect topics rating displaying issue in template.
rxu Jun 12, 2019
74528b8
Update Tracis-CI config.
rxu Jun 14, 2019
9832a80
Fix pt_br translation, add Turkish (thanks to awr).
rxu Nov 25, 2019
10dfe47
Fix custom rating images displaying in posts. Adjust testing.
rxu Jan 12, 2020
046f9e6
Fix thankslist bug and tests.
rxu Jan 12, 2020
1a309f7
fix czech subject
stanley89 Jan 9, 2019
9b2ad27
Use language service instead of deprecated add_lang on user
JulienTant May 31, 2018
e663394
Merge branch 'JulienTant-develop-3.2.x' into develop-3.2.x
rxu Feb 7, 2020
9b0ea08
Cache thanks toplist on index page for 24 hours
rxu Apr 16, 2020
f2ec095
Use native FontAwesome thumbs icons. Remove unused custom theme files.
rxu Apr 20, 2020
f119843
Add more type casting.
rxu Apr 29, 2020
f4411b4
Adjust migrations effectively_installed methods to ensure correct run…
rxu Apr 29, 2020
0ff9a44
General code cleanup
rxu Apr 30, 2020
156bc3d
Add ACP tests
rxu Apr 30, 2020
5431e0f
Add user profile test
rxu Apr 30, 2020
eedbd75
Fix minor flaws
rxu Apr 30, 2020
67d1def
Restore thanks counting in user profile thanks list
rxu May 1, 2020
e64077c
Fix 'and more' received and given thanks count info in user profile t…
rxu May 1, 2020
1e4b813
Fix thankslist sorting regression
rxu May 2, 2020
f4c227d
Add thankslist sorting tests
rxu May 3, 2020
097c92d
Fix toplist displaying titles with no toplists
rxu May 3, 2020
14dddb0
Fix extension validation issues.
rxu Jul 12, 2020
9d4a36c
Fix v_1_2_8 migration SQL error for MS SQL server.
rxu Dec 12, 2020
e36c7f4
Fix #111.
rxu Dec 16, 2020
ffec3f2
Add PHP 8.0 test build.
rxu Dec 16, 2020
fab0860
Migrate to Github Actions testing
rxu Feb 6, 2021
e1fc078
Update info_acp_thanks.php - typo fix
Scanialady Feb 6, 2021
53ce324
Merge branch 'Scanialady-develop-3.2.x' into develop-3.2.x
rxu Feb 6, 2021
8d67bbe
Temporarily disable PHP 8.1 builds as unstable
rxu Apr 4, 2021
2f6e695
Fixes and new event
Tatiana5 Apr 2, 2021
a333285
Merge branch 'develop-3.2.x-tatiana5' into develop-3.2.x
rxu Apr 4, 2021
40169ac
Update indexes to better filter thanks by user and forum
JoshyPHP Dec 18, 2021
248a45d
Merge branch 'JoshyPHP-develop-3.2.x' into develop-3.2.x
rxu Dec 18, 2021
b0e48cc
Made danish translation and the same time changed "Thanks" to "Like" …
rudibr Nov 4, 2022
a1ace21
Rename language folder in according to Danish ISO code (da)
rxu Nov 7, 2022
0276da5
Merge branch 'rudibr-develop-3.2.x' into develop-3.2.x
rxu Nov 7, 2022
9cb17c4
Add Slovak translation by [email protected]
rxu Apr 18, 2023
1807fd1
Update tests env
rxu Apr 18, 2023
09e87df
Optimize thankslist code, fix MSSQL errors.
rxu Oct 8, 2023
398aa61
Optimize toplist code, fix MSSQL errors.
rxu Oct 8, 2023
13216d0
Improve toplist on index code
rxu Oct 8, 2023
6e331c8
Fix SQL syntax for user profile thanks lists.
rxu Oct 8, 2023
7b1e773
Adjust toplist controller code.
rxu Oct 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
547 changes: 547 additions & 0 deletions .github/workflows/tests.yml

Large diffs are not rendered by default.

76 changes: 0 additions & 76 deletions .travis.yml

This file was deleted.

28 changes: 15 additions & 13 deletions acp/acp_thanks_info.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<?php
/**
*
* Thanks For Posts extension for the phpBB Forum Software package.
*
* @copyright (c) 2013 phpBB Limited <https://www.phpbb.com>
* @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;

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']],
],
];
}
}
112 changes: 66 additions & 46 deletions acp/acp_thanks_module.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
/**
*
* Thanks For Posts extension for the phpBB Forum Software package.
*
* @copyright (c) 2013 phpBB Limited <https://www.phpbb.com>
* @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;

Expand All @@ -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']))
{
$user->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))
Expand Down Expand Up @@ -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('<br />', $error),

'U_ACTION' => $this->u_action)
'U_ACTION' => $this->u_action,
]
);

// Output relevant page
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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]);
Expand Down
28 changes: 15 additions & 13 deletions acp/acp_thanks_refresh_info.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<?php
/**
*
* Thanks For Posts extension for the phpBB Forum Software package.
*
* @copyright (c) 2013 phpBB Limited <https://www.phpbb.com>
* @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;

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']],
],
];
}
}
Loading