-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathadmin.php
116 lines (107 loc) · 3.25 KB
/
admin.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* XDCC Parser
* |- Admin Module
*
* This software is free software and you are permitted to
* modify and redistribute it under the terms of the GNU General
* Public License version 3 as published by the Free Sofware
* Foundation.
*
* @link http://xdccparser.is-fabulo.us/
* @version 1.2.0
* @author Alex 'xshadowfire' Yu <[email protected]>
* @author DrX
* @copyright 2008-2009 Alex Yu and DrX
*/
//set your user and password here
define('ADMIN_USER', "changeme");
define('ADMIN_PASS', "yougonnagethackedifyoudont");
// DO NOT EDIT BELOW!!
if (!($_SERVER['PHP_AUTH_USER'] == ADMIN_USER &&$_SERVER['PHP_AUTH_PW'] == ADMIN_PASS)) {
header('WWW-Authenticate: Basic realm="XDCC Parser Admin"');
header('HTTP/1.0 401 Unauthorized');
die("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p>You don't have permission to access ".$_SERVER['REQUEST_URI']." on this server.</p>\n</body></html>\n");
}
require_once 'core.php';
require_once 'smarty/libs/Smarty.class.php';
//initialize smarty
$s = new Smarty();
$s->caching = false;
$s->template_dir = "./tpl";
$s->compile_dir = "./templates_c";
$botconfig = xp_get("botconfig");
$config = xp_get("config");
$bookmarks = xp_get("bookmarks");
$s->assign("skin", $_REQUEST['skin'] ? $_REQUEST['skin'] : SKIN);
if(IRC) {
$s->assign("irc_chan", IRC_CHANNEL);
$s->assign("irc_net", IRC_NETWORK);
}
switch($_REQUEST['do']) {
case 'editbot':
if($botconfig[$_REQUEST['bot']]) {
$s->assign("edit", $_REQUEST['bot']);
$s->assign("boturi", $botconfig[$_REQUEST['bot']]);
}
$s->display("adminbot.tpl");
exit();
case 'editbookmark':
if($bookmarks[$_REQUEST['bm_id']]) {
$s->assign("bm", htmlentities($bookmarks[$_REQUEST['bm_id']][0]));
$s->assign("bmv", htmlentities($bookmarks[$_REQUEST['bm_id']][1]));
$s->assign("bm_id", $_REQUEST['bm_id']);
}
$s->display("adminbookmark.tpl");
exit();
case 'editgroup':
$s->assign("group",$config['group']);
$s->display("admingroup.tpl");
exit();
case 'deletebot':
if($botconfig[$_REQUEST['bot']]) {
unset($botconfig[$_REQUEST['bot']]);
xp_set("botconfig",$botconfig);
$refresh = 1;
}
break;
case 'commitbot':
if($_REQUEST['botname'] && $_REQUEST['boturi']) {
$botconfig[$_REQUEST['botname']] = $_REQUEST['boturi'];
xp_set("botconfig",$botconfig);
$refresh = 1;
}
break;
case 'deletebookmark':
if($bookmarks[$_REQUEST['bm_id']]) {
unset($bookmarks[$_REQUEST['bm_id']]);
xp_set("bookmarks",$bookmarks);
}
break;
case 'commitbookmark':
if($_REQUEST['bmname'] && $_REQUEST['bmval']) {
if(!$_REQUEST['bm_id']) {
if(empty($bookmarks))
$_REQUEST['bm_id'] = 1;
else
$_REQUEST['bm_id'] = array_pop(array_keys($bookmarks)) + 1;
}
$bookmarks[$_REQUEST['bm_id']] = array( stripslashes($_REQUEST['bmname']), stripslashes($_REQUEST['bmval']) );
xp_set("bookmarks",$bookmarks);
}
break;
case 'commitgroup':
$config['group'] = stripslashes($_REQUEST['groupname']);
xp_set("config",$config);
$refresh = 1;
break;
case 'refresh':
$refresh = 1;
break;
}
if($refresh) require_once "refresh.php";
$s->assign("bots",$botconfig);
$s->assign("config",$config);
$s->assign("bookmarks",$bookmarks);
$s->display("adminindex.tpl");
?>