forked from torrentpier/torrentpier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax.php
57 lines (46 loc) · 1.42 KB
/
ajax.php
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
57
<?php
/**
* TorrentPier – Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2018 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
define('BB_SCRIPT', 'ajax');
define('IN_AJAX', true);
require __DIR__ . '/common.php';
$ajax = new TorrentPier\Legacy\Ajax();
$ajax->init();
// Init userdata
$user->session_start();
// Exit if board is disabled via ON/OFF trigger or by admin
if ($ajax->action != 'manage_admin') {
if ($bb_cfg['board_disable']) {
$ajax->ajax_die($lang['BOARD_DISABLE']);
} elseif (file_exists(BB_DISABLED)) {
$ajax->ajax_die($lang['BOARD_DISABLE_CRON']);
}
}
// Load actions required modules
switch ($ajax->action) {
case 'view_post':
case 'posts':
case 'post_mod_comment':
require INC_DIR . '/bbcode.php';
break;
case 'view_torrent':
case 'mod_action':
case 'change_tor_status':
case 'change_torrent':
case 'gen_passkey':
require ATTACH_DIR . '/attachment_mod.php';
break;
}
// Position in $ajax->valid_actions['xxx']
define('AJAX_AUTH', 0); // 'guest', 'user', 'mod', 'admin', 'super_admin'
$ajax->exec();
/**
* @deprecated ajax_common
* Dirty class removed from here since 2.2.0
* To add new actions see at src/Legacy/Ajax.php
*/