forked from Spb8Lighting/FixturesFinder.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
45 lines (39 loc) · 1.12 KB
/
functions.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
<?php
############################
# #
# Database #
# #
############################
//Connection initialisation
try {
$bdd = new PDO('mysql:host=' . db_host . ';dbname=' . db_name . ';charset=utf8', db_user, db_pass);
} catch (Exception $e) {
echo _ErrDBOffline_;
die();
}
############################
# #
# Class Loaders #
# #
############################
//Autoload classes
spl_autoload_register(function ($class) {
require 'class/' . $class . '.class.php';
});
//Initialize managers
$DMXChartManager = new DMXChartManager($bdd);
$Cache = new Cache();
############################
# #
# Functions #
# #
############################
function CleanVar($var) {
return strtolower(trim($var));
}
function FixtureURL($Manufacturer, $Fixture) {
return _FixtureFolder_ . '/' . urlencode($Manufacturer) . '/' . urlencode($Fixture);
}
function CacheFile($url) {
return _CacheFolder_ . preg_replace('/[\/\.]/', '', $url);
}