@@ -31,30 +31,43 @@ class main_listener implements EventSubscriberInterface
31
31
/** @var \FastImageSize\FastImageSize */
32
32
protected $ imagesize ;
33
33
34
+ /** @var \phpbb\db\driver\driver_interface */
35
+ protected $ db ;
36
+
37
+ /** @var \phpbb\template\template */
38
+ protected $ template ;
39
+
34
40
/**
35
41
* Constructor for listener
36
42
*
37
- * @param \phpbb\config\config $config phpBB config
38
- * @param \phpbb\language\language $language phpBB language
39
- * @param \FastImageSize\FastImageSize $imagesize FastImageSize object
43
+ * @param \phpbb\config\config $config phpBB config
44
+ * @param \phpbb\language\language $language phpBB language
45
+ * @param \FastImageSize\FastImageSize $imagesize FastImageSize object
46
+ * @param \phpbb\db\driver\driver_interface $db phpBB DataBase
47
+ * Qparam \phpbb\template\template $template phpBB template
40
48
*
41
49
* @access public
42
50
*/
43
51
public function __construct
44
52
(
45
53
\phpbb \config \config $ config ,
46
54
\phpbb \language \language $ language ,
47
- \FastImageSize \FastImageSize $ imagesize
55
+ \FastImageSize \FastImageSize $ imagesize ,
56
+ \phpbb \db \driver \driver_interface $ db ,
57
+ \phpbb \template \template $ template
48
58
)
49
59
{
50
- $ this ->config = $ config ;
51
- $ this ->language = $ language ;
60
+ $ this ->config = $ config ;
61
+ $ this ->language = $ language ;
52
62
$ this ->imagesize = $ imagesize ;
63
+ $ this ->db = $ db ;
64
+ $ this ->template = $ template ;
53
65
}
54
66
55
67
public static function getSubscribedEvents ()
56
68
{
57
69
return [
70
+ 'core.page_header ' => 'set_template_vars ' ,
58
71
'core.ucp_display_module_before ' => 'new_profil_avatar_text ' ,
59
72
'core.thumbnail_create_before ' => 'imcger_create_tumbnail ' ,
60
73
'core.modify_uploaded_file ' => 'imcger_modify_uploaded_file ' ,
@@ -73,6 +86,30 @@ public function new_profil_avatar_text()
73
86
}
74
87
}
75
88
89
+ /**
90
+ * Set template vars
91
+ *
92
+ * @return null
93
+ * @access public
94
+ */
95
+ public function set_template_vars ()
96
+ {
97
+ $ allowed_images = '' ;
98
+
99
+ $ sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . ' WHERE group_id = 1 ' ;
100
+ $ result = $ this ->db ->sql_query ($ sql );
101
+
102
+ while ($ row = $ this ->db ->sql_fetchrow ($ result ))
103
+ {
104
+ $ allowed_images .= '" ' . $ row ['extension ' ] . '", ' ;
105
+ }
106
+ $ this ->db -> sql_freeresult ();
107
+
108
+ $ this ->template ->assign_vars ([
109
+ 'IUL_ALLOWED_IMAGES ' => $ allowed_images ,
110
+ ]);
111
+ }
112
+
76
113
/**
77
114
* Create a thumbnail using IMagick
78
115
*
0 commit comments