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