1 | <?php |
||||
2 | /****************************************************************************** |
||||
3 | * Wikipedia Account Creation Assistance tool * |
||||
4 | * * |
||||
5 | * All code in this file is released into the public domain by the ACC * |
||||
6 | * Development Team. Please see team.json for a list of contributors. * |
||||
7 | ******************************************************************************/ |
||||
8 | |||||
9 | /************************************************************************** |
||||
10 | ********** IMPORTANT NOTICE ********** |
||||
11 | *************************************************************************** |
||||
12 | ** YOU MUST OVERRIDE THE CONFIGURATION IN THIS FILE WITH A LOCAL COPY!!! ** |
||||
13 | ** IT IS VERY IMPORTANT THAT THAT FILE IS CALLED config.local.inc.php ** |
||||
14 | ***************************************************************************/ |
||||
15 | |||||
16 | /********************************* |
||||
17 | * Databases and stuff |
||||
18 | */ |
||||
19 | |||||
20 | // Main database location and access details. |
||||
21 | $toolserver_username = ""; |
||||
22 | $toolserver_password = ""; |
||||
23 | $toolserver_host = ""; |
||||
24 | $toolserver_database = ""; |
||||
25 | |||||
26 | /********************************** |
||||
27 | * File paths etc |
||||
28 | */ |
||||
29 | |||||
30 | $metaWikimediaWebServiceEndpoint = "https://meta.wikimedia.org/w/api.php"; |
||||
31 | |||||
32 | // URL of the current copy of the tool. |
||||
33 | $baseurl = "https://accounts.wmflabs.org"; |
||||
34 | |||||
35 | // Set up cookies and session information. |
||||
36 | $cookiepath = '/acc/'; |
||||
37 | $sessionname = 'ACC'; |
||||
38 | |||||
39 | $xff_trusted_hosts_file = '../TrustedXFF/trusted-hosts.txt'; |
||||
40 | /************************************ |
||||
41 | * Tool downtime |
||||
42 | */ |
||||
43 | |||||
44 | $dontUseDb = 0; // Disable the tool completely. |
||||
45 | $dontUseDbReason = ""; // Reason for disabling the tool. |
||||
46 | $dontUseDbCulprit = ""; // Your name, or the person who broke the tool. |
||||
47 | |||||
48 | /************************************** |
||||
49 | * ACCBot IRC bot |
||||
50 | */ |
||||
51 | |||||
52 | $ircBotNotificationsEnabled = 1; // Enable Helpmebot's notifications. |
||||
53 | // Name of this instance of the tool. |
||||
54 | // This name would be used by the bot as reference point. |
||||
55 | $whichami = 'Live'; |
||||
56 | |||||
57 | // AMQP configuration for notifications. |
||||
58 | $amqpConfiguration = ['host' => 'localhost', 'port' => 5672, 'user' => 'guest', 'password' => 'guest', 'vhost' => '/', 'exchange' => '', 'tls' => false]; |
||||
59 | |||||
60 | /*************************************** |
||||
61 | * Email confirmation |
||||
62 | */ |
||||
63 | |||||
64 | // Enable request email confirmation. |
||||
65 | $enableEmailConfirm = 1; |
||||
66 | // Number of days that are given for a requestor to confirm their email address. |
||||
67 | $emailConfirmationExpiryDays = 7; |
||||
68 | |||||
69 | /************************************** |
||||
70 | * Interface registration, interface users, etc. |
||||
71 | */ |
||||
72 | |||||
73 | $allowRegistration = true; |
||||
74 | |||||
75 | // Force identification to the foundation |
||||
76 | $forceIdentification = true; |
||||
77 | |||||
78 | // Time to cache positive automatic identification results, as a MySQL time interval |
||||
79 | $identificationCacheExpiry = "1 DAY"; |
||||
80 | |||||
81 | $communityUsername = "[Community]"; |
||||
82 | |||||
83 | /************************************ |
||||
84 | * OAuth Configuration |
||||
85 | */ |
||||
86 | |||||
87 | $oauthConsumerToken = ""; |
||||
88 | $oauthSecretToken = ""; |
||||
89 | |||||
90 | // Formerly-used OAuth tokens to permit reading identities from |
||||
91 | $oauthLegacyTokens = []; |
||||
92 | |||||
93 | $oauthMediaWikiCanonicalServer = "http://en.wikipedia.org"; |
||||
94 | |||||
95 | $useOauthSignup = true; |
||||
96 | $enforceOAuth = false; |
||||
97 | |||||
98 | // Password for the creation bot when this is used in place of OAuth |
||||
99 | $creationBotUsername = ''; |
||||
100 | $creationBotPassword = ''; |
||||
101 | |||||
102 | /************************************ |
||||
103 | * Providers Configuration |
||||
104 | */ |
||||
105 | |||||
106 | // IP GeoLocation |
||||
107 | // ------------------------ |
||||
108 | // To set this up, change the class to "IpLocationProvider", and put *your* ipinfodb API key in. |
||||
109 | // You'll need to sign up at IpInfoDb.com to get an API key - it's free. |
||||
110 | $locationProviderApiKey = null; // ipinfodb api key |
||||
111 | |||||
112 | /*********************************** |
||||
113 | * Data clear script |
||||
114 | */ |
||||
115 | |||||
116 | $dataclear_interval = '15 DAY'; |
||||
117 | |||||
118 | /*********************************** |
||||
119 | * Other stuff that doesn't fit in. |
||||
120 | */ |
||||
121 | |||||
122 | $enableTitleblacklist = 0; // Enable Title Blacklist checks. |
||||
123 | |||||
124 | // user agent of the tool. |
||||
125 | $toolUserAgent = "Wikipedia-ACC Tool/0.1 (+https://accounts.wmflabs.org/internal.php/team)"; |
||||
126 | |||||
127 | // list of squid proxies requests go through. |
||||
128 | $squidIpList = array(); |
||||
129 | |||||
130 | // miser mode |
||||
131 | $requestLimitShowOnly = 25; |
||||
132 | |||||
133 | // HSTS expiry - use false to disable header. |
||||
134 | $strictTransportSecurityExpiry = false; |
||||
135 | |||||
136 | // CSP violation report URI |
||||
137 | $cspReportUri = null; |
||||
138 | |||||
139 | // Must be disabled in production. |
||||
140 | $enableErrorTrace = false; |
||||
141 | $enableCssBreakpoints = false; |
||||
142 | |||||
143 | // Dangerous. |
||||
144 | // Don't set this. |
||||
145 | // Definitely don't set this if there's sensitive data stored here you care about such as OAuth credentials. |
||||
146 | $curlDisableSSLVerifyPeer = false; |
||||
147 | |||||
148 | // Change this to be outside the web directory. |
||||
149 | $curlCookieJar = __DIR__ . '/../cookies.txt'; |
||||
150 | |||||
151 | $yubicoApiId = 0; |
||||
152 | $yubicoApiKey = ""; |
||||
153 | |||||
154 | $totpEncryptionKey = "1234"; |
||||
155 | |||||
156 | // external resource cache epoch value. Bump me to force clients to reload assets |
||||
157 | $resourceCacheEpoch = 1; |
||||
158 | |||||
159 | $commonEmailDomains = ['gmail.com', 'hotmail.com', 'outlook.com']; |
||||
160 | |||||
161 | // limit for block/drop ban actions |
||||
162 | $banMaxIpBlockRange = [4 => 20, 6 => 48]; |
||||
163 | // limit for *all* ban actions, including block/drop. |
||||
164 | $banMaxIpRange = [4 => 16, 6 => 32]; |
||||
165 | |||||
166 | $jobQueueBatchSize = 10; |
||||
167 | |||||
168 | /************************************************************************** |
||||
169 | ********** IMPORTANT NOTICE ********** |
||||
170 | *************************************************************************** |
||||
171 | ** DON'T ADD ANY NEW CONFIGURATION OPTIONS BELOW THIS LINE!!! ** |
||||
172 | ** THEY WILL NOT BE CHANGABLE BY THE LOCAL CONFIGURATION FILE. ** |
||||
173 | ***************************************************************************/ |
||||
174 | |||||
175 | // Retriving the local configuration file. |
||||
176 | require_once('config.local.inc.php'); |
||||
177 | |||||
178 | $cDatabaseConfig = array( |
||||
179 | "acc" => array( |
||||
180 | "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database, |
||||
181 | "username" => $toolserver_username, |
||||
182 | "password" => $toolserver_password, |
||||
183 | "options" => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4'), |
||||
184 | ), |
||||
185 | ); |
||||
186 | |||||
187 | // //Keep the included files from being executed. |
||||
188 | define("ACC", 1); |
||||
189 | |||||
190 | // Sets the values of the cookie configuration options. |
||||
191 | ini_set('session.cookie_path', $cookiepath); |
||||
192 | ini_set('session.name', $sessionname); |
||||
193 | ini_set('user_agent', $toolUserAgent); |
||||
194 | |||||
195 | foreach (array( |
||||
196 | "mbstring", // unicode and stuff |
||||
197 | "pdo", |
||||
198 | "pdo_mysql", // new database module |
||||
199 | "session", |
||||
200 | "date", |
||||
201 | "pcre", // core stuff |
||||
202 | "curl", // mediawiki api access etc |
||||
203 | "openssl", // token generation |
||||
204 | ) as $x) { |
||||
205 | if (!extension_loaded($x)) { |
||||
206 | die("extension $x is required."); |
||||
207 | } |
||||
208 | } |
||||
209 | |||||
210 | // Set up the AutoLoader |
||||
211 | require_once(__DIR__ . "/includes/AutoLoader.php"); |
||||
212 | spl_autoload_register('Waca\\AutoLoader::load'); |
||||
213 | require_once(__DIR__ . '/vendor/autoload.php'); |
||||
214 | |||||
215 | // Crap that's needed for libraries. >:( |
||||
216 | /** |
||||
217 | * Don't use me. I'm only here because the MediaWiki OAuth library we're using requires it. |
||||
218 | * |
||||
219 | * @param $section |
||||
220 | * @param $message |
||||
221 | */ |
||||
222 | function wfDebugLog($section, $message) |
||||
0 ignored issues
–
show
The parameter
$section is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
223 | { |
||||
224 | } |
||||
225 | |||||
226 | // Initialise the site configuration object |
||||
227 | /** @noinspection PhpFullyQualifiedNameUsageInspection */ |
||||
228 | $siteConfiguration = new \Waca\SiteConfiguration(); |
||||
229 | |||||
230 | $siteConfiguration->setBaseUrl($baseurl) |
||||
231 | ->setFilePath(__DIR__) |
||||
232 | ->setDebuggingTraceEnabled($enableErrorTrace) |
||||
233 | ->setDebuggingCssBreakpointsEnabled($enableCssBreakpoints) |
||||
234 | ->setForceIdentification($forceIdentification) |
||||
235 | ->setIdentificationCacheExpiry($identificationCacheExpiry) |
||||
236 | ->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint) |
||||
237 | ->setEnforceOAuth($enforceOAuth) |
||||
238 | ->setEmailConfirmationEnabled($enableEmailConfirm == 1) |
||||
239 | ->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays) |
||||
240 | ->setMiserModeLimit($requestLimitShowOnly) |
||||
241 | ->setSquidList($squidIpList) |
||||
242 | ->setUseStrictTransportSecurity($strictTransportSecurityExpiry) |
||||
243 | ->setUserAgent($toolUserAgent) |
||||
244 | ->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer) |
||||
245 | ->setUseOAuthSignup($useOauthSignup) |
||||
246 | ->setOAuthConsumerToken($oauthConsumerToken) |
||||
247 | ->setOAuthLegacyConsumerTokens($oauthLegacyTokens) |
||||
248 | ->setOAuthConsumerSecret($oauthSecretToken) |
||||
249 | ->setOauthMediaWikiCanonicalServer($oauthMediaWikiCanonicalServer) |
||||
250 | ->setDataClearInterval($dataclear_interval) |
||||
251 | ->setXffTrustedHostsFile($xff_trusted_hosts_file) |
||||
252 | ->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1) |
||||
253 | ->setIrcNotificationsInstance($whichami) |
||||
254 | ->setTitleBlacklistEnabled($enableTitleblacklist == 1) |
||||
255 | ->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org'))) |
||||
256 | ->setCreationBotUsername($creationBotUsername) |
||||
257 | ->setCreationBotPassword($creationBotPassword) |
||||
258 | ->setCurlCookieJar($curlCookieJar) |
||||
259 | ->setYubicoApiId($yubicoApiId) |
||||
260 | ->setYubicoApiKey($yubicoApiKey) |
||||
261 | ->setTotpEncryptionKey($totpEncryptionKey) |
||||
262 | ->setRegistrationAllowed($allowRegistration) |
||||
263 | ->setCspReportUri($cspReportUri) |
||||
264 | ->setResourceCacheEpoch($resourceCacheEpoch) |
||||
265 | ->setLocationProviderApiKey($locationProviderApiKey) |
||||
266 | ->setCommonEmailDomains($commonEmailDomains) |
||||
267 | ->setBanMaxIpRange($banMaxIpRange) |
||||
268 | ->setBanMaxIpBlockRange($banMaxIpBlockRange) |
||||
269 | ->setJobQueueBatchSize($jobQueueBatchSize) |
||||
270 | ->setAmqpConfiguration($amqpConfiguration); |
||||
271 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.