Completed
Push — bootstrap4 ( c24853...dc7ca1 )
by Simon
06:16
created
config.inc.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
 
197 197
 // request states
198 198
 $availableRequestStates = array(
199
-    'Open'          => array(
200
-        'defertolog' => 'users', // don't change or you'll break old logs
201
-        'deferto'    => 'users',
202
-        'header'     => 'Open requests',
203
-        'api'        => "open",
204
-    ),
205
-    'Flagged users' => array(
206
-        'defertolog' => 'flagged users', // don't change or you'll break old logs
207
-        'deferto'    => 'flagged users',
208
-        'header'     => 'Flagged user needed',
209
-        'api'        => "admin",
210
-    ),
211
-    'Checkuser'     => array(
212
-        'defertolog' => 'checkusers', // don't change or you'll break old logs
213
-        'deferto'    => 'checkusers',
214
-        'header'     => 'Checkuser needed',
215
-        'api'        => "checkuser",
216
-    ),
199
+	'Open'          => array(
200
+		'defertolog' => 'users', // don't change or you'll break old logs
201
+		'deferto'    => 'users',
202
+		'header'     => 'Open requests',
203
+		'api'        => "open",
204
+	),
205
+	'Flagged users' => array(
206
+		'defertolog' => 'flagged users', // don't change or you'll break old logs
207
+		'deferto'    => 'flagged users',
208
+		'header'     => 'Flagged user needed',
209
+		'api'        => "admin",
210
+	),
211
+	'Checkuser'     => array(
212
+		'defertolog' => 'checkusers', // don't change or you'll break old logs
213
+		'deferto'    => 'checkusers',
214
+		'header'     => 'Checkuser needed',
215
+		'api'        => "checkuser",
216
+	),
217 217
 );
218 218
 
219 219
 $defaultRequestStateKey = 'Open';
@@ -252,21 +252,21 @@  discard block
 block discarded – undo
252 252
 require_once('config.local.inc.php');
253 253
 
254 254
 $cDatabaseConfig = array(
255
-    "acc"           => array(
256
-        "dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database,
257
-        "username" => $toolserver_username,
258
-        "password" => $toolserver_password,
259
-    ),
260
-    "wikipedia"     => array(
261
-        "dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db,
262
-        "username" => $toolserver_username,
263
-        "password" => $toolserver_password,
264
-    ),
265
-    "notifications" => array(
266
-        "dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database,
267
-        "username" => $notifications_username,
268
-        "password" => $notifications_password,
269
-    ),
255
+	"acc"           => array(
256
+		"dsrcname" => "mysql:host=" . $toolserver_host . ";dbname=" . $toolserver_database,
257
+		"username" => $toolserver_username,
258
+		"password" => $toolserver_password,
259
+	),
260
+	"wikipedia"     => array(
261
+		"dsrcname" => "mysql:host=" . $antispoof_host . ";dbname=" . $antispoof_db,
262
+		"username" => $toolserver_username,
263
+		"password" => $toolserver_password,
264
+	),
265
+	"notifications" => array(
266
+		"dsrcname" => "mysql:host=" . $toolserver_notification_dbhost . ";dbname=" . $toolserver_notification_database,
267
+		"username" => $notifications_username,
268
+		"password" => $notifications_password,
269
+	),
270 270
 );
271 271
 
272 272
 // //Keep the included files from being executed.
@@ -278,18 +278,18 @@  discard block
 block discarded – undo
278 278
 ini_set('user_agent', $toolUserAgent);
279 279
 
280 280
 foreach (array(
281
-    "mbstring", // unicode and stuff
282
-    "pdo",
283
-    "pdo_mysql", // new database module
284
-    "session",
285
-    "date",
286
-    "pcre", // core stuff
287
-    "curl", // mediawiki api access etc
288
-    "openssl", // token generation
281
+	"mbstring", // unicode and stuff
282
+	"pdo",
283
+	"pdo_mysql", // new database module
284
+	"session",
285
+	"date",
286
+	"pcre", // core stuff
287
+	"curl", // mediawiki api access etc
288
+	"openssl", // token generation
289 289
 ) as $x) {
290
-    if (!extension_loaded($x)) {
291
-        die("extension $x is required.");
292
-    }
290
+	if (!extension_loaded($x)) {
291
+		die("extension $x is required.");
292
+	}
293 293
 }
294 294
 
295 295
 // Set up the AutoLoader
@@ -316,32 +316,32 @@  discard block
 block discarded – undo
316 316
 $siteConfiguration = new \Waca\SiteConfiguration();
317 317
 
318 318
 $siteConfiguration->setBaseUrl($baseurl)
319
-    ->setFilePath(__DIR__)
320
-    ->setDebuggingTraceEnabled($enableErrorTrace)
321
-    ->setForceIdentification($forceIdentification)
322
-    ->setIdentificationCacheExpiry($identificationCacheExpiry)
323
-    ->setMediawikiScriptPath($mediawikiScriptPath)
324
-    ->setMediawikiWebServiceEndpoint($mediawikiWebServiceEndpoint)
325
-    ->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint)
326
-    ->setEnforceOAuth($enforceOAuth)
327
-    ->setEmailConfirmationEnabled($enableEmailConfirm == 1)
328
-    ->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays)
329
-    ->setMiserModeLimit($requestLimitShowOnly)
330
-    ->setRequestStates($availableRequestStates)
331
-    ->setSquidList($squidIpList)
332
-    ->setDefaultCreatedTemplateId($createdid)
333
-    ->setDefaultRequestStateKey($defaultRequestStateKey)
334
-    ->setUseStrictTransportSecurity($strictTransportSecurityExpiry)
335
-    ->setUserAgent($toolUserAgent)
336
-    ->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer)
337
-    ->setUseOAuthSignup($useOauthSignup)
338
-    ->setOAuthBaseUrl($oauthBaseUrl)
339
-    ->setOAuthConsumerToken($oauthConsumerToken)
340
-    ->setOAuthConsumerSecret($oauthSecretToken)
341
-    ->setDataClearInterval($dataclear_interval)
342
-    ->setXffTrustedHostsFile($xff_trusted_hosts_file)
343
-    ->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1)
344
-    ->setIrcNotificationType($ircBotNotificationType)
345
-    ->setIrcNotificationsInstance($whichami)
346
-    ->setTitleBlacklistEnabled($enableTitleblacklist == 1)
347
-    ->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org')));
319
+	->setFilePath(__DIR__)
320
+	->setDebuggingTraceEnabled($enableErrorTrace)
321
+	->setForceIdentification($forceIdentification)
322
+	->setIdentificationCacheExpiry($identificationCacheExpiry)
323
+	->setMediawikiScriptPath($mediawikiScriptPath)
324
+	->setMediawikiWebServiceEndpoint($mediawikiWebServiceEndpoint)
325
+	->setMetaWikimediaWebServiceEndpoint($metaWikimediaWebServiceEndpoint)
326
+	->setEnforceOAuth($enforceOAuth)
327
+	->setEmailConfirmationEnabled($enableEmailConfirm == 1)
328
+	->setEmailConfirmationExpiryDays($emailConfirmationExpiryDays)
329
+	->setMiserModeLimit($requestLimitShowOnly)
330
+	->setRequestStates($availableRequestStates)
331
+	->setSquidList($squidIpList)
332
+	->setDefaultCreatedTemplateId($createdid)
333
+	->setDefaultRequestStateKey($defaultRequestStateKey)
334
+	->setUseStrictTransportSecurity($strictTransportSecurityExpiry)
335
+	->setUserAgent($toolUserAgent)
336
+	->setCurlDisableVerifyPeer($curlDisableSSLVerifyPeer)
337
+	->setUseOAuthSignup($useOauthSignup)
338
+	->setOAuthBaseUrl($oauthBaseUrl)
339
+	->setOAuthConsumerToken($oauthConsumerToken)
340
+	->setOAuthConsumerSecret($oauthSecretToken)
341
+	->setDataClearInterval($dataclear_interval)
342
+	->setXffTrustedHostsFile($xff_trusted_hosts_file)
343
+	->setIrcNotificationsEnabled($ircBotNotificationsEnabled == 1)
344
+	->setIrcNotificationType($ircBotNotificationType)
345
+	->setIrcNotificationsInstance($whichami)
346
+	->setTitleBlacklistEnabled($enableTitleblacklist == 1)
347
+	->setTorExitPaths(array_merge(gethostbynamel('en.wikipedia.org'), gethostbynamel('accounts.wmflabs.org')));
Please login to merge, or discard this patch.
includes/WebRequest.php 1 patch
Indentation   +517 added lines, -517 removed lines patch added patch discarded remove patch
@@ -22,521 +22,521 @@
 block discarded – undo
22 22
  */
23 23
 class WebRequest
