forked from subins2000/open
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load.php
74 lines (68 loc) · 1.71 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
<?php
$docRoot = realpath(__DIR__);
define("docRoot", $docRoot);
/* Load the configuration */
require_once "$docRoot/config.php";
require_once "$docRoot/inc/class.open.php";
require_once "$docRoot/inc/class.logsys.php";
$db = unserialize(DATABASE);
\Fr\LS::$config = array(
"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" => "cantMakePublic",
/**
* `salt` should not be changed after users are created
*/
"salt" => "cantMakePublic"
),
"pages" => array(
"no_login" => array(
"/",
"/register",
"/me/ResetPassword"
),
"login_page" => "/login",
"home_page" => "/home"
),
"features" => array(
"email_login" => false
)
);
\Fr\LS::construct();
/* 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();
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");
}
?>