forked from InvoicePlane/Migrationtool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine.php
39 lines (35 loc) · 923 Bytes
/
engine.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
<?php
/*
|
| FusionInvoice to InvoicePlane
| Database conversion tool
|
*/
// Get the request path
$requesturi = explode('?' , $_SERVER['REQUEST_URI']);
$requesturi = $requesturi[0];
$path = explode('/' , $requesturi);
// ---it---inizio base url
// Set the base_url automatically if none was provided
$base_url = '';
if ($base_url == '')
{
if (isset($_SERVER['HTTP_HOST']))
{
$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}
else
{
$base_url = 'http://localhost/';
}
}
// ---it---fine
// ---it---inizio sistema path considerando directory di base
$base_dir = trim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), '/');
if ($base_dir)
{
$path = array_slice($path, 1);
}
// ---it---fine