3 * FusionForge login form functions
5 * Copyright 2011, Roland Mas
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 use_javascript('/tabber/tabber.js');
25 function validate_return_to(&$return_to = '/') {
29 $tmpreturn=explode('?',$return_to);
30 $rtpath = $tmpreturn[0] ;
32 if (@is_file(forge_get_config('url_root').$rtpath)
33 || @is_dir(forge_get_config('url_root').$rtpath)
34 || (strpos($rtpath,'/projects') == 0)
35 || (strpos($rtpath,'/plugins/mediawiki') == 0)) {
43 function display_login_page($return_to = '/', $triggered = false) {
44 display_login_form($return_to, $triggered, true);
47 function display_login_form($return_to = '/', $triggered = false, $full_page = false) {
50 validate_return_to($return_to);
53 $params['return_to'] = $return_to;
54 $params['html_snippets'] = array();
55 $params['transparent_redirect_urls'] = array();
56 plugin_hook_by_reference('display_auth_form', $params);
59 if (count($params['html_snippets']) == 1
60 && count($params['transparent_redirect_urls']) == 1) {
61 $urls = array_values($params['transparent_redirect_urls']);
62 session_redirect_external($urls[0]);
65 $HTML->header(array('title'=>'Login'));
70 echo '<div class="warning">' ;
71 echo _('You\'ve been redirected to this login page because you have tried accessing a page that was not available to you as an anonymous user.');
77 if (count ($params['html_snippets']) > 1) {
79 echo '<div id="tabber" class="tabber">';
84 foreach ($params['html_snippets'] as $p => $s) {
85 $plugin = plugin_get_object($p);
87 echo '<div class="tabbertab" title="'.$plugin->text.'">';
100 $HTML->footer(array());
106 // c-file-style: "bsd"