BMLT Root Server
index.php
Go to the documentation of this file.
1 <?php
2 /*
3  This file is part of the Basic Meeting List Toolbox (BMLT).
4 
5  Find out more at: https://bmlt.app
6 
7  BMLT is free software: you can redistribute it and/or modify
8  it under the terms of the MIT License.
9 
10  BMLT is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  MIT License for more details.
14 
15  You should have received a copy of the MIT License along with this code.
16  If not, see <https://opensource.org/licenses/MIT>.
17 */
18 defined('BMLT_EXEC') or die('Cannot Execute Directly'); // Makes sure that this file is in the correct context.
19 define('_LANG_COOKIE_NAME', 'bmlt_admin_lang_pref');
20 
21 global $http_vars;
22 $http_vars = array_merge($_GET, $_POST);
24 
25 // We use a cookie to store the language pref.
26 if (isset($_COOKIE) && isset($_COOKIE[_LANG_COOKIE_NAME]) && $_COOKIE[_LANG_COOKIE_NAME]) {
27  $lang_enum = $_COOKIE[_LANG_COOKIE_NAME];
28 }
29 
30 if (isset($http_vars['lang_enum']) && $http_vars['lang_enum']) {
31  $lang_enum = $http_vars['lang_enum'];
32 }
33 
34 $http_vars['lang_enum'] = $lang_enum; // Quick and dirty way to ensure that this gets properly propagated.
35 
36 $file_loc = dirname(__FILE__).'/install_wizard/index.php';
37 
38 require_once($file_loc); // We test for the install wizard, first.
39 
40 if (isset($g_enable_language_selector) && $g_enable_language_selector) {
41  $expires = time() + (60 * 60 * 24 * 365); // Expire in one year.
42  setcookie(_LANG_COOKIE_NAME, $lang_enum, $expires, '/');
43 }
44 
45 if (isset($http_vars ['bmlt_ajax_callback'])) {
46  require_once(dirname(__FILE__).'/server_admin/c_comdef_admin_ajax_handler.class.php');
47 } else {
48  ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
49  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
50 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
51  <head>
52  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
53  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
54  <meta http-equiv="Content-Script-Type" content="text/javascript" />
55  <meta http-equiv="Content-Style-Type" content="text/css" />
56  <?php
57  require_once(dirname(dirname(__FILE__)).'/server/shared/classes/comdef_utilityclasses.inc.php');
58  $config_file_path = dirname(dirname(__FILE__)).'/server/config/get-config.php';
59 
60  if (file_exists($config_file_path)) {
61  include($config_file_path);
62  }
63 
65  $shortcut_icon = $url_path."local_server/server_admin/style/images/shortcut.png";
66  $stylesheet = $url_path."local_server/server_admin/style/styles.css?v=" . time();
67 
68  require_once(dirname(dirname(__FILE__)).'/server/c_comdef_server.class.php');
69  require_once(dirname(__FILE__).'/db_connect.php');
70 
72 
74  ?>
75  <link rel="stylesheet" href="<?php echo c_comdef_htmlspecialchars($stylesheet) ?>" />
76  <link rel="icon" href="<?php echo c_comdef_htmlspecialchars($shortcut_icon) ?>" />
77  <link rel="preconnect" href="https://fonts.gstatic.com">
78  <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;700&display=swap" rel="stylesheet">
79  <title>Basic Meeting List Toolbox Administration Console</title>
80  </head>
81  <body class="admin_body">
82  <?php
83  if ($server instanceof c_comdef_server) {
84  // This throws up a tackle if someone wants to just barge in.
85  require_once(dirname(__FILE__).'/server_admin/c_comdef_login.php');
86 
87  // We can only go past here is we are a logged-in user.
88  $user_obj = $server->GetCurrentUserObj();
89  if (($user_obj instanceof c_comdef_user) && ($user_obj->GetUserLevel() != _USER_LEVEL_DISABLED)) {
90  echo '<div class="admin_page_wrapper">';
91  // OK. If they make it in here, it means they are legit, so display the logged-in console.
92  require_once(dirname(__FILE__).'/server_admin/main_console.php');
93  echo '</div>';
94  }
95  } else {
96  ?>
97  <h1>ERROR: NO SERVER!</h1>
98  <?php
99  }
100  ?>
101  </body>
102 </html>
103  <?php
104 }
105 ?>
if($handler instanceof c_comdef_admin_ajax_handler)
const _LANG_COOKIE_NAME
Definition: index.php:19
if(file_exists($config_file_path)) $url_path
Definition: index.php:64
This class handles BMLT users. One instance is created for each user on the server.
DB_Connect_and_Upgrade()
This function checks to make sure the database is correct for the current version.
Definition: db_connect.php:21
$stylesheet
Definition: index.php:66
const _USER_LEVEL_DISABLED
$lang_enum
Definition: index.php:23
global $http_vars
Definition: index.php:21
$file_loc
Definition: index.php:36
GetURLToMainServerDirectory($inAllowHTTPS=true)
Returns a URL (HTTP) to the main_server directory (or renamed).
static MakeServer()
This is the factory for the server instantiation. It makes sure that only one instance exists...
This class is the main server class. It instantiates a PDO database object, and is the starting point...
defined('BMLT_EXEC') or define('BMLT_EXEC'
Definition: index.php:3
$user_obj
Definition: index.php:7
$config_file_path
Definition: index.php:58
$shortcut_icon
Definition: index.php:65
$server
Definition: index.php:32
$_GET['switcher']