8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Redirection automatique en HTTPS si nécessaire
if (PREFER_HTTPS !== true && PREFER_HTTPS >= 2 && empty($_SERVER['HTTPS']) && empty($_POST))
{
utils::redirect(str_replace('http://', 'https://', utils::getSelfURL()));
exit;
}
// Query-Validate: valider les éléments passés en GET
function qv(Array $rules)
{
if (Form::validate($rules, $errors, $_GET))
{
return true;
}
foreach ($errors as &$error)
{
$error = sprintf('%s: %s', $error['name'], $error['rule']);
|
>
>
>
>
>
|
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Redirection automatique en HTTPS si nécessaire
if (PREFER_HTTPS !== true && PREFER_HTTPS >= 2 && empty($_SERVER['HTTPS']) && empty($_POST))
{
utils::redirect(str_replace('http://', 'https://', utils::getSelfURL()));
exit;
}
function f($key)
{
return \KD2\Form::get($key);
}
// Query-Validate: valider les éléments passés en GET
function qv(Array $rules)
{
if (\KD2\Form::validate($rules, $errors, $_GET))
{
return true;
}
foreach ($errors as &$error)
{
$error = sprintf('%s: %s', $error['name'], $error['rule']);
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
$tpl->assign('admin_url', WWW_URL . 'admin/');
$form = new Form;
$tpl->assign_by_ref('form_errors', $form->getErrors());
$session = Session::get();
if (!defined('Garradin\LOGIN_PROCESS'))
{
if (!$session)
{
if (Session::isOTPRequired())
{
Utils::redirect('/admin/login_otp.php');
}
else
{
Utils::redirect('/admin/login.php');
}
}
$tpl->assign('config', Config::getInstance()->getConfig());
$tpl->assign('is_logged', true);
$user = $session->getUser();
$tpl->assign('user', $user);
$tpl->assign('current', '');
$tpl->assign('plugins_menu', Plugin::listMenu());
if ($session->canAccess('membres', Membres::DROIT_ACCES))
{
$tpl->assign('nb_membres', (new Membres)->countAllButHidden());
}
}
|
>
>
<
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
$tpl->assign('admin_url', WWW_URL . 'admin/');
$form = new Form;
$tpl->assign_by_ref('form_errors', $form->getErrors());
$session = Session::get();
$tpl->assign('config', Config::getInstance()->getConfig());
if (!defined('Garradin\LOGIN_PROCESS'))
{
if (!$session)
{
if (Session::isOTPRequired())
{
Utils::redirect('/admin/login_otp.php');
}
else
{
Utils::redirect('/admin/login.php');
}
}
$tpl->assign('is_logged', true);
$user = $session->getUser();
$tpl->assign('user', $user);
$tpl->assign('current', '');
$tpl->assign('plugins_menu', Plugin::listMenu());
if ($session->canAccess('membres', Membres::DROIT_ACCES))
{
$tpl->assign('nb_membres', (new Membres)->countAllButHidden());
}
}
|