Completed
Pull Request — master (#257)
by Matthew
03:28
created

config.inc.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 296 and the first side effect is on line 27.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**************************************************************************
3
**********      English Wikipedia Account Request Interface      **********
4
***************************************************************************
5
** Wikipedia Account Request Graphic Design by Charles Melbye,           **
6
** which is licensed under a Creative Commons                            **
7
** Attribution-Noncommercial-Share Alike 3.0 United States License.      **
8
**                                                                       **
9
** All other code are released under the Public Domain                   **
10
** by the ACC Development Team.                                          **
11
**                                                                       **
12
** See CREDITS for the list of developers.                               **
13
***************************************************************************/
14
15
/**************************************************************************
16
**********                   IMPORTANT NOTICE                    **********
17
***************************************************************************
18
** YOU MUST OVERRIDE THE CONFIGURATION IN THIS FILE WITH A LOCAL COPY!!! **
19
** IT IS VERY IMPORTANT THAT THAT FILE IS CALLED config.local.inc.php    **
20
***************************************************************************/
21
22
/*********************************
23
 * Databases and stuff
24
 */
25
26
// Main database location and access details.
27
$toolserver_username = "";
28
$toolserver_password = "";
29
$toolserver_host = "";
30
$toolserver_database = "";
31
32
$toolserver_notification_database = "notifications";
33
$toolserver_notification_dbhost = "dbmaster.srv.stwalkerster.net";
34
$notifications_username = "";
35
$notifications_password = "";
36
37
// The antispoof configuration.
38
$antispoof_equivset = "equivset.php";
39
$antispoof_host = "sql-s1";
40
$antispoof_db = "enwiki_p";
41
$antispoof_table = "spoofuser";
42
43
/**********************************
44
 * File paths etc
45
 */
46
47
// Does nothing yet, intended for further localization.
48
$wikiurl = "en.wikipedia.org";
49
50
$mediawikiWebServiceEndpoint = "https://en.wikipedia.org/w/api.php";
51
$mediawikiScriptPath = "https://en.wikipedia.org/w/index.php";
52
53
// URL of the current copy of the tool.
54
$baseurl = "https://accounts.wmflabs.org";
55
56
// Root pathname of the local installation of the tool.
57
$filepath = "/projects/acc/www/"; 
58
59
// Pathname to the local installation of Peachy.
60
$peachyPath = ""; 
61
62
// Location outside web directory to place temporary files.
63
$varfilepath = "/projects/acc/"; 
64
65
// Set up cookies and session information.
66
$cookiepath = '/acc/';
67
$sessionname = 'ACC';
68
69
$xff_trusted_hosts_file = '../TrustedXFF/trusted-hosts.txt';
70
/************************************
71
 * Tool downtime
72
 */
73
74
$dontUseDb = 0; // Disable the tool completely.
75
$dontUseWikiDb = 0; // Disable access to the Wiki database.
76
$dontUseDbReason = ""; // Reason for disabling the tool.
77
$dontUseDbCulprit = ""; // Your name, or the person who broke the tool.
78
	
79
/**************************************
80
 * ACCBot IRC bot
81
 */
82
83
$ircBotDaemonise = true; // Run the IRC bot as a daemon, detached from the terminal.
84
85
$ircBotNickServPassword = ""; // Password for ACCBot's Nickserv account.
86
$ircBotCommunicationKey = ""; // Key used to communicate with the ACCBot.
87
$ircBotNetworkHost = "chat.freenode.net"; // The host to use for connecting.
88
$ircBotNetworkPort = 6667; // The port on the particular host.
89
$ircBotChannel = "#wikipedia-en-accounts"; // The channel in which the discussions are.
90
$ircBotNickname = "ACCBot"; // The nickname of the ACCBot.
91
$ircBotCommandTrigger = '!'; // The ACCBot's command trigger.
92
93
$ircBotNotificationType = 1; // Helpmebot's notification type ID.
94
$ircBotNotificationsEnabled = 1; // Enable Helpmebot's notifications.
95
// Name of this instance of the tool.
96
// This name would be used by the bot as reference point.	
97
$whichami = 'Live';
98
99
/***************************************
100
 * Email confirmation
101
 */
102
103
// Enable request email confirmation.
104
$enableEmailConfirm = 1; 	
105
// Number of days that are given for a requestor to confirm their email address.
106
$emailConfirmationExpiryDays = 7;
107
108
/**************************************
109
 * Interface registration, interface users, etc.
110
 */
111
112
// Parameters for performing a newbie check on tool registration.
113
$onRegistrationNewbieCheck = true; // Enable the newbie checking.
114
$onRegistrationNewbieCheckEditCount = 20; // Minimum amount of edits on Wikipedia.
115
$onRegistrationNewbieCheckAge = 5184000; // Account age on Wikipedia in seconds.
116
117
// Force identification to the foundation
118
$forceIdentification = true;
119
120
// minimum password version
121
//   0 = hashed
122
//   1 = hashed, salted
123
$minimumPasswordVersion = 0;
124
125
$communityUsername = "[Community]";
126
127
/***********************************
128
 * Reservations
129
 */
130
131
// Reserve requests to a specific user by default.
132
// Adapted from livehack by st - use the userid, zero for unreserved.
133
$defaultReserver = 0;
134
135
/************************************
136
 * Backup Configuration
137
 */
138
139
$BUbasefile = "backup"; // The basefile's name.
140
$BUdir = "/home/project/a/c/c/acc/backups"; // The directory where backups should be stored.
141
$BUmonthdir = $BUdir . "/monthly"; // The directory where monthly backups should be stored.
142
$BUdumper = "/opt/ts/mysql/5.1/bin/mysqldump --defaults-file=~/.my.cnf p_acc_live"; // Add parameters here if they are needed.
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 126 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
143
$BUgzip = "/usr/bin/gzip"; // Add the gzip parameters here if needed.
144
$BUtar = "/bin/tar -cvf"; // Add the tar parameters here if needed.
145
146
/************************************
147
 * OAuth Configuration
148
 */
149
150
$oauthConsumerToken = "";
151
$oauthSecretToken = "";
152
153
// path to Special:OAuth on target wiki.
154
// don't use pretty urls, see [[bugzilla:57500]]
155
$oauthBaseUrl = "https://en.wikipedia.org/w/index.php?title=Special:OAuth";
156
// use this for requests from the server, if some special url is needed.
157
$oauthBaseUrlInternal = "https://en.wikipedia.org/w/index.php?title=Special:OAuth";
158
159
$oauthMediaWikiCanonicalServer = "http://en.wikipedia.org";
160
161
$useOauthSignup = true;
162
$enforceOAuth = false;
163
164
/************************************
165
 * Providers Configuration
166
*/
167
168
// IP GeoLocation
169
// ------------------------
170
// To set this up, change the class to "IpLocationProvider", and put *your* ipinfodb API key in.
171
// You'll need to sign up at IpInfoDb.com to get an API key - it's free.
172
$locationProviderClass = "FakeLocationProvider";
173
$locationProviderApiKey = "super secret"; // ipinfodb api key
174
175
// RDNS Provider ( RDnsLookupProvider / CachedRDnsLookupProvider / FakeRDnsLookupProvider)
176
$rdnsProviderClass = "CachedRDnsLookupProvider";
177
178
$antispoofProviderClass = "FakeAntiSpoofProvider";
179
$xffTrustProviderClass = "XffTrustProvider";
180
181
/***********************************
182
 * Data clear script
183
 */
184
185
$dataclear_interval = '15 DAY';
186
$cDataClearIp = '127.0.0.1';
187
$cDataClearEmail = '[email protected]';
188
189
/***********************************
190
 * Other stuff that doesn't fit in.
191
 */
192
193
$enableSQLError = 0; // Enable the display of SQL errors.
194
$showGraphs = 1; // Show graphs on statistics pages.
195
$enableTitleblacklist = 0; // Enable Title Blacklist checks.
196
197
// Enable the use of PATH_INFO for request parameters to prettify URLs.
198
$usePathInfo = true;
199
200
// user agent of the tool.
201
$toolUserAgent = "Wikipedia-ACC Tool/0.1 (+https://accounts.wmflabs.org/team.php)";
202
203
// list of squid proxies requests go through.
204
$squidIpList = array();
205
206
$apiDeployPassword = "super secret update password";
207
208
// request states
209
$availableRequestStates = array(
210
	'Open' =>array(
211
		'defertolog' => 'users', // don't change or you'll break old logs
212
		'deferto' => 'users', 
213
		'header' => 'Open requests',
214
		'api' => "open",
215
		),
216
	'Flagged users'=>array(
217
		'defertolog' => 'flagged users', // don't change or you'll break old logs
218
		'deferto' => 'flagged users',
219
		'header' => 'Flagged user needed',
220
		'api' => "admin",
221
		),
222
	'Checkuser'=>array(
223
		'defertolog' => 'checkusers', // don't change or you'll break old logs
224
		'deferto' => 'checkusers', 
225
		'header' => 'Checkuser needed',
226
		'api' => "checkuser",
227
		),
228
	);
229
	
230
$defaultRequestStateKey = 'Open';
231
232
// CORS
233
$CORSallowed = array(
234
	"http://en.wikipedia.org",
235
	"https://en.wikipedia.org",
236
	"http://meta.wikimedia.org",
237
	"https://meta.wikimedia.org");
238
239
$providerCacheExpiry = $dataclear_interval;
240
241
// miser mode
242
$requestLimitThreshold = 50;
243
$requestLimitShowOnly = 25;
244
245
// rfc 1918
246
$rfc1918ips = array(
247
	"10.0.0.0" => "10.255.255.255",
248
	"172.16.0.0" => "172.31.255.255",
249
	"192.168.0.0" => "192.168.255.255",
250
	"169.254.0.0" => "169.254.255.255",
251
	"127.0.0.0" => "127.255.255.255",
252
);
253
254
// Enables the Smarty debugging console. This should only be used for development and even then
255
// be left false when you don't need it, since this will open a popup window on every page load.
256
$smartydebug = false;
257
258
// Enables logging all SQL queries. This is a performance hit, so only enable it when needed.
259
$enableQueryLog = false;
260
261
// ID of the Email template used for the main "Created!" close reason.
262
$createdid = 1;
263
264
// HSTS expiry - use false to disable header.
265
$strictTransportSecurityExpiry = false;
266
267
/**************************************************************************
268
**********                   IMPORTANT NOTICE                    **********
269
***************************************************************************
270
**     DON'T ADD ANY NEW CONFIGURATION OPTIONS BELOW THIS LINE!!!        **
271
**     THEY WILL NOT BE CHANGABLE BY THE LOCAL CONFIGURATION FILE.       **
272
***************************************************************************/
273
274
// Retriving the local configuration file.
275
require_once('config.local.inc.php');
276
277
$cDatabaseConfig = array(
278
	"acc" => array(
279
		"dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database,
280
		"username" => $toolserver_username,
281
		"password" => $toolserver_password
282
	),
283
	"wikipedia" => array(
284
		"dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db,
285
		"username" => $toolserver_username,
286
		"password" => $toolserver_password
287
	),
288
	"notifications" => array(
289
		"dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database,
290
		"username" => $notifications_username,
291
		"password" => $notifications_password
292
	),
293
);
294
295
// //Keep the included files from being executed.
296
define("ACC", 1);
297
298
// Sets the values of the cookie configuration options.
299
ini_set('session.cookie_path', $cookiepath);
300
ini_set('session.name', $sessionname);
301
ini_set('user_agent', $toolUserAgent);
302
303
foreach (array( 
304
	"mbstring", // unicode and stuff
305
	"pdo", "pdo_mysql", // new database module
306
	"session", "date", "pcre", // core stuff
307
	"curl", // mediawiki api access etc
308
	"mcrypt", "openssl", // password encryption etc
309
	) as $x) {if (!extension_loaded($x)) {die("extension $x is required."); }}
310
311
require_once($filepath . "includes/AutoLoader.php");
312
313
spl_autoload_register("AutoLoader::load");
314
315
// Extra includes which are just plain awkward wherever they are.
316
require_once($filepath . 'oauth/OAuthUtility.php');
317
require_once($filepath . 'lib/mediawiki-extensions-OAuth/lib/OAuth.php');
318
require_once($filepath . 'lib/mediawiki-extensions-OAuth/lib/JWT.php');
319