index.php 3.3 KB
Newer Older
1
2
<?php
/**
3
 * This program is part of Mahara
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 * @package    mahara
20
21
 * @subpackage core
 * @author     Penny Leach <penny@catalyst.net.nz>
22
23
24
25
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
 *
 */

27
28
29
30
define('INTERNAL', 1);
define('PUBLIC', 1);
define('MENUITEM', 'home');

31
32
require('init.php');

33
34
// Check for whether the user is logged in, before processing the page. After
// this, we can guarantee whether the user is logged in or not for this page.
35
36
if (!$SESSION->is_logged_in()) {
    require_once('form.php');
37
    $loginform = get_login_form_js(form(array(
38
39
40
41
42
43
44
45
46
47
48
        'name'     => 'login',
        'renderer' => 'div',
        'submit'   => false,
        'elements' => array(
            'login' => array(
                'type'   => 'fieldset',
                'legend' => get_string('login'),
                'elements' => array(
                    'login_username' => array(
                        'type'        => 'text',
                        'title'       => get_string('username'),
49
                        'description' => get_string('usernamedescription'),
50
51
52
53
54
55
56
57
                        'help'        => get_string('usernamehelp'),
                        'rules' => array(
                            'required'    => true
                        )
                    ),
                    'login_password' => array(
                        'type'        => 'password',
                        'title'       => get_string('password'),
58
                        'description' => get_string('passworddescription'),
59
60
61
62
63
64
65
66
67
68
69
70
71
72
                        'help'        => get_string('passwordhelp'),
                        'value'       => '',
                        'rules' => array(
                            'required'    => true
                        )
                    )
                )
            ),

            'submit' => array(
                'type'  => 'submit',
                'value' => get_string('login')
            ),
            'register' => array(
73
74
                'value' => '<div><a href="' . get_config('wwwroot') . 'register.php">' . get_string('register') . '</a> '
                    . '| <a href="' . get_config('wwwroot') . 'forgotpass.php">' . get_string('forgotpassword') . '</a></div>'
75
76
            )
        )
77
    )));
Richard Mansfield's avatar
Richard Mansfield committed
78
79
80
81
    $pagename = 'loggedouthome';
}
else {
    $pagename = 'home';
82
83
}

84
85
$smarty = smarty();
if (!$SESSION->is_logged_in()) {
86
    $smarty->assign('login_form', $loginform);
87
}
Richard Mansfield's avatar
Richard Mansfield committed
88
$smarty->assign('page_content', get_site_page_content($pagename));
89
$smarty->assign('site_menu', site_menu());
90
$smarty->display('index.tpl');
91

92
?>