This repository has been archived by the owner on Feb 21, 2019. It is now read-only.
forked from emaijala/MLInvoice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
50 lines (41 loc) · 1.65 KB
/
settings.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
<?php
/*******************************************************************************
MLInvoice: web-based invoicing application.
Copyright (C) 2010-2015 Ere Maijala
This program is free software. See attached LICENSE.
*******************************************************************************/
/*******************************************************************************
MLInvoice: web-pohjainen laskutusohjelma.
Copyright (C) 2010-2015 Ere Maijala
Tämä ohjelma on vapaa. Lue oheinen LICENSE.
*******************************************************************************/
require_once 'config.php';
require_once 'localize.php';
mb_internal_encoding(_CHARSET_);
function getSetting($name)
{
// The cache only lives for a single request to speed up repeated requests for a setting
static $settingsCache = [];
if (isset($settingsCache[$name])) {
return $settingsCache[$name];
}
require 'settings_def.php';
if (isset($arrSettings[$name]) && isset($arrSettings[$name]['session']) &&
$arrSettings[$name]['session']) {
if (isset($_SESSION[$name]))
return $_SESSION[$name];
} else {
$res = mysqli_param_query('SELECT value from {prefix}settings WHERE name=?',
[
$name
]);
if ($row = mysqli_fetch_assoc($res)) {
$settingsCache[$name] = $row['value'];
return $settingsCache[$name];
}
}
$settingsCache[$name] = isset($arrSettings[$name]) &&
isset($arrSettings[$name]['default']) ? cond_utf8_decode(
$arrSettings[$name]['default']) : '';
return $settingsCache[$name];
}