Skip to content

Commit 2faf0f5

Browse files
committed
Total overhaul.
This ia top-to-bottom overhaul of the extension, based on tweaks and comments and forks by various people at the phpBB.com support forum for this extension (credited in README.md), plus additional all-new improvements.
1 parent 199dab8 commit 2faf0f5

84 files changed

Lines changed: 1689 additions & 2558 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.scrutinizer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ tools:
88
filter:
99
excluded_paths:
1010
- tests/*
11-

README.md

Lines changed: 192 additions & 41 deletions
Large diffs are not rendered by default.

acp/manage_tags_controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
*
44
* @package phpBB Extension - RH Topic Tags
5-
* @copyright (c) 2014 Robet Heim
5+
* @copyright © 2014 Robert Heim
66
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
77
*
88
*/

acp/topictags_info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
*
44
* @package phpBB Extension - RH Topic Tags
5-
* @copyright (c) 2014 Robet Heim
5+
* @copyright © 2014 Robert Heim
66
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
77
*
88
*/

acp/topictags_module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
*
44
* @package phpBB Extension - RH Topic Tags
5-
* @copyright (c) 2014 Robet Heim
5+
* @copyright © 2014 Robert Heim
66
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
77
*
88
*/

acp/white_and_blacklist_controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
*
44
* @package phpBB Extension - RH Topic Tags
5-
* @copyright (c) 2014 Robet Heim
5+
* @copyright © 2014 Robert Heim
66
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
77
*/
88
namespace robertheim\topictags\acp;
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php
2+
/**
3+
*
4+
* @package phpBB Extension - RH Topic Tags
5+
* @copyright © 2014 Robert Heim
6+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7+
*/
8+
namespace robertheim\topictags\acp;
9+
10+
/**
11+
* @ignore
12+
*/
13+
use robertheim\topictags\prefixes;
14+
15+
/**
16+
* Handles the "whitelist" and "blacklist" page of the ACP.
17+
*/
18+
class white_and_blacklist_controller
19+
{
20+
/** @var \phpbb\config\config */
21+
private $config;
22+
23+
/**
24+
* @var \phpbb\config\db_text
25+
*/
26+
private $config_text;
27+
28+
/** @var \phpbb\request\request */
29+
private $request;
30+
31+
/** @var \phpbb\user */
32+
private $user;
33+
34+
/** @var \phpbb\template\template */
35+
private $template;
36+
37+
/** @var \robertheim\topictags\service\tags_manager */
38+
private $tags_manager;
39+
40+
public function __construct(
41+
\phpbb\config\config $config,
42+
\phpbb\config\db_text $config_text,
43+
\phpbb\request\request $request,
44+
\phpbb\user $user,
45+
\phpbb\template\template $template,
46+
\robertheim\topictags\service\tags_manager $tags_manager)
47+
{
48+
$this->config = $config;
49+
$this->config_text = $config_text;
50+
$this->request = $request;
51+
$this->user = $user;
52+
$this->template = $template;
53+
$this->tags_manager = $tags_manager;
54+
}
55+
56+
/**
57+
*
58+
* @param string $u_action phpbb acp-u_action
59+
*/
60+
public function manage_whitelist($u_action)
61+
{
62+
$this->manage_list($u_action, 'whitelist');
63+
}
64+
65+
/**
66+
*
67+
* @param string $u_action phpbb acp-u_action
68+
*/
69+
public function manage_blacklist($u_action)
70+
{
71+
$this->manage_list($u_action, 'blacklist');
72+
}
73+
74+
/**
75+
* @param string $list_name whitelist or blacklist
76+
* @param string $u_action phpbb acp-u_action
77+
*/
78+
private function manage_list($u_action, $list_name)
79+
{
80+
$list_name_upper = strtoupper($list_name);
81+
// Define the name of the form for use as a form key
82+
$form_name = 'topictags';
83+
add_form_key($form_name);
84+
85+
$errors = array();
86+
87+
if ($this->request->is_set_post('submit'))
88+
{
89+
if (! check_form_key($form_name))
90+
{
91+
trigger_error('FORM_INVALID');
92+
}
93+
94+
$this->config->set(prefixes::CONFIG . '_' . $list_name . '_enabled', $this->request->variable(prefixes::CONFIG . '_' . $list_name . '_enabled', 0));
95+
$list = rawurldecode(base64_decode($this->request->variable(prefixes::CONFIG . '_' . $list_name, '')));
96+
if (! empty($list))
97+
{
98+
$list = json_decode($list, true);
99+
$tags = array();
100+
for ($i = 0, $size = sizeof($list); $i < $size; $i ++)
101+
{
102+
$tags[] = $list[$i]['text'];
103+
}
104+
$list = json_encode($tags);
105+
}
106+
// store the list
107+
$this->config_text->set(prefixes::CONFIG . '_' . $list_name, $list);
108+
trigger_error($this->user->lang('TOPICTAGS_' . $list_name_upper . '_SAVED') . adm_back_link($u_action));
109+
}
110+
111+
// display
112+
$list = $this->config_text->get(prefixes::CONFIG . '_' . $list_name);
113+
$list = base64_encode(rawurlencode($list));
114+
$this->template->assign_vars(
115+
array(
116+
'TOPICTAGS_VERSION' => $this->user->lang('TOPICTAGS_INSTALLED', $this->config[prefixes::CONFIG . '_version']),
117+
'TOPICTAGS_' . $list_name_upper . '_ENABLED' => $this->config[prefixes::CONFIG . '_' . $list_name . '_enabled'],
118+
'TOPICTAGS_' . $list_name_upper => $list,
119+
'S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT' => true,
120+
'S_RH_TOPICTAGS_INCLUDE_CSS_FROM_ACP' => false,
121+
'TOPICTAGS_CONVERT_SPACE_TO_MINUS' => $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false',
122+
'S_ERROR' => (sizeof($errors)) ? true : false,
123+
'ERROR_MSG' => implode('<br />', $errors),
124+
'U_ACTION' => $u_action
125+
));
126+
}
127+
}

