-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (42 loc) · 1.12 KB
/
index.php
File metadata and controls
56 lines (42 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace Wikimedia\TorProxy;
error_reporting( -1 );
ini_set( 'display_errors', 1 );
session_start();
include_once 'autoload.php';
require 'config.php';
$output = new Output( $TorProxyTemplateConfig );
try {
$logger = new Logger( $TorProxyLogConfig );
$db = new Database( $TorProxyDBConfig, $logger );
$conn = array(
'ip' => $_SERVER['REMOTE_ADDR'],
'ua' => $_SERVER['HTTP_USER_AGENT'],
);
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$xff = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
$conn['xff1'] = array_pop( $xff );
}
$config = Settings::getInstance();
$config->setVars(
$db,
$logger,
$TorProxyOAuthConfig,
$TorProxyWikiConfig,
$TorProxyConfig,
$conn
);
$user = User::getUser( $db );
$action = isset( $_GET['action'] ) ? $_GET['action'] : 'anon';
$request = $_REQUEST;
$handler = ActionHandlerFactory::getHandler( $action );
$handler->checkAccess( $user );
$handler->checkAccess( $user );
$handler->process( $user, $request, $output, $config );
} catch ( \Exception $e ) {
$output->addTemplate(
'msgerror',
array( 'message' => $e->getMessage() )
);
}
$output->show();