Skip to content

Commit 5dbfe2f

Browse files
committed
Partly fix services, tables and migrations
1 parent 1efd14e commit 5dbfe2f

8 files changed

Lines changed: 205 additions & 144 deletions

File tree

acp/acp_pastebin_info.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88

99
class acp_pastebin_info
1010
{
11-
function module()
12-
{
13-
return [
14-
'filename' => 'phpbbde\pastebin\acp\acp_pastebin_module_info',
15-
'title' => 'PASTEBIN_NAV_TITLE',
16-
'modes' => [
17-
'settings' => [
18-
'title' => 'PASTEBIN_NAV_CONFIG',
19-
'auth' => 'ext_phpbbde/pastebin && a_pastebin',
20-
'cat' => ['ACP_PASTEBIN_TITLE']
21-
],
11+
function module()
12+
{
13+
return [
14+
'filename' => 'phpbbde\pastebin\acp\acp_pastebin_module',
15+
'title' => 'PASTEBIN_NAV_TITLE',
16+
'modes' => [
17+
'settings' => [
18+
'title' => 'PASTEBIN_NAV_CONFIG',
19+
'auth' => 'ext_phpbbde/pastebin && acl_a_pastebin',
20+
'cat' => ['ACP_PASTEBIN_TITLE']
21+
],
2222
'languages' => [
23-
'title' => 'PASTEBIN_NAV_LANGS',
24-
'auth' => 'ext_phpbbde/pastebin && a_pastebin',
25-
'cat' => ['ACP_PASTEBIN_TITLE']
23+
'title' => 'PASTEBIN_NAV_LANGS',
24+
'auth' => 'ext_phpbbde/pastebin && acl_a_pastebin',
25+
'cat' => ['ACP_PASTEBIN_TITLE']
2626
],
27-
],
28-
];
29-
}
27+
],
28+
];
29+
}
3030
}

adm/style/acp_pastebin_langs.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ <h1>{{ lang('PASTEBIN_LANG_CONFIG') }}</h1>
1818
</thead>
1919
<tbody>
2020
{% for item in loops.langlist %}
21-
{% if loop.index is even %}
22-
<tr class="row1">
23-
{% else %}
24-
<tr class="row2">
25-
{% endif %}
21+
<tr>
2622
<td>{{ item.LANG_ID }}</td>
2723
<td>{{ item.LANG_NAME }}</td>
2824
<td>{{ item.LANG_NAME_CLEAN }}</td>
@@ -33,5 +29,13 @@ <h1>{{ lang('PASTEBIN_LANG_CONFIG') }}</h1>
3329
</tbody>
3430
</table>
3531

32+
<dl>
33+
<dt><label for="allowed">{L_ALLOWED}{L_COLON}</label></dt>
34+
<dd><input type="checkbox" class="radio" id="allowed" name="allow_group" value="1"<!-- IF ALLOW_GROUP --> checked="checked"<!-- ENDIF --> /></dd>
35+
</dl>
36+
37+
<td class="centered-text"><input type="checkbox" class="radio" name="delete[{{ attachments.ATTACH_ID }}]" /></td>
38+
39+
TODO: Add submit button, form drumherum, checkbox für LANG_ACTIVE und input feld für FILE_EXTENSION
3640

3741
{% include 'overall_footer.html' %}

