-
Notifications
You must be signed in to change notification settings - Fork 50
/
load.php
executable file
·89 lines (80 loc) · 1.99 KB
/
load.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
<?php
$docRoot = realpath(__DIR__);
define("docRoot", $docRoot);
date_default_timezone_set("UTC");
/**
* Load the configuration
*/
require_once "$docRoot/config.php";
$GLOBALS['cfg'] = $cfg;
require_once "$docRoot/inc/class.open.php";
require_once "$docRoot/inc/class.logsys.php";
$db = unserialize(DATABASE);
\Fr\LS::config(array(
"basic" => array(
"email_callback" => function($email, $subject, $body){
\Open::sendEMail($email, $subject, $body);
}
),
"db" => array(
"host" => $db['host'],
"port" => $db['port'],
"name" => $db['name'],
"username" => $db['user'],
"password" => $db['pass'],
"table" => "users"
),
/**
* Keys used for encryption
* DONT MAKE THIS PUBLIC
*/
"keys" => array(
/**
* Changing cookie key will expire all current active login sessions
*/
"cookie" => $cfg["logsys"]["cookie_key"],
/**
* `salt` should not be changed after users are created
*/
"salt" => $cfg["logsys"]["password_salt"]
),
"pages" => array(
"no_login" => array(
"/",
"/register",
"/me/ResetPassword"
),
"login_page" => "/login",
"home_page" => "/home"
),
"features" => array(
"email_login" => true
),
"cookies" => array(
"domain" => CLEAN_HOST
)
));
/* Basic Variables */
$loggedIn = \Fr\LS::$loggedIn; /* Boolean on status of current user (logged in or not) */
$who = \Fr\LS::$user; /* The current user */
/* Global Variables */
$_P = count($_POST) > 0 ? true : false; /* Boolean Variable whether POST data is sent with the request */
define("loggedIn", $loggedIn);
define("curUser", $who);
$OP = new Open();
$GLOBALS['OP'] = $OP;
if(!function_exists("get")){
function get($key, $uid = "", $json = true){
global $OP;
return $OP->get($key, $uid, $json);
}
}
/* Do these if user is logged in */
if( loggedIn && !isset($uimg) ){
$uimg = get("img");
$uaimg = get("avatar");
$uname = get("name", "", false);
/* Update the last seen time */
$OP->save("seen");
}
?>