-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpm.php
136 lines (130 loc) · 5.85 KB
/
pm.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/**
**********************
** BTManager v3.0.2 **
**********************
** http://www.btmanager.org/
** https://github.com/blackheart1/BTManager3.0.2
** http://demo.btmanager.org/index.php
** Licence Info: GPL
** Copyright (C) 2018
** Formerly Known As phpMyBitTorrent
** Created By Antonio Anzivino (aka DJ Echelon)
** And Joe Robertson (aka joeroberts/Black_Heart)
** Project Leaders: Black_Heart, Thor.
** File pm.php 2018-09-22 00:00:00 Thor
**
** CHANGES
**
** 2018-09-22 - Updated Masthead, Github, !defined('IN_BTM')
**/
if (defined('IN_BTM'))
{
require_once($_SERVER['DOCUMENT_ROOT'].'/security.php');
die ("Error 404 - Page Not Found");
}
define("IN_BTM",true);
require_once("common.php");
$user->set_lang('ucp',$user->ulanguage);
$user->set_lang('pm',$user->ulanguage);
$template = new Template();
if($user->id == 0 OR !checkaccess('u_sendpm')){
set_site_var('- '.$user->lang['USER_CPANNEL'].' - '.$user->lang['BT_ERROR']);
$template->assign_vars(array(
'S_ERROR' => true,
'S_FORWARD' => false,
'TITTLE_M' => $user->lang['GEN_ERROR'],
'MESSAGE' => sprintf($user->lang['GROUP_NO_ACCESS_PAGE'],getlevel($user->group)).back_link('./index.php'),
));
echo $template->fetch('message_body.html');
close_out();
}
if (!isset($op)) {
if (isset($mid1) AND is_numeric($mid)) $op = "readmsg";
else $op = "inbox";
}
$template->assign_var('S_PRIVMSGS', true);
$navoption = true;
switch($op) {
case "blacklist": {
if (!isset($id) OR !is_numeric($id)) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sqlcheck = "SELECT id FROM ".$db_prefix."_users WHERE id = '".$id."';";
$rescheck = $db->sql_query($sqlcheck);
$n = $db->sql_numrows($rescheck);
$db->sql_freeresult($rescheck);
if (!$n) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sql = "INSERT INTO ".$db_prefix."_private_messages_blacklist (master, slave) VALUES ('".$user->id."','".$id."');";
$db->sql_query($sql) or btsqlerror($sql);
$sql = "DELETE FROM ".$db_prefix."_private_messages_bookmarks WHERE master = '".$user->id."' AND slave = '".$id."';";
$db->sql_query($sql) or btsqlerror($sql);
header("Location: user.php?op=profile&id=" . $id);
die();
}
case "removeblacklist": {
if (!isset($id) OR !is_numeric($id)) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sqlcheck = "SELECT id FROM ".$db_prefix."_users WHERE id = '".$id."';";
$rescheck = $db->sql_query($sqlcheck);
$n = $db->sql_numrows($rescheck);
$db->sql_freeresult($rescheck);
if (!$n) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sql = "DELETE FROM ".$db_prefix."_private_messages_blacklist WHERE master = '".$user->id."' AND slave = '".$id."';";
$db->sql_query($sql) or btsqlerror($sql);
header("Location: user.php?op=profile&id=" . $id);
die();
}
case "bookmark": {
if (!isset($id) OR !is_numeric($id)) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sqlcheck = "SELECT id FROM ".$db_prefix."_users WHERE id = '".$id."';";
$rescheck = $db->sql_query($sqlcheck);
$n = $db->sql_numrows($rescheck);
$db->sql_freeresult($rescheck);
if (!$n) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sql = "INSERT INTO ".$db_prefix."_private_messages_bookmarks (master, slave) VALUES ('".$user->id."','".$id."');";
$db->sql_query($sql) or btsqlerror($sql);
$sql = "DELETE FROM ".$db_prefix."_private_messages_blacklist WHERE master = '".$user->id."' AND slave = '".$id."';";
$db->sql_query($sql) or btsqlerror($sql);
header("Location: user.php?op=profile&id=" . $id);
die();
}
case "removebookmark": {
if (!isset($id) OR !is_numeric($id)) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sqlcheck = "SELECT id FROM ".$db_prefix."_users WHERE id = '".$id."';";
$rescheck = $db->sql_query($sqlcheck);
$n = $db->sql_numrows($rescheck);
$db->sql_freeresult($rescheck);
if (!$n) bterror($user->lang['NO_SUCH_USER'],'BT_ERROR');
$sql = "DELETE FROM ".$db_prefix."_private_messages_bookmarks WHERE master='".$user->id."' AND slave = '".$id."';";
$db->sql_query($sql) or btsqlerror($sql);
header("Location: user.php?op=profile&id=" . $id);
die();
}
case "send": {
set_site_var($user->lang['_UCP_PM']);
include("pm/send.php");
break;
}
case "readmsg": {
set_site_var($user->lang['_UCP_PM']);
include("pm/readmsg.php");
break;
}
case "drafts": {
set_site_var($user->lang['_UCP_PM']);
include("pm/drafts.php");
break;
}
case "options": {
set_site_var($user->lang['_UCP_PM']);
include("pm/options.php");
break;
}
case "folder":
case "inbox":
default: {
set_site_var($user->lang['_UCP_PM']);
$u_action = 'pm.php';
include("pm/inbox.php");
break;
}
}
?>