-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
64 lines (50 loc) · 1.69 KB
/
index.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
<?php
/**
* Checks if the web server has enable 'mod_rewrite'
*/
if(!in_array('mod_rewrite', apache_get_modules())){
exit("<b>Please enable mod_rewrite in you Apache!
Stopping startup.</b>");
}
define('ROOT', dirname(__DIR__) . DIRECTORY_SEPARATOR);
define('CONFIG', ROOT . 'config' . DIRECTORY_SEPARATOR);
// load the application config (error reporting, constants, etc.)
require CONFIG . 'config.php';
// autoloader function, does load all classes except the main entry point see below
require ROOT . 'vendor/autoload.php';
// load application class
require APP . 'Application.php';
ini_set('memory_limit','256M');
if(!file_exists(DB_FILE)){
$database = new PDO('sqlite:' . DB_FILE);
// Create tables
$sql_file_name = DB . 'sql/create_tables.sql';
$sql_file = file_get_contents($sql_file_name);
$database->exec($sql_file);
// Fill tables
$sql_file_name = DB . 'sql/fill_tables.sql';
$sql_file = file_get_contents($sql_file_name);
$database->exec($sql_file);
// Defines how many additional offers are created. Each loop inserts 9 offers
$insertLoops = 25;
for($i = 0; $i < $insertLoops; $i++) {
$sql_file_name = DB . 'sql/fill_offer.sql';
$sql_file = file_get_contents($sql_file_name);
$database->exec($sql_file);
}
// Fill tables
$sql_file_name = DB . 'sql/zipcodes_germany.sql';
$sql_file = file_get_contents($sql_file_name);
$database->exec($sql_file);
unset($database);
}
ini_set('session.gc_maxlifetime', 10800);
session_set_cookie_params(3600);
session_start();
session_get_cookie_params();
if(ob_get_length()) {
ob_end_clean();
}
ob_start();
// boot the application
$app = Application::getInstance();