config/services.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ services:
1010
phpbbde.pastebin.functions.utility:
1111
class: phpbbde\pastebin\functions\utility
1212
arguments:
13-
- '%phpbbde.pastebin.hightlightlangs%'
1413
- '%core.php_ext%'
1514
- '@language'
15+
1616
phpbbde.pastebin.functions.pastebin:
1717
class: phpbbde\pastebin\functions\pastebin
1818
arguments:
1919
- '@dbal.conn'
2020
- '@user'
21-
- '%tables.phpbbde.pastebin.pastebin%'
21+
- '%phpbbde.pastebin.tables.pastebin%'
22+
2223
phpbbde.pastebin.controller.main:
2324
class: phpbbde\pastebin\controller\main
2425
arguments:
@@ -37,7 +38,8 @@ services:
3738
- '@phpbbde.pastebin.functions.pastebin'
3839
- '%core.root_path%'
3940
- '%core.php_ext%'
40-
- '%tables.phpbbde.pastebin.pastebin%'
41+
- '%phpbbde.pastebin.tables.pastebin%'
42+
4143
phpbbde.pastebin.settings.acp:
4244
class: phpbbde\pastebin\controller\acp_pastebin_settings
4345
arguments:
@@ -47,6 +49,7 @@ services:
4749
- '@language'
4850
- '@request'
4951
- '@template'
52+
5053
phpbbde.pastebin.languages.acp:
5154
class: phpbbde\pastebin\controller\acp_pastebin_languages
5255
arguments:
@@ -55,7 +58,7 @@ services:
5558
- '@request'
5659
- '@dbal.conn'
5760
- '@template'
58-
- '%phpbbde.pastebin.tables.pastebin_langs'
61+
5962
phpbbde.pastebin.base_listener:
6063
class: phpbbde\pastebin\event\base_events
6164
arguments:
@@ -71,14 +74,22 @@ services:
7174
class: phpbbde\pastebin\event\acp_events
7275
tags:
7376
- {name: event.listener}
77+
7478
phpbbde.pastebin.cron.main:
7579
class: phpbbde\pastebin\cron\main
7680
arguments:
7781
- '@config'
7882
- '@dbal.conn'
7983
- '%phpbbde.pastebin.cron.prune_interval%'
80-
- '%tables.phpbbde.pastebin.pastebin%'
84+
- '%phpbbde.pastebin.tables.pastebin%'
8185
calls:
8286
- [set_name, [phpbbde.pastebin.cron.main]]
8387
tags:
8488
- {name: cron.task}
89+
90+
phpbbde.pastebin.listener:
91+
class: phpbbde\pastebin\event\permission_listener
92+
arguments:
93+
- '@auth'
94+
tags:
95+
- { name: event.listener }

config/tables.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
parameters:
2-
phpbbde.pastebin.tables.pastebin: '%core.table_prefix%pastebin'
3-
phpbbde.pastebin.tables.pastebin_langs: '%core.table_prefix%pastebin_langs'
2+
phpbbde.pastebin.tables.pastebin: '%core.table_prefix%pastebin'

controller/acp_pastebin_languages.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ public function module_settings(): void
2626

2727
$result = $this->db->sql_query($sql);
2828

29-
$this->db->sql_freeresult($result);
30-
3129
while ($rows = $this->db->sql_fetchrow($result))
3230
{
3331
$this->template->assign_block_vars('langlist', [
@@ -38,5 +36,7 @@ public function module_settings(): void
3836
'LANG_FILE_EXTENSION' => $rows['lang_file_extension'],
3937
]);
4038
};
39+
40+
$this->db->sql_freeresult($result);
4141
}
4242
}

event/permission_listener.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
*
4+
*
5+
*/
6+
7+
namespace phpbbde\pastebin\event;
8+
9+
/**
10+
* @ignore
11+
*/
12+
13+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
14+
15+
/**
16+
* Event listener
17+
*/
18+
19+
class permission_listener implements EventSubscriberInterface
20+
{
21+
public function __construct(protected \phpbb\auth\auth $auth)
22+
{
23+
}
24+
25+
public static function getSubscribedEvents()
26+
{
27+
return array(
28+
'core.permissions' => 'permissions',
29+
);
30+
}
31+
32+
/**
33+
* Add permissions
34+
*
35+
* @param object $event The event object
36+
* @return null
37+
* @access public
38+
*/
39+
public function permissions($event)
40+
{
41+
$permissions = $event['permissions'];
42+
$permissions['a_pastebin'] = array('lang' => 'ACL_A_PASTEBIN', 'cat' => 'misc');
43+
$event['permissions'] = $permissions;
44+
}
45+
}

0 commit comments

Comments
 (0)