composer.json

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,47 @@
33
"type": "phpbb-extension",
44
"description": "Enables tagging of topics",
55
"homepage": "https://github.com/RobertHeim/phpbb-ext-topictags",
6-
"version": "3.0.0",
7-
"time": "2014-05-30",
8-
"keywords": ["phpbb", "extension", "topic tags", "tags", "tag", "tagging", "rh"],
6+
"version": "3.0.2",
7+
"time": "2024-12-17",
8+
"keywords": [
9+
"phpbb",
10+
"extension",
11+
"topic tags",
12+
"tags",
13+
"tag",
14+
"tagging",
15+
"rh"
16+
],
917
"license": "GPL-2.0",
1018
"authors": [
1119
{
1220
"name": "Robert Heim",
1321
"homepage": "http://blog.robert-heim.de",
1422
"email": "robert@robert-heim.de",
1523
"role": "Lead Developer"
24+
},
25+
{
26+
"name": "S. McCandlish",
27+
"homepage": "https://github.com/SMcCandlish",
28+
"role": "Patcher-upper"
1629
}
1730
],
1831
"require": {
19-
"php": ">=5.3.3"
32+
"php": ">=5.3.3",
33+
"phpbb/phpbb": ">=3.3"
2034
},
2135
"require-dev": {
2236
"phpbb/epv": "dev-master"
2337
},
2438
"extra": {
2539
"display-name": "RH Topic Tags",
2640
"soft-require": {
27-
"phpbb/phpbb": ">=3.3"
41+
"phpbb/phpbb": ">=3.3.5"
42+
},
43+
"version-check": {
44+
"host": "www.phpbb.com",
45+
"directory": "/customise/db/extension/rh_topic_tags",
46+
"filename": "version_check"
2847
}
2948
}
30-
}
49+
}

controller/main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
*
44
* @package phpBB Extension - RH Topic Tags
5-
* @copyright (c) 2014 Robet Heim
5+
* @copyright © 2014 Robert Heim
66
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
77
*
88
*/

controller/topic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
*
44
* @package phpBB Extension - RH Topic Tags
5-
* @copyright (c) 2014 Robet Heim
5+
* @copyright © 2014 Robert Heim
66
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
77
*
88
*/

0 commit comments

Comments
 (0)