forked from pouetnet/pouet2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.inc.php
140 lines (123 loc) · 4.61 KB
/
bootstrap.inc.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
error_reporting(E_ALL & ~E_NOTICE);
define("POUET_ROOT_LOCAL",dirname(__FILE__));
if (!file_exists(POUET_ROOT_LOCAL . "/include_generic/credentials.inc.php"))
die("Please create an include_generic/credentials.inc.php - you can use the credentials.inc.php.dist as an example");
require_once( POUET_ROOT_LOCAL . "/include_generic/credentials.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/sqllib.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/sceneid3/sceneid3.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/functions.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/libbb.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/orm.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/formifier.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/LastRss.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/csrf.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/rewriter.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/ephemeral_storage.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/sideload.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_generic/logging.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/enums.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/request-classes-base.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/request-classes-prod.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/request-classes-group.inc.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-box.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-api.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-prod.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-user.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-party.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-group.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-board.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-formprocessor.php");
require_once( POUET_ROOT_LOCAL . "/include_pouet/pouet-paginator.php");
if (POUET_TEST)
{
SQLLib::$debugMode = true;
SQLLib::$telemetry = true;
}
else
{
header('Strict-Transport-Security: max-age=2592000; includeSubDomains');
}
$lifetime = 60 * 60 * 24 * 365;
@ini_set('session.cookie_lifetime', $lifetime);
session_name("POUETSESS3");
session_set_cookie_params($lifetime, POUET_ROOT_PATH, POUET_COOKIE_DOMAIN);
@session_start();
$sceneID = null;
if (POUET_TEST && class_exists("MySceneID"))
{
$sceneID = new MySceneID( array(
"clientID" => SCENEID_USER,
"clientSecret" => SCENEID_PASS,
"redirectURI" => POUET_ROOT_URL . "login.php",
) );
}
else if (class_exists("SceneID3"))
{
$sceneID = new SceneID3( array(
"clientID" => SCENEID_USER,
"clientSecret" => SCENEID_PASS,
"redirectURI" => POUET_ROOT_URL_SECURE . "login.php",
) );
}
$currentUser = NULL;
if (get_login_id())
{
$id = get_login_id();
$host = gethostbyaddr($_SERVER["REMOTE_ADDR"]);
if ($host!==".")
{
SQLLib::Query(sprintf_esc("update users set lastip='%s', lasthost='%s', lastlogin='%s' where id=%d",
$_SERVER["REMOTE_ADDR"],$host,date("Y-m-d H:i:s"),$id));
$currentUser = PouetUser::Spawn( $id );
}
}
if (defined("POUET_EXCEPTION_LOG"))
{
set_exception_handler( function($ex){
LOG::Error($ex);
if (POUET_TEST)
{
echo "<pre>"._html($ex)."</pre>";
}
} );
}
if ($currentUser && $currentUser->IsBanned())
{
$_SESSION = $currentUser = NULL;
}
$_SESSION["keepalive"] = str_pad("",rand(1,10),"x") . rand(1,10000);
$timer["page"]["start"] = microtime_float();
$currentUserSettings = null;
if ($currentUser)
{
if ($ephemeralStorage->has( "settings:".$currentUser->id ))
{
$currentUserSettings = $ephemeralStorage->get( "settings:".$currentUser->id );
}
if (!$currentUserSettings)
{
$currentUserSettings = SQLLib::SelectRow(sprintf_esc("select * from usersettings where id=%d",$currentUser->id));
if ($currentUserSettings)
$ephemeralStorage->set( "settings:".$currentUser->id, $currentUserSettings );
}
if (!$currentUserSettings)
{
require_once("include_pouet/default_usersettings.php");
$currentUserSettings = $DEFAULT_USERSETTINGS;
$ephemeralStorage->set( "settings:".$currentUser->id, $currentUserSettings );
}
}
else
{
require_once("include_pouet/default_usersettings.php");
$currentUserSettings = $DEFAULT_USERSETTINGS;
}
$TITLE = "";
$metaValues = array();
$metaValues["og:type"] = "website";
$metaValues["og:site_name"] = "pou\xC3\xABt.net";
$RSS = array();
$linkedData = array();
$linkedData["@context"] = "https://schema.org/";
?>