@@ -24,6 +24,7 @@ static public function getSubscribedEvents()
2424 return array (
2525 'core.page_header ' => 'page_header ' ,
2626 'core.user_add_modify_data ' => 'user_add_modify ' ,
27+ 'core.page_footer ' => 'page_footer ' ,
2728 );
2829 }
2930
@@ -36,6 +37,9 @@ static public function getSubscribedEvents()
3637 /** @var \phpbb\config\db_text */
3738 protected $ config_text ;
3839
40+ /** @var \phpbb\request\request */
41+ protected $ request ;
42+
3943 /** @var \phpbb\template\template */
4044 protected $ template ;
4145
@@ -63,6 +67,7 @@ static public function getSubscribedEvents()
6367 * @param \phpbb\auth\auth $auth Auth object
6468 * @param \phpbb\config\config $config
6569 * @param \phpbb\config\db_text $config_text
70+ * @param \phpbb\request\request $request
6671 * @param \phpbb\template\template $template Template object
6772 * @param \phpbb\controller\helper $helper Helper
6873 * @param \phpbb\language\language $language
@@ -77,6 +82,7 @@ public function __construct(
7782 \phpbb \controller \helper $ helper ,
7883 \phpbb \user $ user ,
7984 \phpbb \language \language $ language ,
85+ \phpbb \request \request $ request ,
8086 \phpbb \template \template $ template ,
8187 $ phpbb_root_path ,
8288 $ php_ext )
@@ -90,6 +96,7 @@ public function __construct(
9096 $ this ->user = $ user ;
9197 $ this ->language =$ language ;
9298 $ this ->template = $ template ;
99+ $ this ->request = $ request ;
93100 }
94101
95102 public function page_header ($ event )
@@ -163,6 +170,51 @@ public function page_header($event)
163170 redirect ($ this ->helper ->route ('phpbbde_tou_main_controller ' , [], false , false , \Symfony \Component \Routing \Generator \UrlGeneratorInterface::ABSOLUTE_URL ));
164171 }
165172
173+ // Overwrite AGREEMENT_TEXT for ToU or PP
174+ public function page_footer ()
175+ {
176+ $ mode = $ this ->request ->variable ('mode ' , '' );
177+ if (($ mode == 'terms ' ) && ($ this ->config ['tou_use_custom_tou ' ]))
178+ {
179+ $ tou_data = $ this ->config_text ->get_array (array (
180+ 'tou_custom_tou_text ' ,
181+ 'tou_custom_tou_uid ' ,
182+ 'tou_custom_tou_bitfield ' ,
183+ 'tou_custom_tou_flags ' ,
184+ ));
185+
186+ $ tou_custom_tou_text = generate_text_for_display (
187+ $ tou_data ['tou_custom_tou_text ' ],
188+ $ tou_data ['tou_custom_tou_uid ' ],
189+ $ tou_data ['tou_custom_tou_bitfield ' ],
190+ $ tou_data ['tou_custom_tou_flags ' ]
191+ );
192+ $ this ->template ->assign_vars (array (
193+ 'AGREEMENT_TEXT ' => sprintf ($ tou_custom_tou_text , $ this ->config ['sitename ' ], generate_board_url ()),
194+ ));
195+ }
196+ else if (($ mode == 'privacy ' ) && ($ this ->config ['tou_use_custom_pp ' ]))
197+ {
198+ $ pp_data = $ this ->config_text ->get_array (array (
199+ 'tou_custom_pp_text ' ,
200+ 'tou_custom_pp_uid ' ,
201+ 'tou_custom_pp_bitfield ' ,
202+ 'tou_custom_pp_flags ' ,
203+ ));
204+
205+ $ tou_custom_pp_text = generate_text_for_display (
206+ $ pp_data ['tou_custom_pp_text ' ],
207+ $ pp_data ['tou_custom_pp_uid ' ],
208+ $ pp_data ['tou_custom_pp_bitfield ' ],
209+ $ pp_data ['tou_custom_pp_flags ' ]
210+ );
211+ $ this ->template ->assign_vars (array (
212+ 'AGREEMENT_TEXT ' => sprintf ($ tou_custom_pp_text , $ this ->config ['sitename ' ], generate_board_url ()),
213+ ));
214+ }
215+ }
216+
217+
166218 public function user_add_modify ($ event )
167219 {
168220 $ sql_ary = $ event ['sql_ary ' ];
0 commit comments