@@ -31,30 +31,43 @@ class main_listener implements EventSubscriberInterface
3131 /** @var \FastImageSize\FastImageSize */
3232 protected $ imagesize ;
3333
34+ /** @var \phpbb\db\driver\driver_interface */
35+ protected $ db ;
36+
37+ /** @var \phpbb\template\template */
38+ protected $ template ;
39+
3440 /**
3541 * Constructor for listener
3642 *
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
4048 *
4149 * @access public
4250 */
4351 public function __construct
4452 (
4553 \phpbb \config \config $ config ,
4654 \phpbb \language \language $ language ,
47- \FastImageSize \FastImageSize $ imagesize
55+ \FastImageSize \FastImageSize $ imagesize ,
56+ \phpbb \db \driver \driver_interface $ db ,
57+ \phpbb \template \template $ template
4858 )
4959 {
50- $ this ->config = $ config ;
51- $ this ->language = $ language ;
60+ $ this ->config = $ config ;
61+ $ this ->language = $ language ;
5262 $ this ->imagesize = $ imagesize ;
63+ $ this ->db = $ db ;
64+ $ this ->template = $ template ;
5365 }
5466
5567 public static function getSubscribedEvents ()
5668 {
5769 return [
70+ 'core.page_header ' => 'set_template_vars ' ,
5871 'core.ucp_display_module_before ' => 'new_profil_avatar_text ' ,
5972 'core.thumbnail_create_before ' => 'imcger_create_tumbnail ' ,
6073 'core.modify_uploaded_file ' => 'imcger_modify_uploaded_file ' ,
@@ -73,6 +86,30 @@ public function new_profil_avatar_text()
7386 }
7487 }
7588
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+
76113 /**
77114 * Create a thumbnail using IMagick
78115 *
0 commit comments