24 24
 {
25
-    /**
26
-     * @var \Waca\Providers\GlobalState\IGlobalStateProvider Provides access to the global state.
27
-     */
28
-    private static $globalStateProvider;
29
-
30
-    /**
31
-     * Returns a boolean value if the request was submitted with the HTTP POST method.
32
-     * @return bool
33
-     */
34
-    public static function wasPosted()
35
-    {
36
-        return self::method() === 'POST';
37
-    }
38
-
39
-    /**
40
-     * Gets the HTTP Method used
41
-     * @return string|null
42
-     */
43
-    public static function method()
44
-    {
45
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
46
-
47
-        if (isset($server['REQUEST_METHOD'])) {
48
-            return $server['REQUEST_METHOD'];
49
-        }
50
-
51
-        return null;
52
-    }
53
-
54
-    /**
55
-     * Gets a boolean value stating whether the request was served over HTTPS or not.
56
-     * @return bool
57
-     */
58
-    public static function isHttps()
59
-    {
60
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
61
-
62
-        if (isset($server['HTTP_X_FORWARDED_PROTO'])) {
63
-            if ($server['HTTP_X_FORWARDED_PROTO'] === 'https') {
64
-                // Client <=> Proxy is encrypted
65
-                return true;
66
-            }
67
-            else {
68
-                // Proxy <=> Server link unknown, Client <=> Proxy is not encrypted.
69
-                return false;
70
-            }
71
-        }
72
-
73
-        if (isset($server['HTTPS'])) {
74
-            if ($server['HTTPS'] === 'off') {
75
-                // ISAPI on IIS breaks the spec. :(
76
-                return false;
77
-            }
78
-
79
-            if ($server['HTTPS'] !== '') {
80
-                // Set to a non-empty value
81
-                return true;
82
-            }
83
-        }
84
-
85
-        return false;
86
-    }
87
-
88
-    /**
89
-     * Gets the path info
90
-     *
91
-     * @return array Array of path info segments
92
-     */
93
-    public static function pathInfo()
94
-    {
95
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
96
-        if (!isset($server['PATH_INFO'])) {
97
-            return array();
98
-        }
99
-
100
-        $exploded = explode('/', $server['PATH_INFO']);
101
-
102
-        // filter out empty values, and reindex from zero. Notably, the first element is always zero, since it starts
103
-        // with a /
104
-        return array_values(array_filter($exploded));
105
-    }
106
-
107
-    /**
108
-     * Gets the remote address of the web request
109
-     * @return null|string
110
-     */
111
-    public static function remoteAddress()
112
-    {
113
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
114
-
115
-        if (isset($server['REMOTE_ADDR'])) {
116
-            return $server['REMOTE_ADDR'];
117
-        }
118
-
119
-        return null;
120
-    }
121
-
122
-    /**
123
-     * Gets the XFF header contents for the web request
124
-     * @return null|string
125
-     */
126
-    public static function forwardedAddress()
127
-    {
128
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
129
-
130
-        if (isset($server['HTTP_X_FORWARDED_FOR'])) {
131
-            return $server['HTTP_X_FORWARDED_FOR'];
132
-        }
133
-
134
-        return null;
135
-    }
136
-
137
-    /**
138
-     * Sets the global state provider.
139
-     *
140
-     * Almost guaranteed this is not the method you want in production code.
141
-     *
142
-     * @param \Waca\Providers\GlobalState\IGlobalStateProvider $globalState
143
-     */
144
-    public static function setGlobalStateProvider($globalState)
145
-    {
146
-        self::$globalStateProvider = $globalState;
147
-    }
148
-
149
-    #region POST variables
150
-
151
-    /**
152
-     * @param string $key
153
-     *
154
-     * @return null|string
155
-     */
156
-    public static function postString($key)
157
-    {
158
-        $post = &self::$globalStateProvider->getPostSuperGlobal();
159
-        if (!array_key_exists($key, $post)) {
160
-            return null;
161
-        }
162
-
163
-        if ($post[$key] === "") {
164
-            return null;
165
-        }
166
-
167
-        return (string)$post[$key];
168
-    }
169
-
170
-    /**
171
-     * @param string $key
172
-     *
173
-     * @return null|string
174
-     */
175
-    public static function postEmail($key)
176
-    {
177
-        $post = &self::$globalStateProvider->getPostSuperGlobal();
178
-        if (!array_key_exists($key, $post)) {
179
-            return null;
180
-        }
181
-
182
-        $filteredValue = filter_var($post[$key], FILTER_SANITIZE_EMAIL);
183
-
184
-        if ($filteredValue === false) {
185
-            return null;
186
-        }
187
-
188
-        return (string)$filteredValue;
189
-    }
190
-
191
-    /**
192
-     * @param string $key
193
-     *
194
-     * @return int|null
195
-     */
196
-    public static function postInt($key)
197
-    {
198
-        $post = &self::$globalStateProvider->getPostSuperGlobal();
199
-        if (!array_key_exists($key, $post)) {
200
-            return null;
201
-        }
202
-
203
-        $filteredValue = filter_var($post[$key], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
204
-
205
-        if ($filteredValue === null) {
206
-            return null;
207
-        }
208
-
209
-        return (int)$filteredValue;
210
-    }
211
-
212
-    /**
213
-     * @param string $key
214
-     *
215
-     * @return bool
216
-     */
217
-    public static function postBoolean($key)
218
-    {
219
-        $get = &self::$globalStateProvider->getPostSuperGlobal();
220
-        if (!array_key_exists($key, $get)) {
221
-            return false;
222
-        }
223
-
224
-        // presence of parameter only
225
-        if ($get[$key] === "") {
226
-            return true;
227
-        }
228
-
229
-        if (in_array($get[$key], array(false, 'no', 'off', 0, 'false'), true)) {
230
-            return false;
231
-        }
232
-
233
-        return true;
234
-    }
235
-
236
-    #endregion
237
-
238
-    #region GET variables
239
-
240
-    /**
241
-     * @param string $key
242
-     *
243
-     * @return bool
244
-     */
245
-    public static function getBoolean($key)
246
-    {
247
-        $get = &self::$globalStateProvider->getGetSuperGlobal();
248
-        if (!array_key_exists($key, $get)) {
249
-            return false;
250
-        }
251
-
252
-        // presence of parameter only
253
-        if ($get[$key] === "") {
254
-            return true;
255
-        }
256
-
257
-        if (in_array($get[$key], array(false, 'no', 'off', 0, 'false'), true)) {
258
-            return false;
259
-        }
260
-
261
-        return true;
262
-    }
263
-
264
-    /**
265
-     * @param string $key
266
-     *
267
-     * @return int|null
268
-     */
269
-    public static function getInt($key)
270
-    {
271
-        $get = &self::$globalStateProvider->getGetSuperGlobal();
272
-        if (!array_key_exists($key, $get)) {
273
-            return null;
274
-        }
275
-
276
-        $filteredValue = filter_var($get[$key], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
277
-
278
-        if ($filteredValue === null) {
279
-            return null;
280
-        }
281
-
282
-        return (int)$filteredValue;
283
-    }
284
-
285
-    /**
286
-     * @param string $key
287
-     *
288
-     * @return null|string
289
-     */
290
-    public static function getString($key)
291
-    {
292
-        $get = &self::$globalStateProvider->getGetSuperGlobal();
293
-        if (!array_key_exists($key, $get)) {
294
-            return null;
295
-        }
296
-
297
-        if ($get[$key] === "") {
298
-            return null;
299
-        }
300
-
301
-        return (string)$get[$key];
302
-    }
303
-
304
-    #endregion
305
-
306
-    /**
307
-     * Sets the logged-in user to the specified user.
308
-     *
309
-     * @param User $user
310
-     */
311
-    public static function setLoggedInUser(User $user)
312
-    {
313
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
314
-
315
-        $session['userID'] = $user->getId();
316
-        unset($session['partialLogin']);
317
-    }
318
-
319
-    /**
320
-     * Sets the post-login redirect
321
-     */
322
-    public static function setPostLoginRedirect()
323
-    {
324
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
325
-        $session['returnTo'] = self::requestUri();
326
-    }
327
-
328
-    /**
329
-     * @return string|null
330
-     */
331
-    public static function requestUri()
332
-    {
333
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
334
-
335
-        if (isset($server['REQUEST_URI'])) {
336
-            return $server['REQUEST_URI'];
337
-        }
338
-
339
-        return null;
340
-    }
341
-
342
-    /**
343
-     * Clears the post-login redirect
344
-     * @return string
345
-     */
346
-    public static function clearPostLoginRedirect()
347
-    {
348
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
349
-        if (array_key_exists('returnTo', $session)) {
350
-            $path = $session['returnTo'];
351
-            unset($session['returnTo']);
352
-
353
-            return $path;
354
-        }
355
-
356
-        return null;
357
-    }
358
-
359
-    /**
360
-     * @return string|null
361
-     */
362
-    public static function serverName()
363
-    {
364
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
365
-
366
-        if (isset($server['SERVER_NAME'])) {
367
-            return $server['SERVER_NAME'];
368
-        }
369
-
370
-        return null;
371
-    }
372
-
373
-    /**
374
-     * You probably only want to deal with this through SessionAlert.
375
-     * @return void
376
-     */
377
-    public static function clearSessionAlertData()
378
-    {
379
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
380
-        if (array_key_exists('alerts', $session)) {
381
-            unset($session['alerts']);
382
-        }
383
-    }
384
-
385
-    /**
386
-     * You probably only want to deal with this through SessionAlert.
387
-     *
388
-     * @return string[]
389
-     */
390
-    public static function getSessionAlertData()
391
-    {
392
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
393
-        if (array_key_exists('alerts', $session)) {
394
-            return $session['alerts'];
395
-        }
396
-
397
-        return array();
398
-    }
399
-
400
-    /**
401
-     * You probably only want to deal with this through SessionAlert.
402
-     *
403
-     * @param string[] $data
404
-     */
405
-    public static function setSessionAlertData($data)
406
-    {
407
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
408
-        $session['alerts'] = $data;
409
-    }
410
-
411
-    /**
412
-     * You probably only want to deal with this through TokenManager.
413
-     *
414
-     * @return string[]
415
-     */
416
-    public static function getSessionTokenData()
417
-    {
418
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
419
-        if (array_key_exists('tokens', $session)) {
420
-            return $session['tokens'];
421
-        }
422
-
423
-        return array();
424
-    }
425
-
426
-    /**
427
-     * You probably only want to deal with this through TokenManager.
428
-     *
429
-     * @param string[] $data
430
-     */
431
-    public static function setSessionTokenData($data)
432
-    {
433
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
434
-        $session['tokens'] = $data;
435
-    }
436
-
437
-    /**
438
-     * @param string $key
439
-     *
440
-     * @return mixed
441
-     */
442
-    public static function getSessionContext($key)
443
-    {
444
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
445
-
446
-        if (!isset($session['context'])) {
447
-            $session['context'] = array();
448
-        }
449
-
450
-        if (!isset($session['context'][$key])) {
451
-            return null;
452
-        }
453
-
454
-        return $session['context'][$key];
455
-    }
456
-
457
-    /**
458
-     * @param string $key
459
-     * @param mixed  $data
460
-     */
461
-    public static function setSessionContext($key, $data)
462
-    {
463
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
464
-
465
-        if (!isset($session['context'])) {
466
-            $session['context'] = array();
467
-        }
468
-
469
-        $session['context'][$key] = $data;
470
-    }
471
-
472
-    /**
473
-     * @return int|null
474
-     */
475
-    public static function getSessionUserId()
476
-    {
477
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
478
-
479
-        return isset($session['userID']) ? (int)$session['userID'] : null;
480
-    }
481
-
482
-    /**
483
-     * @param User $user
484
-     */
485
-    public static function setPartialLogin(User $user)
486
-    {
487
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
488
-        $session['partialLogin'] = $user->getId();
489
-    }
490
-
491
-    /**
492
-     * @return int|null
493
-     */
494
-    public static function getPartialLogin()
495
-    {
496
-        $session = &self::$globalStateProvider->getSessionSuperGlobal();
497
-
498
-        return isset($session['partialLogin']) ? (int)$session['partialLogin'] : null;
499
-    }
500
-
501
-    /**
502
-     * @return null|string
503
-     */
504
-    public static function userAgent()
505
-    {
506
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
507
-
508
-        if (isset($server['HTTP_USER_AGENT'])) {
509
-            return $server['HTTP_USER_AGENT'];
510
-        }
511
-
512
-        return null;
513
-    }
514
-
515
-    /**
516
-     * @return null|string
517
-     */
518
-    public static function scriptName()
519
-    {
520
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
521
-
522
-        if (isset($server['SCRIPT_NAME'])) {
523
-            return $server['SCRIPT_NAME'];
524
-        }
525
-
526
-        return null;
527
-    }
528
-
529
-    /**
530
-     * @return null|string
531
-     */
532
-    public static function origin()
533
-    {
534
-        $server = &self::$globalStateProvider->getServerSuperGlobal();
535
-
536
-        if (isset($server['HTTP_ORIGIN'])) {
537
-            return $server['HTTP_ORIGIN'];
538
-        }
539
-
540
-        return null;
541
-    }
25
+	/**
26
+	 * @var \Waca\Providers\GlobalState\IGlobalStateProvider Provides access to the global state.
27
+	 */
28
+	private static $globalStateProvider;
29
+
30
+	/**
31
+	 * Returns a boolean value if the request was submitted with the HTTP POST method.
32
+	 * @return bool
33
+	 */
34
+	public static function wasPosted()
35
+	{
36
+		return self::method() === 'POST';
37
+	}
38
+
39
+	/**
40
+	 * Gets the HTTP Method used
41
+	 * @return string|null
42
+	 */
43
+	public static function method()
44
+	{
45
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
46
+
47
+		if (isset($server['REQUEST_METHOD'])) {
48
+			return $server['REQUEST_METHOD'];
49
+		}
50
+
51
+		return null;
52
+	}
53
+
54
+	/**
55
+	 * Gets a boolean value stating whether the request was served over HTTPS or not.
56
+	 * @return bool
57
+	 */
58
+	public static function isHttps()
59
+	{
60
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
61
+
62
+		if (isset($server['HTTP_X_FORWARDED_PROTO'])) {
63
+			if ($server['HTTP_X_FORWARDED_PROTO'] === 'https') {
64
+				// Client <=> Proxy is encrypted
65
+				return true;
66
+			}
67
+			else {
68
+				// Proxy <=> Server link unknown, Client <=> Proxy is not encrypted.
69
+				return false;
70
+			}
71
+		}
72
+
73
+		if (isset($server['HTTPS'])) {
74
+			if ($server['HTTPS'] === 'off') {
75
+				// ISAPI on IIS breaks the spec. :(
76
+				return false;
77
+			}
78
+
79
+			if ($server['HTTPS'] !== '') {
80
+				// Set to a non-empty value
81
+				return true;
82
+			}
83
+		}
84
+
85
+		return false;
86
+	}
87
+
88
+	/**
89
+	 * Gets the path info
90
+	 *
91
+	 * @return array Array of path info segments
92
+	 */
93
+	public static function pathInfo()
94
+	{
95
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
96
+		if (!isset($server['PATH_INFO'])) {
97
+			return array();
98
+		}
99
+
100
+		$exploded = explode('/', $server['PATH_INFO']);
101
+
102
+		// filter out empty values, and reindex from zero. Notably, the first element is always zero, since it starts
103
+		// with a /
104
+		return array_values(array_filter($exploded));
105
+	}
106
+
107
+	/**
108
+	 * Gets the remote address of the web request
109
+	 * @return null|string
110
+	 */
111
+	public static function remoteAddress()
112
+	{
113
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
114
+
115
+		if (isset($server['REMOTE_ADDR'])) {
116
+			return $server['REMOTE_ADDR'];
117
+		}
118
+
119
+		return null;
120
+	}
121
+
122
+	/**
123
+	 * Gets the XFF header contents for the web request
124
+	 * @return null|string
125
+	 */
126
+	public static function forwardedAddress()
127
+	{
128
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
129
+
130
+		if (isset($server['HTTP_X_FORWARDED_FOR'])) {
131
+			return $server['HTTP_X_FORWARDED_FOR'];
132
+		}
133
+
134
+		return null;
135
+	}
136
+
137
+	/**
138
+	 * Sets the global state provider.
139
+	 *
140
+	 * Almost guaranteed this is not the method you want in production code.
141
+	 *
142
+	 * @param \Waca\Providers\GlobalState\IGlobalStateProvider $globalState
143
+	 */
144
+	public static function setGlobalStateProvider($globalState)
145
+	{
146
+		self::$globalStateProvider = $globalState;
147
+	}
148
+
149
+	#region POST variables
150
+
151
+	/**
152
+	 * @param string $key
153
+	 *
154
+	 * @return null|string
155
+	 */
156
+	public static function postString($key)
157
+	{
158
+		$post = &self::$globalStateProvider->getPostSuperGlobal();
159
+		if (!array_key_exists($key, $post)) {
160
+			return null;
161
+		}
162
+
163
+		if ($post[$key] === "") {
164
+			return null;
165
+		}
166
+
167
+		return (string)$post[$key];
168
+	}
169
+
170
+	/**
171
+	 * @param string $key
172
+	 *
173
+	 * @return null|string
174
+	 */
175
+	public static function postEmail($key)
176
+	{
177
+		$post = &self::$globalStateProvider->getPostSuperGlobal();
178
+		if (!array_key_exists($key, $post)) {
179
+			return null;
180
+		}
181
+
182
+		$filteredValue = filter_var($post[$key], FILTER_SANITIZE_EMAIL);
183
+
184
+		if ($filteredValue === false) {
185
+			return null;
186
+		}
187
+
188
+		return (string)$filteredValue;
189
+	}
190
+
191
+	/**
192
+	 * @param string $key
193
+	 *
194
+	 * @return int|null
195
+	 */
196
+	public static function postInt($key)
197
+	{
198
+		$post = &self::$globalStateProvider->getPostSuperGlobal();
199
+		if (!array_key_exists($key, $post)) {
200
+			return null;
201
+		}
202
+
203
+		$filteredValue = filter_var($post[$key], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
204
+
205
+		if ($filteredValue === null) {
206
+			return null;
207
+		}
208
+
209
+		return (int)$filteredValue;
210
+	}
211
+
212
+	/**
213
+	 * @param string $key
214
+	 *
215
+	 * @return bool
216
+	 */
217
+	public static function postBoolean($key)
218
+	{
219
+		$get = &self::$globalStateProvider->getPostSuperGlobal();
220
+		if (!array_key_exists($key, $get)) {
221
+			return false;
222
+		}
223
+
224
+		// presence of parameter only
225
+		if ($get[$key] === "") {
226
+			return true;
227
+		}
228
+
229
+		if (in_array($get[$key], array(false, 'no', 'off', 0, 'false'), true)) {
230
+			return false;
231
+		}
232
+
233
+		return true;
234
+	}
235
+
236
+	#endregion
237
+
238
+	#region GET variables
239
+
240
+	/**
241
+	 * @param string $key
242
+	 *
243
+	 * @return bool
244
+	 */
245
+	public static function getBoolean($key)
246
+	{
247
+		$get = &self::$globalStateProvider->getGetSuperGlobal();
248
+		if (!array_key_exists($key, $get)) {
249
+			return false;
250
+		}
251
+
252
+		// presence of parameter only
253
+		if ($get[$key] === "") {
254
+			return true;
255
+		}
256
+
257
+		if (in_array($get[$key], array(false, 'no', 'off', 0, 'false'), true)) {
258
+			return false;
259
+		}
260
+
261
+		return true;
262
+	}
263
+
264
+	/**
265
+	 * @param string $key
266
+	 *
267
+	 * @return int|null
268
+	 */
269
+	public static function getInt($key)
270
+	{
271
+		$get = &self::$globalStateProvider->getGetSuperGlobal();
272
+		if (!array_key_exists($key, $get)) {
273
+			return null;
274
+		}
275
+
276
+		$filteredValue = filter_var($get[$key], FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
277
+
278
+		if ($filteredValue === null) {
279
+			return null;
280
+		}
281
+
282
+		return (int)$filteredValue;
283
+	}
284
+
285
+	/**
286
+	 * @param string $key
287
+	 *
288
+	 * @return null|string
289
+	 */
290
+	public static function getString($key)
291
+	{
292
+		$get = &self::$globalStateProvider->getGetSuperGlobal();
293
+		if (!array_key_exists($key, $get)) {
294
+			return null;
295
+		}
296
+
297
+		if ($get[$key] === "") {
298
+			return null;
299
+		}
300
+
301
+		return (string)$get[$key];
302
+	}
303
+
304
+	#endregion
305
+
306
+	/**
307
+	 * Sets the logged-in user to the specified user.
308
+	 *
309
+	 * @param User $user
310
+	 */
311
+	public static function setLoggedInUser(User $user)
312
+	{
313
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
314
+
315
+		$session['userID'] = $user->getId();
316
+		unset($session['partialLogin']);
317
+	}
318
+
319
+	/**
320
+	 * Sets the post-login redirect
321
+	 */
322
+	public static function setPostLoginRedirect()
323
+	{
324
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
325
+		$session['returnTo'] = self::requestUri();
326
+	}
327
+
328
+	/**
329
+	 * @return string|null
330
+	 */
331
+	public static function requestUri()
332
+	{
333
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
334
+
335
+		if (isset($server['REQUEST_URI'])) {
336
+			return $server['REQUEST_URI'];
337
+		}
338
+
339
+		return null;
340
+	}
341
+
342
+	/**
343
+	 * Clears the post-login redirect
344
+	 * @return string
345
+	 */
346
+	public static function clearPostLoginRedirect()
347
+	{
348
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
349
+		if (array_key_exists('returnTo', $session)) {
350
+			$path = $session['returnTo'];
351
+			unset($session['returnTo']);
352
+
353
+			return $path;
354
+		}
355
+
356
+		return null;
357
+	}
358
+
359
+	/**
360
+	 * @return string|null
361
+	 */
362
+	public static function serverName()
363
+	{
364
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
365
+
366
+		if (isset($server['SERVER_NAME'])) {
367
+			return $server['SERVER_NAME'];
368
+		}
369
+
370
+		return null;
371
+	}
372
+
373
+	/**
374
+	 * You probably only want to deal with this through SessionAlert.
375
+	 * @return void
376
+	 */
377
+	public static function clearSessionAlertData()
378
+	{
379
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
380
+		if (array_key_exists('alerts', $session)) {
381
+			unset($session['alerts']);
382
+		}
383
+	}
384
+
385
+	/**
386
+	 * You probably only want to deal with this through SessionAlert.
387
+	 *
388
+	 * @return string[]
389
+	 */
390
+	public static function getSessionAlertData()
391
+	{
392
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
393
+		if (array_key_exists('alerts', $session)) {
394
+			return $session['alerts'];
395
+		}
396
+
397
+		return array();
398
+	}
399
+
400
+	/**
401
+	 * You probably only want to deal with this through SessionAlert.
402
+	 *
403
+	 * @param string[] $data
404
+	 */
405
+	public static function setSessionAlertData($data)
406
+	{
407
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
408
+		$session['alerts'] = $data;
409
+	}
410
+
411
+	/**
412
+	 * You probably only want to deal with this through TokenManager.
413
+	 *
414
+	 * @return string[]
415
+	 */
416
+	public static function getSessionTokenData()
417
+	{
418
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
419
+		if (array_key_exists('tokens', $session)) {
420
+			return $session['tokens'];
421
+		}
422
+
423
+		return array();
424
+	}
425
+
426
+	/**
427
+	 * You probably only want to deal with this through TokenManager.
428
+	 *
429
+	 * @param string[] $data
430
+	 */
431
+	public static function setSessionTokenData($data)
432
+	{
433
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
434
+		$session['tokens'] = $data;
435
+	}
436
+
437
+	/**
438
+	 * @param string $key
439
+	 *
440
+	 * @return mixed
441
+	 */
442
+	public static function getSessionContext($key)
443
+	{
444
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
445
+
446
+		if (!isset($session['context'])) {
447
+			$session['context'] = array();
448
+		}
449
+
450
+		if (!isset($session['context'][$key])) {
451
+			return null;
452
+		}
453
+
454
+		return $session['context'][$key];
455
+	}
456
+
457
+	/**
458
+	 * @param string $key
459
+	 * @param mixed  $data
460
+	 */
461
+	public static function setSessionContext($key, $data)
462
+	{
463
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
464
+
465
+		if (!isset($session['context'])) {
466
+			$session['context'] = array();
467
+		}
468
+
469
+		$session['context'][$key] = $data;
470
+	}
471
+
472
+	/**
473
+	 * @return int|null
474
+	 */
475
+	public static function getSessionUserId()
476
+	{
477
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
478
+
479
+		return isset($session['userID']) ? (int)$session['userID'] : null;
480
+	}
481
+
482
+	/**
483
+	 * @param User $user
484
+	 */
485
+	public static function setPartialLogin(User $user)
486
+	{
487
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
488
+		$session['partialLogin'] = $user->getId();
489
+	}
490
+
491
+	/**
492
+	 * @return int|null
493
+	 */
494
+	public static function getPartialLogin()
495
+	{
496
+		$session = &self::$globalStateProvider->getSessionSuperGlobal();
497
+
498
+		return isset($session['partialLogin']) ? (int)$session['partialLogin'] : null;
499
+	}
500
+
501
+	/**
502
+	 * @return null|string
503
+	 */
504
+	public static function userAgent()
505
+	{
506
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
507
+
508
+		if (isset($server['HTTP_USER_AGENT'])) {
509
+			return $server['HTTP_USER_AGENT'];
510
+		}
511
+
512
+		return null;
513
+	}
514
+
515
+	/**
516
+	 * @return null|string
517
+	 */
518
+	public static function scriptName()
519
+	{
520
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
521
+
522
+		if (isset($server['SCRIPT_NAME'])) {
523
+			return $server['SCRIPT_NAME'];
524
+		}
525
+
526
+		return null;
527
+	}
528
+
529
+	/**
530
+	 * @return null|string
531
+	 */
532
+	public static function origin()
533
+	{
534
+		$server = &self::$globalStateProvider->getServerSuperGlobal();
535
+
536
+		if (isset($server['HTTP_ORIGIN'])) {
537
+			return $server['HTTP_ORIGIN'];
538
+		}
539
+
540
+		return null;
541
+	}
542 542
 }
543 543
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Tasks/IRoutedTask.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@
 block discarded – undo
12 12
 
13 13
 interface IRoutedTask extends ITask
14 14
 {
15
-    /**
16
-     * Sets the route the request will take. Only should be called from the request router.
17
-     *
18
-     * @param $routeName string
19
-     *
20
-     * @return void
21
-     *
22
-     * @throws Exception
23
-     * @category Security-Critical
24
-     */
25
-    public function setRoute($routeName);
15
+	/**
16
+	 * Sets the route the request will take. Only should be called from the request router.
17
+	 *
18
+	 * @param $routeName string
19
+	 *
20
+	 * @return void
21
+	 *
22
+	 * @throws Exception
23
+	 * @category Security-Critical
24
+	 */
25
+	public function setRoute($routeName);
26 26
 
27
-    /**
28
-     * Gets the name of the route that has been passed from the request router.
29
-     * @return string
30
-     */
31
-    public function getRouteName();
27
+	/**
28
+	 * Gets the name of the route that has been passed from the request router.
29
+	 * @return string
30
+	 */
31
+	public function getRouteName();
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Tasks/ITask.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -23,149 +23,149 @@
 block discarded – undo
23 23
 
24 24
 interface ITask
25 25
 {
26
-    /**
27
-     * @return IEmailHelper
28
-     */
29
-    public function getEmailHelper();
30
-
31
-    /**
32
-     * @param IEmailHelper $emailHelper
33
-     *
34
-     * @return void
35
-     */
36
-    public function setEmailHelper($emailHelper);
37
-
38
-    /**
39
-     * @return HttpHelper
40
-     */
41
-    public function getHttpHelper();
42
-
43
-    /**
44
-     * @param HttpHelper $httpHelper
45
-     *
46
-     * @return void
47
-     */
48
-    public function setHttpHelper($httpHelper);
49
-
50
-    /**
51
-     * @return WikiTextHelper
52
-     */
53
-    public function getWikiTextHelper();
54
-
55
-    /**
56
-     * @param WikiTextHelper $wikiTextHelper
57
-     *
58
-     * @return void
59
-     */
60
-    public function setWikiTextHelper($wikiTextHelper);
61
-
62
-    /**
63
-     * @return ILocationProvider
64
-     */
65
-    public function getLocationProvider();
66
-
67
-    /**
68
-     * @param ILocationProvider $locationProvider
69
-     *
70
-     * @return void
71
-     */
72
-    public function setLocationProvider(ILocationProvider $locationProvider);
73
-
74
-    /**
75
-     * @return IXffTrustProvider
76
-     */
77
-    public function getXffTrustProvider();
78
-
79
-    /**
80
-     * @param IXffTrustProvider $xffTrustProvider
81
-     *
82
-     * @return void
83
-     */
84
-    public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider);
85
-
86
-    /**
87
-     * @return IRDnsProvider
88
-     */
89
-    public function getRdnsProvider();
90
-
91
-    /**
92
-     * @param IRDnsProvider $rdnsProvider
93
-     *
94
-     * @return void
95
-     */
96
-    public function setRdnsProvider($rdnsProvider);
97
-
98
-    /**
99
-     * @return IAntiSpoofProvider
100
-     */
101
-    public function getAntiSpoofProvider();
102
-
103
-    /**
104
-     * @param IAntiSpoofProvider $antiSpoofProvider
105
-     *
106
-     * @return void
107
-     */
108
-    public function setAntiSpoofProvider($antiSpoofProvider);
109
-
110
-    /**
111
-     * @return PdoDatabase
112
-     */
113
-    public function getDatabase();
114
-
115
-    /**
116
-     * @param PdoDatabase $database
117
-     *
118
-     * @return void
119
-     */
120
-    public function setDatabase($database);
121
-
122
-    /**
123
-     * @return IOAuthHelper
124
-     */
125
-    public function getOAuthHelper();
126
-
127
-    /**
128
-     * @param IOAuthHelper $oauthHelper
129
-     *
130
-     * @return void
131
-     */
132
-    public function setOAuthHelper($oauthHelper);
133
-
134
-    /**
135
-     * @return void
136
-     */
137
-    public function execute();
138
-
139
-    /**
140
-     * Sets the site configuration object for this page
141
-     *
142
-     * @param SiteConfiguration $configuration
143
-     *
144
-     * @return void
145
-     */
146
-    public function setSiteConfiguration($configuration);
147
-
148
-    /**
149
-     * @return IrcNotificationHelper
150
-     */
151
-    public function getNotificationHelper();
152
-
153
-    /**
154
-     * @param IrcNotificationHelper $notificationHelper
155
-     *
156
-     * @return void
157
-     */
158
-    public function setNotificationHelper($notificationHelper);
159
-
160
-    /**
161
-     * @return TorExitProvider
162
-     */
163
-    public function getTorExitProvider();
164
-
165
-    /**
166
-     * @param TorExitProvider $torExitProvider
167
-     *
168
-     * @return void
169
-     */
170
-    public function setTorExitProvider($torExitProvider);
26
+	/**
27
+	 * @return IEmailHelper
28
+	 */
29
+	public function getEmailHelper();
30
+
31
+	/**
32
+	 * @param IEmailHelper $emailHelper
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function setEmailHelper($emailHelper);
37
+
38
+	/**
39
+	 * @return HttpHelper
40
+	 */
41
+	public function getHttpHelper();
42
+
43
+	/**
44
+	 * @param HttpHelper $httpHelper
45
+	 *
46
+	 * @return void
47
+	 */
48
+	public function setHttpHelper($httpHelper);
49
+
50
+	/**
51
+	 * @return WikiTextHelper
52
+	 */
53
+	public function getWikiTextHelper();
54
+
55
+	/**
56
+	 * @param WikiTextHelper $wikiTextHelper
57
+	 *
58
+	 * @return void
59
+	 */
60
+	public function setWikiTextHelper($wikiTextHelper);
61
+
62
+	/**
63
+	 * @return ILocationProvider
64
+	 */
65
+	public function getLocationProvider();
66
+
67
+	/**
68
+	 * @param ILocationProvider $locationProvider
69
+	 *
70
+	 * @return void
71
+	 */
72
+	public function setLocationProvider(ILocationProvider $locationProvider);
73
+
74
+	/**
75
+	 * @return IXffTrustProvider
76
+	 */
77
+	public function getXffTrustProvider();
78
+
79
+	/**
80
+	 * @param IXffTrustProvider $xffTrustProvider
81
+	 *
82
+	 * @return void
83
+	 */
84
+	public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider);
85
+
86
+	/**
87
+	 * @return IRDnsProvider
88
+	 */
89
+	public function getRdnsProvider();
90
+
91
+	/**
92
+	 * @param IRDnsProvider $rdnsProvider
93
+	 *
94
+	 * @return void
95
+	 */
96
+	public function setRdnsProvider($rdnsProvider);
97
+
98
+	/**
99
+	 * @return IAntiSpoofProvider
100
+	 */
101
+	public function getAntiSpoofProvider();
102
+
103
+	/**
104
+	 * @param IAntiSpoofProvider $antiSpoofProvider
105
+	 *
106
+	 * @return void
107
+	 */
108
+	public function setAntiSpoofProvider($antiSpoofProvider);
109
+
110
+	/**
111
+	 * @return PdoDatabase
112
+	 */
113
+	public function getDatabase();
114
+
115
+	/**
116
+	 * @param PdoDatabase $database
117
+	 *
118
+	 * @return void
119
+	 */
120
+	public function setDatabase($database);
121
+
122
+	/**
123
+	 * @return IOAuthHelper
124
+	 */
125
+	public function getOAuthHelper();
126
+
127
+	/**
128
+	 * @param IOAuthHelper $oauthHelper
129
+	 *
130
+	 * @return void
131
+	 */
132
+	public function setOAuthHelper($oauthHelper);
133
+
134
+	/**
135
+	 * @return void
136
+	 */
137
+	public function execute();
138
+
139
+	/**
140
+	 * Sets the site configuration object for this page
141
+	 *
142
+	 * @param SiteConfiguration $configuration
143
+	 *
144
+	 * @return void
145
+	 */
146
+	public function setSiteConfiguration($configuration);
147
+
148
+	/**
149
+	 * @return IrcNotificationHelper
150
+	 */
151
+	public function getNotificationHelper();
152
+
153
+	/**
154
+	 * @param IrcNotificationHelper $notificationHelper
155
+	 *
156
+	 * @return void
157
+	 */
158
+	public function setNotificationHelper($notificationHelper);
159
+
160
+	/**
161
+	 * @return TorExitProvider
162
+	 */
163
+	public function getTorExitProvider();
164
+
165
+	/**
166
+	 * @param TorExitProvider $torExitProvider
167
+	 *
168
+	 * @return void
169
+	 */
170
+	public function setTorExitProvider($torExitProvider);
171 171
 }
172 172
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Tasks/TaskBase.php 1 patch
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -23,229 +23,229 @@
 block discarded – undo
23 23
 
24 24
 abstract class TaskBase implements ITask
25 25
 {
26
-    /** @var SiteConfiguration */
27
-    private $siteConfiguration;
28
-    /** @var IEmailHelper */
29
-    private $emailHelper;
30
-    /** @var HttpHelper */
31
-    private $httpHelper;
32
-    /** @var WikiTextHelper */
33
-    private $wikiTextHelper;
34
-    /** @var ILocationProvider */
35
-    private $locationProvider;
36
-    /** @var IXffTrustProvider */
37
-    private $xffTrustProvider;
38
-    /** @var IRDnsProvider */
39
-    private $rdnsProvider;
40
-    /** @var IAntiSpoofProvider */
41
-    private $antiSpoofProvider;
42
-    /** @var IOAuthHelper */
43
-    private $oauthHelper;
44
-    /** @var PdoDatabase */
45
-    private $database;
46
-    /** @var IrcNotificationHelper */
47
-    private $notificationHelper;
48
-    /** @var TorExitProvider */
49
-    private $torExitProvider;
50
-
51
-    /**
52
-     * @return IEmailHelper
53
-     */
54
-    final public function getEmailHelper()
55
-    {
56
-        return $this->emailHelper;
57
-    }
58
-
59
-    /**
60
-     * @param IEmailHelper $emailHelper
61
-     */
62
-    final public function setEmailHelper($emailHelper)
63
-    {
64
-        $this->emailHelper = $emailHelper;
65
-    }
66
-
67
-    /**
68
-     * @return HttpHelper
69
-     */
70
-    final public function getHttpHelper()
71
-    {
72
-        return $this->httpHelper;
73
-    }
74
-
75
-    /**
76
-     * @param HttpHelper $httpHelper
77
-     */
78
-    final public function setHttpHelper($httpHelper)
79
-    {
80
-        $this->httpHelper = $httpHelper;
81
-    }
82
-
83
-    /**
84
-     * @return WikiTextHelper
85
-     */
86
-    final public function getWikiTextHelper()
87
-    {
88
-        return $this->wikiTextHelper;
89
-    }
90
-
91
-    /**
92
-     * @param WikiTextHelper $wikiTextHelper
93
-     */
94
-    final public function setWikiTextHelper($wikiTextHelper)
95
-    {
96
-        $this->wikiTextHelper = $wikiTextHelper;
97
-    }
98
-
99
-    /**
100
-     * @return ILocationProvider
101
-     */
102
-    final public function getLocationProvider()
103
-    {
104
-        return $this->locationProvider;
105
-    }
106
-
107
-    /**
108
-     * @param ILocationProvider $locationProvider
109
-     */
110
-    final public function setLocationProvider(ILocationProvider $locationProvider)
111
-    {
112
-        $this->locationProvider = $locationProvider;
113
-    }
114
-
115
-    /**
116
-     * @return IXffTrustProvider
117
-     */
118
-    final public function getXffTrustProvider()
119
-    {
120
-        return $this->xffTrustProvider;
121
-    }
122
-
123
-    /**
124
-     * @param IXffTrustProvider $xffTrustProvider
125
-     */
126
-    final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider)
127
-    {
128
-        $this->xffTrustProvider = $xffTrustProvider;
129
-    }
130
-
131
-    /**
132
-     * @return IRDnsProvider
133
-     */
134
-    final public function getRdnsProvider()
135
-    {
136
-        return $this->rdnsProvider;
137
-    }
138
-
139
-    /**
140
-     * @param IRDnsProvider $rdnsProvider
141
-     */
142
-    public function setRdnsProvider($rdnsProvider)
143
-    {
144
-        $this->rdnsProvider = $rdnsProvider;
145
-    }
146
-
147
-    /**
148
-     * @return IAntiSpoofProvider
149
-     */
150
-    public function getAntiSpoofProvider()
151
-    {
152
-        return $this->antiSpoofProvider;
153
-    }
154
-
155
-    /**
156
-     * @param IAntiSpoofProvider $antiSpoofProvider
157
-     */
158
-    public function setAntiSpoofProvider($antiSpoofProvider)
159
-    {
160
-        $this->antiSpoofProvider = $antiSpoofProvider;
161
-    }
162
-
163
-    /**
164
-     * @return PdoDatabase
165
-     */
166
-    final public function getDatabase()
167
-    {
168
-        return $this->database;
169
-    }
170
-
171
-    /**
172
-     * @param PdoDatabase $database
173
-     */
174
-    final public function setDatabase($database)
175
-    {
176
-        $this->database = $database;
177
-    }
178
-
179
-    /**
180
-     * @return IOAuthHelper
181
-     */
182
-    public function getOAuthHelper()
183
-    {
184
-        return $this->oauthHelper;
185
-    }
186
-
187
-    /**
188
-     * @param IOAuthHelper $oauthHelper
189
-     */
190
-    public function setOAuthHelper($oauthHelper)
191
-    {
192
-        $this->oauthHelper = $oauthHelper;
193
-    }
194
-
195
-    /**
196
-     * @return void
197
-     */
198
-    abstract public function execute();
199
-
200
-    /**
201
-     * @return IrcNotificationHelper
202
-     */
203
-    public function getNotificationHelper()
204
-    {
205
-        return $this->notificationHelper;
206
-    }
207
-
208
-    /**
209
-     * @param IrcNotificationHelper $notificationHelper
210
-     */
211
-    public function setNotificationHelper($notificationHelper)
212
-    {
213
-        $this->notificationHelper = $notificationHelper;
214
-    }
215
-
216
-    /**
217
-     * @return TorExitProvider
218
-     */
219
-    public function getTorExitProvider()
220
-    {
221
-        return $this->torExitProvider;
222
-    }
223
-
224
-    /**
225
-     * @param TorExitProvider $torExitProvider
226
-     */
227
-    public function setTorExitProvider($torExitProvider)
228
-    {
229
-        $this->torExitProvider = $torExitProvider;
230
-    }
231
-
232
-    /**
233
-     * Gets the site configuration object
234
-     *
235
-     * @return SiteConfiguration
236
-     */
237
-    final protected function getSiteConfiguration()
238
-    {
239
-        return $this->siteConfiguration;
240
-    }
241
-
242
-    /**
243
-     * Sets the site configuration object for this page
244
-     *
245
-     * @param SiteConfiguration $configuration
246
-     */
247
-    final public function setSiteConfiguration($configuration)
248
-    {
249
-        $this->siteConfiguration = $configuration;
250
-    }
26
+	/** @var SiteConfiguration */
27
+	private $siteConfiguration;
28
+	/** @var IEmailHelper */
29
+	private $emailHelper;
30
+	/** @var HttpHelper */
31
+	private $httpHelper;
32
+	/** @var WikiTextHelper */
33
+	private $wikiTextHelper;
34
+	/** @var ILocationProvider */
35
+	private $locationProvider;
36
+	/** @var IXffTrustProvider */
37
+	private $xffTrustProvider;
38
+	/** @var IRDnsProvider */
39
+	private $rdnsProvider;
40
+	/** @var IAntiSpoofProvider */
41
+	private $antiSpoofProvider;
42
+	/** @var IOAuthHelper */
43
+	private $oauthHelper;
44
+	/** @var PdoDatabase */
45
+	private $database;
46
+	/** @var IrcNotificationHelper */
47
+	private $notificationHelper;
48
+	/** @var TorExitProvider */
49
+	private $torExitProvider;
50
+
51
+	/**
52
+	 * @return IEmailHelper
53
+	 */
54
+	final public function getEmailHelper()
55
+	{
56
+		return $this->emailHelper;
57
+	}
58
+
59
+	/**
60
+	 * @param IEmailHelper $emailHelper
61
+	 */
62
+	final public function setEmailHelper($emailHelper)
63
+	{
64
+		$this->emailHelper = $emailHelper;
65
+	}
66
+
67
+	/**
68
+	 * @return HttpHelper
69
+	 */
70
+	final public function getHttpHelper()
71
+	{
72
+		return $this->httpHelper;
73
+	}
74
+
75
+	/**
76
+	 * @param HttpHelper $httpHelper
77
+	 */
78
+	final public function setHttpHelper($httpHelper)
79
+	{
80
+		$this->httpHelper = $httpHelper;
81
+	}
82
+
83
+	/**
84
+	 * @return WikiTextHelper
85
+	 */
86
+	final public function getWikiTextHelper()
87
+	{
88
+		return $this->wikiTextHelper;
89
+	}
90
+
91
+	/**
92
+	 * @param WikiTextHelper $wikiTextHelper
93
+	 */
94
+	final public function setWikiTextHelper($wikiTextHelper)
95
+	{
96
+		$this->wikiTextHelper = $wikiTextHelper;
97
+	}
98
+
99
+	/**
100
+	 * @return ILocationProvider
101
+	 */
102
+	final public function getLocationProvider()
103
+	{
104
+		return $this->locationProvider;
105
+	}
106
+
107
+	/**
108
+	 * @param ILocationProvider $locationProvider
109
+	 */
110
+	final public function setLocationProvider(ILocationProvider $locationProvider)
111
+	{
112
+		$this->locationProvider = $locationProvider;
113
+	}
114
+
115
+	/**
116
+	 * @return IXffTrustProvider
117
+	 */
118
+	final public function getXffTrustProvider()
119
+	{
120
+		return $this->xffTrustProvider;
121
+	}
122
+
123
+	/**
124
+	 * @param IXffTrustProvider $xffTrustProvider
125
+	 */
126
+	final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider)
127
+	{
128
+		$this->xffTrustProvider = $xffTrustProvider;
129
+	}
130
+
131
+	/**
132
+	 * @return IRDnsProvider
133
+	 */
134
+	final public function getRdnsProvider()
135
+	{
136
+		return $this->rdnsProvider;
137
+	}
138
+
139
+	/**
140
+	 * @param IRDnsProvider $rdnsProvider
141
+	 */
142
+	public function setRdnsProvider($rdnsProvider)
143
+	{
144
+		$this->rdnsProvider = $rdnsProvider;
145
+	}
146
+
147
+	/**
148
+	 * @return IAntiSpoofProvider
149
+	 */
150
+	public function getAntiSpoofProvider()
151
+	{
152
+		return $this->antiSpoofProvider;
153
+	}
154
+
155
+	/**
156
+	 * @param IAntiSpoofProvider $antiSpoofProvider
157
+	 */
158
+	public function setAntiSpoofProvider($antiSpoofProvider)
159
+	{
160
+		$this->antiSpoofProvider = $antiSpoofProvider;
161
+	}
162
+
163
+	/**
164
+	 * @return PdoDatabase
165
+	 */
166
+	final public function getDatabase()
167
+	{
168
+		return $this->database;
169
+	}
170
+
171
+	/**
172
+	 * @param PdoDatabase $database
173
+	 */
174
+	final public function setDatabase($database)
175
+	{
176
+		$this->database = $database;
177
+	}
178
+
179
+	/**
180
+	 * @return IOAuthHelper
181
+	 */
182
+	public function getOAuthHelper()
183
+	{
184
+		return $this->oauthHelper;
185
+	}
186
+
187
+	/**
188
+	 * @param IOAuthHelper $oauthHelper
189
+	 */
190
+	public function setOAuthHelper($oauthHelper)
191
+	{
192
+		$this->oauthHelper = $oauthHelper;
193
+	}
194
+
195
+	/**
196
+	 * @return void
197
+	 */
198
+	abstract public function execute();
199
+
200
+	/**
201
+	 * @return IrcNotificationHelper
202
+	 */
203
+	public function getNotificationHelper()
204
+	{
205
+		return $this->notificationHelper;
206
+	}
207
+
208
+	/**
209
+	 * @param IrcNotificationHelper $notificationHelper
210
+	 */
211
+	public function setNotificationHelper($notificationHelper)
212
+	{
213
+		$this->notificationHelper = $notificationHelper;
214
+	}
215
+
216
+	/**
217
+	 * @return TorExitProvider
218
+	 */
219
+	public function getTorExitProvider()
220
+	{
221
+		return $this->torExitProvider;
222
+	}
223
+
224
+	/**
225
+	 * @param TorExitProvider $torExitProvider
226
+	 */
227
+	public function setTorExitProvider($torExitProvider)
228
+	{
229
+		$this->torExitProvider = $torExitProvider;
230
+	}
231
+
232
+	/**
233
+	 * Gets the site configuration object
234
+	 *
235
+	 * @return SiteConfiguration
236
+	 */
237
+	final protected function getSiteConfiguration()
238
+	{
239
+		return $this->siteConfiguration;
240
+	}
241
+
242
+	/**
243
+	 * Sets the site configuration object for this page
244
+	 *
245
+	 * @param SiteConfiguration $configuration
246
+	 */
247
+	final public function setSiteConfiguration($configuration)
248
+	{
249
+		$this->siteConfiguration = $configuration;
250
+	}
251 251
 }
252 252
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Tasks/ApiPageBase.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -16,97 +16,97 @@
 block discarded – undo
16 16
 
17 17
 abstract class ApiPageBase extends TaskBase implements IRoutedTask, IApiAction
18 18
 {
19
-    /**
20
-     * API result document
21
-     * @var DOMDocument
22
-     */
23
-    protected $document;
24
-
25
-    public function __construct()
26
-    {
27
-        $this->document = new DOMDocument('1.0');
28
-    }
29
-
30
-    final public function execute()
31
-    {
32
-        $this->main();
33
-    }
34
-
35
-    /**
36
-     * @param string $routeName
37
-     */
38
-    public function setRoute($routeName)
39
-    {
40
-        // no-op
41
-    }
42
-
43
-    /**
44
-     * @return string
45
-     */
46
-    public function getRouteName()
47
-    {
48
-        return 'main';
49
-    }
50
-
51
-    /**
52
-     * Main function for this page, when no specific actions are called.
53
-     *
54
-     * @throws ApiException
55
-     * @return void
56
-     */
57
-    final protected function main()
58
-    {
59
-        if (headers_sent()) {
60
-            throw new ApiException('Headers have already been sent - this indicates a bug in the application!');
61
-        }
62
-
63
-        header("Content-Type: text/xml");
64
-
65
-        // javascript access control
66
-        $httpOrigin = WebRequest::origin();
67
-
68
-        if ($httpOrigin !== null) {
69
-            $CORSallowed = $this->getSiteConfiguration()->getCrossOriginResourceSharingHosts();
70
-
71
-            if (in_array($httpOrigin, $CORSallowed)) {
72
-                header("Access-Control-Allow-Origin: " . $httpOrigin);
73
-            }
74
-        }
75
-
76
-        $responseData = $this->runApiPage();
77
-
78
-        ob_end_clean();
79
-        print($responseData);
80
-        ob_start();
81
-    }
82
-
83
-    /**
84
-     * Method that runs API action
85
-     *
86
-     * @param DOMElement $apiDocument
87
-     *
88
-     * @return DOMElement
89
-     */
90
-    abstract public function executeApiAction(DOMElement $apiDocument);
91
-
92
-    /**
93
-     * @return string
94
-     */
95
-    final public function runApiPage()
96
-    {
97
-        $apiDocument = $this->document->createElement("api");
98
-
99
-        try {
100
-            $apiDocument = $this->executeApiAction($apiDocument);
101
-        }
102
-        catch (ApiException $ex) {
103
-            $exception = $this->document->createElement("error");
104
-            $exception->setAttribute("message", $ex->getMessage());
105
-            $apiDocument->appendChild($exception);
106
-        }
107
-
108
-        $this->document->appendChild($apiDocument);
109
-
110
-        return $this->document->saveXML();
111
-    }
19
+	/**
20
+	 * API result document
21
+	 * @var DOMDocument
22
+	 */
23
+	protected $document;
24
+
25
+	public function __construct()
26
+	{
27
+		$this->document = new DOMDocument('1.0');
28
+	}
29
+
30
+	final public function execute()
31
+	{
32
+		$this->main();
33
+	}
34
+
35
+	/**
36
+	 * @param string $routeName
37
+	 */
38
+	public function setRoute($routeName)
39
+	{
40
+		// no-op
41
+	}
42
+
43
+	/**
44
+	 * @return string
45
+	 */
46
+	public function getRouteName()
47
+	{
48
+		return 'main';
49
+	}
50
+
51
+	/**
52
+	 * Main function for this page, when no specific actions are called.
53
+	 *
54
+	 * @throws ApiException
55
+	 * @return void
56
+	 */
57
+	final protected function main()
58
+	{
59
+		if (headers_sent()) {
60
+			throw new ApiException('Headers have already been sent - this indicates a bug in the application!');
61
+		}
62
+
63
+		header("Content-Type: text/xml");
64
+
65
+		// javascript access control
66
+		$httpOrigin = WebRequest::origin();
67
+
68
+		if ($httpOrigin !== null) {
69
+			$CORSallowed = $this->getSiteConfiguration()->getCrossOriginResourceSharingHosts();
70
+
71
+			if (in_array($httpOrigin, $CORSallowed)) {
72
+				header("Access-Control-Allow-Origin: " . $httpOrigin);
73
+			}
74
+		}
75
+
76
+		$responseData = $this->runApiPage();
77
+
78
+		ob_end_clean();
79
+		print($responseData);
80
+		ob_start();
81
+	}
82
+
83
+	/**
84
+	 * Method that runs API action
85
+	 *
86
+	 * @param DOMElement $apiDocument
87
+	 *
88
+	 * @return DOMElement
89
+	 */
90
+	abstract public function executeApiAction(DOMElement $apiDocument);
91
+
92
+	/**
93
+	 * @return string
94
+	 */
95
+	final public function runApiPage()
96
+	{
97
+		$apiDocument = $this->document->createElement("api");
98
+
99
+		try {
100
+			$apiDocument = $this->executeApiAction($apiDocument);
101
+		}
102
+		catch (ApiException $ex) {
103
+			$exception = $this->document->createElement("error");
104
+			$exception->setAttribute("message", $ex->getMessage());
105
+			$apiDocument->appendChild($exception);
106
+		}
107
+
108
+		$this->document->appendChild($apiDocument);
109
+
110
+		return $this->document->saveXML();
111
+	}
112 112
 }
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Tasks/PublicInterfacePageBase.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,21 +10,21 @@
 block discarded – undo
10 10
 
11 11
 abstract class PublicInterfacePageBase extends PageBase
12 12
 {
13
-    /**
14
-     * PublicInterfaceInternalPageBase constructor.
15
-     */
16
-    public function __construct()
17
-    {
18
-        $this->template = 'publicbase.tpl';
19
-    }
13
+	/**
14
+	 * PublicInterfaceInternalPageBase constructor.
15
+	 */
16
+	public function __construct()
17
+	{
18
+		$this->template = 'publicbase.tpl';
19
+	}
20 20
 
21
-    final public function execute()
22
-    {
23
-        parent::execute();
24
-    }
21
+	final public function execute()
22
+	{
23
+		parent::execute();
24
+	}
25 25
 
26
-    final public function finalisePage()
27
-    {
28
-        parent::finalisePage();
29
-    }
26
+	final public function finalisePage()
27
+	{
28
+		parent::finalisePage();
29
+	}
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
includes/DataObject.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -23,124 +23,124 @@
 block discarded – undo
23 23
  */
24 24
 abstract class DataObject
25 25
 {
26
-    /** @var int ID of the object */
27
-    protected $id = null;
28
-    /** @var int update version for optimistic locking */
29
-    protected $updateversion = 0;
30
-    /**
31
-     * @var PdoDatabase
32
-     */
33
-    protected $dbObject;
34
-
35
-    /**
36
-     * Retrieves a data object by it's row ID.
37
-     *
38
-     * @param int         $id
39
-     * @param PdoDatabase $database
40
-     *
41
-     * @return DataObject|false
42
-     */
43
-    public static function getById($id, PdoDatabase $database)
44
-    {
45
-        $array = explode('\\', get_called_class());
46
-        $realClassName = strtolower(end($array));
47
-
48
-        $statement = $database->prepare("SELECT * FROM {$realClassName} WHERE id = :id LIMIT 1;");
49
-        $statement->bindValue(":id", $id);
50
-
51
-        $statement->execute();
52
-
53
-        $resultObject = $statement->fetchObject(get_called_class());
54
-
55
-        if ($resultObject != false) {
56
-            $resultObject->setDatabase($database);
57
-        }
58
-
59
-        return $resultObject;
60
-    }
61
-
62
-    public function setDatabase(PdoDatabase $db)
63
-    {
64
-        $this->dbObject = $db;
65
-    }
66
-
67
-    /**
68
-     * Gets the database associated with this data object.
69
-     * @return PdoDatabase
70
-     */
71
-    public function getDatabase()
72
-    {
73
-        return $this->dbObject;
74
-    }
75
-
76
-    /**
77
-     * Saves a data object to the database, either updating or inserting a record.
78
-     *
79
-     * @return void
80
-     */
81
-    abstract public function save();
82
-
83
-    /**
84
-     * Retrieves the ID attribute
85
-     */
86
-    public function getId()
87
-    {
88
-        return (int)$this->id;
89
-    }
90
-
91
-    /**
92
-     * Deletes the object from the database
93
-     */
94
-    public function delete()
95
-    {
96
-        if ($this->id === null) {
97
-            // wtf?
98
-            return;
99
-        }
100
-
101
-        $array = explode('\\', get_called_class());
102
-        $realClassName = strtolower(end($array));
103
-
104
-        $deleteQuery = "DELETE FROM {$realClassName} WHERE id = :id AND updateversion = :updateversion LIMIT 1;";
105
-        $statement = $this->dbObject->prepare($deleteQuery);
106
-
107
-        $statement->bindValue(":id", $this->id);
108
-        $statement->bindValue(":updateversion", $this->updateversion);
109
-        $statement->execute();
110
-
111
-        if ($statement->rowCount() !== 1) {
112
-            throw new OptimisticLockFailedException();
113
-        }
114
-
115
-        $this->id = null;
116
-    }
117
-
118
-    /**
119
-     * @return int
120
-     */
121
-    public function getUpdateVersion()
122
-    {
123
-        return $this->updateversion;
124
-    }
125
-
126
-    /**
127
-     * Sets the update version.
128
-     *
129
-     * You should never call this to change the value of the update version. You should only call it when passing user
130
-     * input through.
131
-     *
132
-     * @param int $updateVersion
133
-     */
134
-    public function setUpdateVersion($updateVersion)
135
-    {
136
-        $this->updateversion = $updateVersion;
137
-    }
138
-
139
-    /**
140
-     * @return bool
141
-     */
142
-    public function isNew()
143
-    {
144
-        return $this->id === null;
145
-    }
26
+	/** @var int ID of the object */
27
+	protected $id = null;
28
+	/** @var int update version for optimistic locking */
29
+	protected $updateversion = 0;
30
+	/**
31
+	 * @var PdoDatabase
32
+	 */
33
+	protected $dbObject;
34
+
35
+	/**
36
+	 * Retrieves a data object by it's row ID.
37
+	 *
38
+	 * @param int         $id
39
+	 * @param PdoDatabase $database
40
+	 *
41
+	 * @return DataObject|false
42
+	 */
43
+	public static function getById($id, PdoDatabase $database)
44
+	{
45
+		$array = explode('\\', get_called_class());
46
+		$realClassName = strtolower(end($array));
47
+
48
+		$statement = $database->prepare("SELECT * FROM {$realClassName} WHERE id = :id LIMIT 1;");
49
+		$statement->bindValue(":id", $id);
50
+
51
+		$statement->execute();
52
+
53
+		$resultObject = $statement->fetchObject(get_called_class());
54
+
55
+		if ($resultObject != false) {
56
+			$resultObject->setDatabase($database);
57
+		}
58
+
59
+		return $resultObject;
60
+	}
61
+
62
+	public function setDatabase(PdoDatabase $db)
63
+	{
64
+		$this->dbObject = $db;
65
+	}
66
+
67
+	/**
68
+	 * Gets the database associated with this data object.
69
+	 * @return PdoDatabase
70
+	 */
71
+	public function getDatabase()
72
+	{
73
+		return $this->dbObject;
74
+	}
75
+
76
+	/**
77
+	 * Saves a data object to the database, either updating or inserting a record.
78
+	 *
79
+	 * @return void
80
+	 */
81
+	abstract public function save();
82
+
83
+	/**
84
+	 * Retrieves the ID attribute
85
+	 */
86
+	public function getId()
87
+	{
88
+		return (int)$this->id;
89
+	}
90
+
91
+	/**
92
+	 * Deletes the object from the database
93
+	 */
94
+	public function delete()
95
+	{
96
+		if ($this->id === null) {
97
+			// wtf?
98
+			return;
99
+		}
100
+
101
+		$array = explode('\\', get_called_class());
102
+		$realClassName = strtolower(end($array));
103
+
104
+		$deleteQuery = "DELETE FROM {$realClassName} WHERE id = :id AND updateversion = :updateversion LIMIT 1;";
105
+		$statement = $this->dbObject->prepare($deleteQuery);
106
+
107
+		$statement->bindValue(":id", $this->id);
108
+		$statement->bindValue(":updateversion", $this->updateversion);
109
+		$statement->execute();
110
+
111
+		if ($statement->rowCount() !== 1) {
112
+			throw new OptimisticLockFailedException();
113
+		}
114
+
115
+		$this->id = null;
116
+	}
117
+
118
+	/**
119
+	 * @return int
120
+	 */
121
+	public function getUpdateVersion()
122
+	{
123
+		return $this->updateversion;
124
+	}
125
+
126
+	/**
127
+	 * Sets the update version.
128
+	 *
129
+	 * You should never call this to change the value of the update version. You should only call it when passing user
130
+	 * input through.
131
+	 *
132
+	 * @param int $updateVersion
133
+	 */
134
+	public function setUpdateVersion($updateVersion)
135
+	{
136
+		$this->updateversion = $updateVersion;
137
+	}
138
+
139
+	/**
140
+	 * @return bool
141
+	 */
142
+	public function isNew()
143
+	{
144
+		return $this->id === null;
145
+	}
146 146
 }
Please login to merge, or discard this patch.
includes/Pages/Request/PageEmailConfirmationRequired.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@
 block discarded – undo
12 12
 
13 13
 class PageEmailConfirmationRequired extends PublicInterfacePageBase
14 14
 {
15
-    /**
16
-     * Main function for this page, when no specific actions are called.
17
-     * @return void
18
-     */
19
-    protected function main()
20
-    {
21
-        $this->setTemplate('request/email-confirmation.tpl');
22
-    }
15
+	/**
16
+	 * Main function for this page, when no specific actions are called.
17
+	 * @return void
18
+	 */
19
+	protected function main()
20
+	{
21
+		$this->setTemplate('request/email-confirmation.tpl');
22
+	}
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.