This repository has been archived by the owner on Dec 18, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathucp.php
94 lines (80 loc) · 2.3 KB
/
ucp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
*
* @package ucp
* @version $Id$
* @copyright Copyright (c) 2013, Firat Akandere
* @author Firat Akandere <f.akandere@gmail.com>
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License, version 3
*
*/
/**
* @ignore
*/
define('IN_MANGAREADER', true);
$mangareader_root_path = (defined('MANGAREADER_ROOT_PATH')) ? MANGAREADER_ROOT_PATH : './';
include($mangareader_root_path . 'common.php');
include_once($mangareader_root_path . 'includes/functions-user.php');
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$mode = request_var('mode', '');
$submit = (isset($_POST['submit'])) ? true : false;
$redirect = request_var('redirect', generate_url('', ''));
$error = array();
switch ($mode)
{
case 'login':
if ($user->data['user_id'] != ANONYMOUS)
{
redirect(generate_url('', '')); //redirect to home page
}
$data['username'] = utf8_normalize_nfc(request_var('username', '', true));
$data['password'] = utf8_normalize_nfc(request_var('password', '', true));
if ($submit)
{
if (empty($data['username']))
{
$error[] = 'LOGIN_EMPTY_USERNAME';
}
if (empty($data['password']))
{
$error[] = 'LOGIN_EMPTY_PASSWORD';
}
if (!sizeof($error))
{
if ($user->login($data['username'], $data['password']))
{
meta_refresh($redirect, 3);
trigger_error('LOGIN_SUCCESSFUL');
}
else
{
$error[] = 'LOGIN_INVALID';
}
}
}
locate_template('user_login.php', true);
break;
case 'register':
if (!$config['register_open'])
{
trigger_error('REGISTERS_CLOSED', E_USER_WARNING);
}
if (isset($_REQUEST['not_agreed']) || $user->data['user_id'] != ANONYMOUS)
{
redirect(generate_url('', '')); //redirect to home page
}
load_module('ucp', 'register');
locate_template('user_register.php', true);
break;
case 'logout':
/**
* @todo Maybe meta refresh?
*/
$user->logout($redirect);
break;
default:
break;
}
?>