-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
101 lines (90 loc) · 2.46 KB
/
Copy pathbootstrap.php
File metadata and controls
101 lines (90 loc) · 2.46 KB
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
<?php
// We'll use output buffering because the frontend code of this site is ported
// from an ancient system that doesn't separate logic from markup.
ob_start();
session_start();
define('BASE_PATH',dirname(__FILE__).'/');
require_once(BASE_PATH.'inc/autoload.php');
// Include the config file if we can find it, or die gracefully.
if(file_exists(BASE_PATH.'conf/config.php'))
{
require_once(BASE_PATH.'conf/config.php');
}
else
{
util::custom_die('Could not load config! Copy conf/config.php.sample to conf/config.php and fill it out.');
}
util::append_title(SITE_TITLE);
if(empty($_SESSION['loggedin']))
{
if(!empty($_COOKIE['username']))
{
$status = user_api::login($_COOKIE['username'], false, true, true);
}
if(empty($status))
{
$_SESSION['loggedin'] = false;
}
}
// Page requires login
if(defined('SECURE') && SECURE)
{
if(!$_SESSION['loggedin'])
{
util::location(RELATIVEPATH.'login.php');
}
}
// Page requires you to not be logged in
if(defined('SECURE') && !SECURE)
{
if($_SESSION['loggedin'])
{
util::location(RELATIVEPATH.'index.php');
}
}
if(!defined('NOWRAPPER'))
{
if(!$_SESSION['loggedin'])
{
// Get number of validated FS2NetD users
$rec = user_api::new_search_record();
$rec->set_banned(0);
$count_pxo_users = user_api::get_count($rec);
// Get number of total pilots in FS2NetD
$rec = fsopilot_api::new_search_record();
$res = fsopilot_api::search($rec);
$get_fs2_pilots = $res->get_results();
$count_fs2_pilots = count($get_fs2_pilots);
// Get number of unique players that have created a pilot in FS2NetD
$players = array();
foreach($get_fs2_pilots as $pilot)
{
if(!in_array($pilot->get_user_id(), $players))
{
$players[] = $pilot->get_user_id();
}
}
$count_fs2_players = count($players);
// Get number of total squads in FS2NetD
$rec = squad_api::new_search_record();
$count_sw_squads = squad_api::get_count($rec);
}
else
{
// Get number of pilots the current user has in FS2NetD
$rec = fsopilot_api::new_search_record();
$rec->set_user_id($_SESSION['user_id']);
$count_fs2_pilots = fsopilot_api::get_count($rec);
$_SESSION['totalfsopilots'] = $count_fs2_pilots;
}
$rec = new league_record_search();
$rec->set_Active(1);
$rec->set_sort_by('League_ID');
$res = league_api::search($rec);
$get_swleagues = $res->get_results();
$rec = new league_record_search();
$rec->set_Archived(1);
$rec->set_sort_by('League_ID');
$res = league_api::search($rec);
$get_old_swleagues = $res->get_results();
}