This repository was archived by the owner on Mar 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
36 lines (33 loc) · 1.46 KB
/
init.php
File metadata and controls
36 lines (33 loc) · 1.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
<?php
// Some workaround so we have absolute paths both in local and remote enviroments
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
$base_url = preg_replace("!^${doc_root}!", '', $base_dir); # ex: '' or '/mywebsite'
$protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';
$port = $_SERVER['SERVER_PORT'];
$disp_port = ($protocol == 'http' && $port == 80 || $protocol == 'https' && $port == 443) ? '' : ":$port";
$domain = $_SERVER['SERVER_NAME'];
if($domain == 'localhost')
{
$explode = explode("\\", $base_dir);
$base_url = "${protocol}://${domain}${disp_port}/${explode[3]}"; # Ex: 'http://localhost', 'https://localhost/folder', etc.
}
else
{
$base_url = "${protocol}://${domain}${disp_port}${base_url}"; # Ex: 'http://example.com', 'https://example.com/mywebsite', etc.
}
// Global vars
$author = 'speciesDatabase';
$site_name = 'speciesDatabase';
$bootstrap_cdn = 0;
$bootstrap_vsn = '4.1.3';
$bootstrap_path = $base_url.'/libraries/bootstrap-'.$bootstrap_vsn.'-dist';
$tinymce_vsn = '4.7.10';
$tinymce_path = $base_url.'/libraries/tinymce_'.$tinymce_vsn;
// To the Admin menu, needs a better place to be in the future
define('ADMIN', $base_url.'/admin/');
define('SYSTEMATICS', ADMIN.'systematics/');
define('FIELD', ADMIN.'field/');
define('MUSEUM', ADMIN.'museum/');
include_once ('includes/connect.php');
?>