1: <?php
2: /*
3: * SimpleID
4: *
5: * Copyright (C) Kelvin Mo 2014-2025
6: *
7: * This program is free software; you can redistribute it and/or
8: * modify it under the terms of the GNU General Public
9: * License as published by the Free Software Foundation; either
10: * version 2 of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program; if not, write to the Free
19: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: */
21:
22: namespace SimpleID\Protocols;
23:
24: use \Base;
25: use SimpleID\Util\ArrayWrapper;
26: use SimpleID\Util\UI\Template;
27:
28: /**
29: * A class representing a response to be rendered using an HTML
30: * form.
31: */
32: class FormResponse extends ArrayWrapper {
33: /**
34: * Creates a form response.
35: *
36: * @param array<string, string> $data the initial response parameters
37: */
38: public function __construct($data = []) {
39: parent::__construct($data);
40: }
41:
42: /**
43: * Renders the response as a POST request.
44: *
45: * @param string $url the URL to which the response is sent
46: * @return void
47: */
48: public function render($url) {
49: $f3 = Base::instance();
50: $tpl = Template::instance();
51:
52: $f3->set('page_class', 'is-dialog-page is-loading');
53: $f3->set('title', $f3->get('intl.common.please_wait'));
54: $f3->set('layout', 'post.html');
55: $f3->set('url', $url);
56: $f3->set('params', $this->container);
57:
58: header('X-Frame-Options: DENY');
59: print $tpl->render('page.html');
60: }
61: }
62:
63: ?>