Completed
Pull Request — development (#828)
by
unknown
04:33
created

settings.inc.php ➔ config_domain_test_opencaching_de()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 28
rs 9.472
c 0
b 0
f 0
1
<?php
2
/***************************************************************************
3
 *  Sample settings.inc.php file for a developer machine
4
 ***************************************************************************/
5
6
// installation paths
7
$dev_basepath = '/var/www/html/';
8
$dev_codepath = '*';
9
$dev_baseurl = 'http://docker.team-opencaching.de';
10
11
// enable HTTPS
12
if (defined('HTTPS_ENABLED')) {
13
    $opt['page']['https']['mode'] = HTTPS_ENABLED;
14
}
15
16
$opt['debug'] = true;
17
$opt['httpd']['user'] = 'application';
18
$opt['httpd']['group'] = 'application';
19
20
// show blog and forum news on index.php
21
$debug_startpage_news = false;
22
23
// common developer system settings
24
require __DIR__ . '/settings-dev.inc.php';
25
26
// database access
27
$opt['db']['servername'] = 'mariadb';
28
$opt['db']['username'] = 'root';
29
$opt['db']['password'] = 'root';
30
$opt['db']['pconnect'] = false;
31
32
$opt['db']['maintenance_user'] = 'root';
33
$opt['db']['maintenance_password'] = 'root';
34
35
// database names
36
$opt['db']['placeholder']['db'] = 'opencaching';
37
$opt['db']['placeholder']['tmpdb'] = 'octmp';
38
39
$opt['charset']['mysql'] = 'utf8mb4';
40
41
// only for local.team-opencaching.de usage
42
$opt['lib']['w3w']['apikey'] = 'X27PDW41';
43
44
// activate debug for vagrant system
45
// $opt['debug'] = true;
46
47
/* cookie or session
48
 *
49
 * SAVE_COOKIE            = only use cookies
50
 * SAVE_SESSION           = use php sessions
51
 *
52
 * to use SESSIONS set php.ini to session default values:
53
 *
54
 * session.auto_start = 0
55
 * session.use_cookies = 1
56
 * session.use_only_cookies = 0
57
 * session.cookie_lifetime = 0
58
 * session.cookie_path = "/"
59
 * session.cookie_domain = ""
60
 * session.cookie_secure = off
61
 * session.use_trans_sid = 0
62
 *
63
 * other parameters may be customized
64
 */
65
$opt['session']['cookiename'] = 'ocdevelopment'; // only with SAVE_COOKIE
66
$opt['session']['path'] = '/';
67
$opt['session']['domain'] = '.team-opencaching.de';    // may be overwritten by $opt['domain'][...]['cookiedomain']
68
69
/* Default locale and style
70
         *
71
         */
72
$opt['template']['default']['locale'] = 'DE';
73
$opt['template']['default']['style'] = 'ocstyle';
74
$opt['locale']['DE']['page']['subtitle1'] = 'Geocaching mit Opencaching';
75
$opt['locale']['DE']['page']['subtitle2'] = '';
76
$opt['page']['title'] = 'OPENCACHING.de';
77
$opt['page']['headoverlay'] = 'oc_head_alpha3_generic';
78
$opt['page']['teampic_url'] = 'https://www.opencaching.de/images/team/';
79
// data license settings
80
$opt['logic']['license']['disclaimer'] = true;
81
82
$opt['page']['banned_user_agents'] = ['Netsparker'];
83
84
// admin extensions
85
$opt['logic']['adminreports']['cachexternal']['OC-Clean'] = '';
86
$opt['logic']['adminreports']['external_maintainer']['url'] = '';
87
$opt['logic']['adminreports']['external_maintainer']['msg'] = '';
88
89
// email problems API for OCC
90
$opt['logic']['api']['email_problems']['key'] = '';
91
92
$opt['page']['banned_user_agents'] = ['Netsparker'];
93
94
/* other template options
95
         *
96
         */
97
$opt['page']['name'] = 'Geocaching mit Opencaching';
98
$opt['page']['max_logins_per_hour'] = 250;
99
$opt['mail']['from'] = '[email protected]';
100
101
/* data license options
102
 */
103
$opt['logic']['license']['admin'] = false;
104
105
/* Sponsoring advertisements
106
 * (plain HTML)
107
 */
108
$opt['page']['sponsor']['topright'] = '';
109
$opt['page']['sponsor']['bottom'] = 'Driven by the Opencaching Community';
110
$opt['page']['sponsor']['popup'] = '';
111
112
/* forum news integration (index.php)
113
 */
114
$opt['forum']['url'] = 'https://forum.opencaching.de/index.php?action=.xml;type=rss;limit=10';
115
$opt['forum']['link'] = 'http://forum.opencaching.de';
116
$opt['forum']['name'] = 'forum.opencaching.de';
117
118
/* Well known node id's - required for synchronization
119
 * 1 Opencaching Deutschland (www.opencaching.de)
120
 * 2 Opencaching Polen (www.opencaching.pl)
121
 * 3 Opencaching Tschechien (www.opencaching.cz)
122
 * 4 Local Development
123
 * 5 Opencaching Entwicklung Deutschland (devel.opencaching.de)
124
 */
125
$opt['logic']['node']['id'] = 4;
126
127
/* pregenerated waypoint list for new caches
128
 * - Waypoint prefix (OC, OP, OZ ... AA=local development)
129
 * - When pool contains less than min_count, generation process starts
130
 *   and fills up the pool until max_count is reached.
131
 */
132
$opt['logic']['waypoint_pool']['prefix'] = 'OC';
133
$opt['logic']['waypoint_pool']['min_count'] = 1000;
134
$opt['logic']['waypoint_pool']['max_count'] = 2000;
135
// chars used for waypoints. Remember to reinstall triggers and clear cache_waypoint_pool after changing
136
$opt['logic']['waypoint_pool']['valid_chars'] = '0123456789ABCDEF';
137
// fill_gaps = true: search for gaps between used waypoints and fill up these gaps
138
//                   (fill_gaps is slow and CPU intensive on database server. For
139
//                    productive servers you may want to generate some waypoints
140
//                    without fill_gaps first)
141
// fill_gaps = false: continue with the last waypoint
142
$opt['logic']['waypoint_pool']['fill_gaps'] = false;
143
144
/* cracklib-check for users passwords enabled?
145
 * (requires php extension crack_check)
146
 */
147
$opt['logic']['cracklib'] = false;
148
149
/* News configuration
150
 *
151
 * filename to the include file containing the newscontent
152
 * (RSS format)
153
 * if no filename is given, the own news-code is used
154
 * (table news and newstopic.php)
155
 *
156
 * you have to correct entries in table sys_menu and
157
 * lang/de/stdtyle/lib/menu.php respectively
158
 */
159
$opt['news']['include'] = 'http://blog.opencaching.de/feed/';
160
$opt['news']['count'] = 8;
161
$opt['news']['timeout'] = 10;
162
163
/* current forum topcis on start page
164
 * requires url to be a vaild rss feed
165
 *  show the number of 'count' topics from rss feed
166
*/
167
$opt['forum']['url'] = 'http://forum.opencaching.de/index.php?action=.xml;type=rss;limit=50';
168
$opt['forum']['count'] = 10;
169
$opt['forum']['timeout'] = 10;
170
171
/* Wiki news on the 404 page
172
*/
173
$opt['wikinews']['timeout'] = 10;
174
175
// redirect news.php to the following url
176
$opt['news']['redirect'] = 'http://blog.opencaching.de';
177
178
$opt['page']['showdonations'] = true;
179
$opt['page']['showsocialmedia'] = true;
180
181
182
/*
183
* configure infos on 404.php
184
*/
185
$opt['page']['404']['test.opencaching.de'] = [
186
    'blog' => [
187
        'show' => true,
188
        'feedurl' => $opt['news']['include'],
189
        'url' => $opt['news']['redirect'],
190
    ],
191
    'forum' => [
192
        'show' => true,
193
        'feedurl' => $opt['forum']['url'],
194
        'url' => 'http://forum.opencaching.de',
195
    ],
196
    'wiki' => [
197
        'show' => true,
198
        'feedurl' => 'http://wiki.opencaching.de/index.php/Spezial:Neue_Seiten?feed=rss',
199
        'url' => 'http://wiki.opencaching.de',
200
    ],
201
    'newcaches' => [
202
        'show' => true,
203
        'url' => 'http://test.opencaching.de',
204
    ],
205
];
206
207
208
/* domain specific configuration
209
* will be loaded when all standard include files are processed
210
* (db-connection exists, menu is loaded, user login validated etc.)
211
* Take caution on caching issues (!)
212
*/
213
214
$opt['map']['towns']['enable'] = true;  // for releasing v14
215
216
define('MNU_INFO', 1015);
217
define('MNU_TEAMBLOG', 1016);
218
define('MNU_FORUM', 1017);
219
define('MNU_CHAT', 1018);
220
define('MNU_GEOKRETY', 1019);
221
define('MNU_API', 1020);
222
223
function post_config(): void
0 ignored issues
show
Best Practice introduced by
The function post_config() has been defined more than once; this definition is ignored, only the first definition in htdocs/config2/settings-sample.inc.php (L212-231) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
224
{
225
    global $opt, $menuitem, $tpl, $translate;
226
227
    $domain = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
228
    if ($domain == '') {
229
        return;
230
    }
231
232
    $menuitem[MNU_INFO] = [
233
        'title' => 'Wiki',
234
        'menustring' => 'Wiki',
235
        'authlevel' => 0,
236
        'href' => 'https://' . $domain . '/articles.php?page=helpindex&wiki',
237
        'visible' => 1,
238
        'sublevel' => 1,
239
    ];
240
    $menuitem[0]['subitems'][] = MNU_INFO;
241
242
    config_domain_test_opencaching_de();
243
244
245
    // Link to Geokrety
246
    $menuitem[MNU_GEOKRETY] = [
247
        'title' => 'Geokrety',
248
        'menustring' => 'Geokrety',
249
        'authlevel' => 0,
250
        'href' => 'https://www.geokrety.org/',
251
        'target' => 'target="_blank"',
252
        'visible' => 1,
253
        'sublevel' => 1,
254
    ];
255
    $menuitem[0]['subitems'][] = MNU_GEOKRETY;
256
257
    $menuitem[MNU_API] = [
258
        'title' => 'API',
259
        'menustring' => 'API',
260
        'authlevel' => 0,
261
        'href' => 'http://docker.team-opencaching.de/okapi',
262
# OKAPI does not support https yet
263
        'visible' => 1,
264
        'sublevel' => 1,
265
    ];
266
    $menuitem[0]['subitems'][] = MNU_API;
267
}
268
269
function config_domain_test_opencaching_de(): void
270
{
271
    global $opt, $menuitem, $login, $translate;
272
273
    $opt['page']['headoverlay'] = 'oc_head_alpha3';
274
    $opt['cms']['login'] = 'http://wiki.opencaching.de/index.php/Login';
275
276
    /* add additional main menu links
277
    */
278
    $menuitem[MNU_TEAMBLOG] = [
279
        'title' => 'Teamblog',
280
        'menustring' => 'Teamblog',
281
        'authlevel' => 0,
282
        'href' => 'http://blog.opencaching.de/',
283
        'visible' => 1,
284
        'sublevel' => 1,
285
    ];
286
    $menuitem[MNU_FORUM] = [
287
        'title' => 'Forum',
288
        'menustring' => 'Forum',
289
        'authlevel' => 0,
290
        'href' => 'http://forum.opencaching.de',
291
        'visible' => 1,
292
        'sublevel' => 1,
293
    ];
294
    $menuitem[0]['subitems'][] = MNU_TEAMBLOG;
295
    $menuitem[0]['subitems'][] = MNU_FORUM;
296
}
297