-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy paththread_reply.php
More file actions
68 lines (50 loc) · 1.77 KB
/
Copy paththread_reply.php
File metadata and controls
68 lines (50 loc) · 1.77 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
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
*
* @module Forum
* @version 0.5.10
* @authors Julian Schuh, Bernd Michna, "Herr Rilke", Dietrich Roland Pehlke (last)
* @license GNU General Public License
* @platform 2.8.x
* @requirements PHP 5.6.x and higher
*
*/
// Include config file
require('../../config.php');
// Validation:
// [1| no 'tid' (thread id) given
if(!isset($_REQUEST['tid'])) die(header('Location: ' . WB_URL . PAGES_DIRECTORY));
$thread_query = $database->query("SELECT * FROM `" . TABLE_PREFIX . "mod_forum_thread` WHERE `threadid` = '" . intval($_REQUEST['tid']) . "'");
// [2] There was an query error
if( $database->is_error()) die( "[Error: 2005] ".$database->get_error());
// [3] Result list is empty - no matches found
if( $thread_query->numRows() == 0 ) die(header('Location: ' . WB_URL . PAGES_DIRECTORY));
$thread = $thread_query->fetchRow();
if(!$thread)
{
exit(header('Location: ' . WB_URL . PAGES_DIRECTORY));
}
$forum_query = $database->query("SELECT * FROM `" . TABLE_PREFIX . "mod_forum_forum` WHERE `forumid` = '" . intval($thread['forumid']) . "'");
$forum = $forum_query->fetchRow();
if(!$forum)
{
exit(header('Location: ' . WB_URL . PAGES_DIRECTORY));
}
$section_id = $forum['section_id'];
$page_id = $forum['page_id'];
define('SECTION_ID', $section_id);
require_once(WB_PATH . '/modules/forum/backend.php');
$query_page = $database->query("
SELECT * FROM ".TABLE_PREFIX."pages AS p
INNER JOIN ".TABLE_PREFIX."sections AS s USING(page_id)
WHERE p.page_id = '$page_id' AND section_id = '$section_id'
");
if(0 == $query_page->numRows())
{
exit(header('Location: ' . WB_URL . PAGES_DIRECTORY));
}
$page = $query_page->fetchRow();
define('FORUM_DISPLAY_CONTENT', 'reply_thread');
define('PAGE_CONTENT', WB_PATH . '/modules/forum/content.php');
require(WB_PATH . '/index.php');
?>