This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
/
config.php
158 lines (124 loc) · 5.99 KB
/
config.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/*-------------------------------------------------------+
| Enzyme
| Copyright 2010-2015 Danny Allen <danny@enzyme-project.org>
| http://www.enzyme-project.org/
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
final class Config {
public static $framework = array('version' => '20140104');
// define app constants
public static $app = array('id' => 'commit-digest',
'name' => 'KDE Commit-Digest',
'version' => '1.42');
// define meta information
public static $meta = array('author' => 'Danny Allen',
'description' => 'A weekly overview of the development activity in KDE.',
'keywords' => 'kde, commit-digest, danny allen, dannya, plasma, akonadi, decibel, oxygen, solid, phonon, strigi');
// define locale information
public static $locale = array('language' => 'en_US',
'timezone' => 'Europe/London');
// define database settings
public static $db = array('type' => 'Mysql',
'host' => 'localhost',
'user' => 'root',
'password' => 'hello1',
'database' => 'enzyme',
'tables' => array('applications',
'bugfixers',
'commits',
'commits_reviewed',
'commit_bugs',
'commit_files',
'commit_path_filters',
'countries',
'data_terms',
'developers',
'developer_privacy',
'digests',
'digest_intro_people',
'digest_intro_sections',
'digest_intro_media',
'digest_stats',
'digest_stats_bugfixers',
'digest_stats_buzz',
'digest_stats_developers',
'digest_stats_extended',
'digest_stats_i18n',
'digest_stats_modules',
'errors',
'filetypes',
'languages',
'links',
'repositories',
'settings',
'tmp_commits',
'users'));
// define visual theme
public static $theme = array('neverland');
// define settings information
private static $settings = null;
public static function getSetting() {
$args = func_get_args();
// load Enzyme settings if not cached in object
if (!self::$settings) {
self::$settings = Enzyme::loadSettings(true);
// run setup?
if (!self::$settings) {
$setup = new SetupUi();
echo Ui::drawHtmlPage(
$setup->drawPage(),
Config::$app['name'] . ' - ' . _('Setup'),
array(
'/css/includes/common' . MINIFIED . '.css',
'/css/frame/setupui' . MINIFIED . '.css'
),
array_merge(
array(
'//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery' . MINIFIED . '.js',
'/js/index.php?script=common'
),
$setup->getScript()
)
);
exit;
}
}
// return specified setting key
if (func_num_args() == 1) {
if (isset(self::$settings[$args[0]])) {
return self::$settings[$args[0]]['value'];
} else {
Log::error('Setting not found', false, $args);
return false;
}
} else if (func_num_args() == 2) {
if (isset(self::$settings[$args[0]][$args[1]])) {
return self::$settings[$args[0]][$args[1]]['value'];
} else {
Log::error('Setting not found', false, $args);
return false;
}
}
}
public static function setSetting($args, $value, $persist = false) {
// set specified setting key
$numArgs = count($args);
if ($numArgs == 1) {
self::$settings[$args[0]]['value'] = $value;
} else if ($numArgs == 2) {
self::$settings[$args[0]][$args[1]]['value'] = $value;
} else {
Log::error('Could not save setting', false, $args);
}
return true;
}
}
?>