-
Notifications
You must be signed in to change notification settings - Fork 1
/
report.php
215 lines (177 loc) · 7.21 KB
/
report.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.2.0 Patch Level 3 - Licence Number VBFBED0615
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2012 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'report');
define('CSRF_PROTECTION', true);
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('messaging');
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
'newpost_usernamecode',
'reportitem'
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_misc.php'); // for fetch_phrase
require_once(DIR . '/includes/class_reportitem.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
//check usergroup of user to see if they can use this
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
}
$reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid));
$reportemail = ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail']);
if (!$reportthread AND !$reportemail)
{
eval(standard_error(fetch_error('emaildisabled')));
}
$vbulletin->input->clean_array_gpc('r', array(
'return_node' => TYPE_UINT,
));
if ($vbulletin->GPC['return_node'])
{
$report_type = 'article_comment';
$content = new vBCms_Item_Content_Article($vbulletin->GPC['return_node']);
$reportobj = new vB_ReportItem_ArticleComment($vbulletin);
$reportobj->set_extrainfo('node', $vbulletin->GPC['return_node']);
$reportobj->set_extrainfo('forum', $foruminfo);
$reportobj->set_extrainfo('thread', $threadinfo);
// check cms permissions on the article
if (!$content->canView())
{
print_no_permission();
}
define('CMS_SCRIPT', true);
vB_View::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB());
vBCms_NavBar::prepareNavBar($content);
}
else
{
$report_type = 'post';
$reportobj = new vB_ReportItem_Post($vbulletin);
$reportobj->set_extrainfo('forum', $foruminfo);
$reportobj->set_extrainfo('thread', $threadinfo);
$forumperms = fetch_permissions($threadinfo['forumid']);
if (
!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])
OR
!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
OR
(($threadinfo['postuserid'] != $vbulletin->userinfo['userid']) AND !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']))
)
{
print_no_permission();
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
}
$perform_floodcheck = $reportobj->need_floodcheck();
if ($perform_floodcheck)
{
$reportobj->perform_floodcheck_precommit();
}
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'report';
}
if (!$postinfo['postid'])
{
eval(standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink'])));
}
if ((!$postinfo['visible'] OR $postinfo ['isdeleted']) AND !can_moderate($threadinfo['forumid']))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink'])));
}
if ((!$threadinfo['visible'] OR $threadinfo['isdeleted']) AND !can_moderate($threadinfo['forumid']))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
($hook = vBulletinHook::fetch_hook('report_start')) ? eval($hook) : false;
if ($_REQUEST['do'] == 'report')
{
// draw breadcrumbs depending on type
$navbits = array();
if ($report_type == 'article_comment')
{
vB::$vbulletin->options['selectednavtab'] = 'vbcms';
$home_url = vB::$vbulletin->options['site_tab_url']
. (stripos('?', vB::$vbulletin->options['site_tab_url']) === false ? '?' : '&')
. "s=" . vB::$vbulletin->session->vars['sessionhash'];
$navbits[$home_url] = $vbphrase['vbcms_title'];
$breadcrumbs = $content->getBreadcrumbInfo();
foreach ($breadcrumbs AS $breadcrumb)
{
$navbits[$breadcrumb['link']] = $breadcrumb['title'];
}
$url = vBCms_Route_Content::getURL(array('node' => $vbulletin->GPC['return_node'] . '-' . $content->getUrl()));
$navbits[$url] = $content->getTitle();
$navbits[''] = $vbphrase['report_bad_articlecomment'];
}
else
{
$navbits[fetch_seo_url('forumhome', array())] = $vbphrase['forum'];
$parentlist = array_reverse(explode(',', $foruminfo['parentlist']));
foreach ($parentlist AS $forumID)
{
$forumTitle = $vbulletin->forumcache["$forumID"]['title'];
$navbits[fetch_seo_url('forum', array('forumid' => $forumID, 'title' => $forumTitle))] = $forumTitle;
}
$navbits[fetch_seo_url('thread', $threadinfo, array('p' => $postid)) . "#post$postid"] = $threadinfo['prefix_plain_html'] . ' ' . $threadinfo['title'];
$url = fetch_seo_url('thread', $threadinfo, array('p' => $postid)) . "#post$postid";
$navbits[''] = $vbphrase['report_bad_post'];
}
$navbits = construct_navbits($navbits);
$usernamecode = vB_Template::create('newpost_usernamecode')->render();
$navbar = render_navbar_template($navbits);
($hook = vBulletinHook::fetch_hook('report_form_start')) ? eval($hook) : false;
$forminfo = $reportobj->set_forminfo($postinfo);
$templater = vB_Template::create('reportitem');
$templater->register_page_templates();
$templater->register('forminfo', $forminfo);
$templater->register('navbar', $navbar);
$templater->register('url', $url);
$templater->register('usernamecode', $usernamecode);
print_output($templater->render());
}
if ($_POST['do'] == 'sendemail')
{
$vbulletin->input->clean_array_gpc('p', array(
'reason' => TYPE_STR,
));
if ($vbulletin->GPC['reason'] == '')
{
eval(standard_error(fetch_error('noreason')));
}
if ($perform_floodcheck)
{
$reportobj->perform_floodcheck_commit();
}
$reportobj->do_report($vbulletin->GPC['reason'], $postinfo);
print_standard_redirect('redirect_reportthanks');
}
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 16:29, Sun Dec 9th 2012
|| # CVS: $RCSfile$ - $Revision: 62098 $
|| ####################################################################
\*======================================================================*/
?>