-
Notifications
You must be signed in to change notification settings - Fork 5
/
view_submission.php
167 lines (151 loc) · 5.18 KB
/
view_submission.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
<?php
/**
* WebsiteBaker CMS module: mpForm
* ===============================
* This module allows you to create customised online forms, such as a feedback form with file upload and customizable email notifications. mpForm allows forms over one or more pages, loops of forms, conditionally displayed sections within a single page, and many more things. User input for the same session_id will become a single row in the submitted table. Since Version 1.1.0 many ajax helpers enable you to speed up the process of creating forms with this module. Since 1.2.0 forms can be imported and exported directly in the module.
*
* @category page
* @module mpform
* @version 1.3.36
* @authors Frank Heyne, NorHei(heimsath.org), Christian M. Stefan (Stefek), Martin Hecht (mrbaseman) and others
* @copyright (c) 2009 - 2020, Website Baker Org. e.V.
* @url https://github.com/WebsiteBaker-modules/mpform
* @license GNU General Public License
* @platform 2.8.x
* @requirements php >= 5.3
*
**/
/* This file shows the content of a submission for a page in the backend. */
// manually include the config.php file (defines the required constants)
require('../../config.php');
// $admin_header = false;
// Tells script to update when this page was last updated
$update_when_modified = false;
// show the info banner
$print_info_banner = true;
// Include WB admin wrapper script
require(WB_PATH.'/modules/admin.php');
// obtain module directory
$mod_dir = basename(dirname(__FILE__));
// include module.functions.php (introduced with WB 2.7)
@include_once(WB_PATH . '/framework/module.functions.php');
require_once(dirname(__FILE__).'/constants.php');
// include the module language file depending on the backend language of the current user
if (!@include(get_module_language_file($mod_dir))) return;
// Get id
if (method_exists( $admin, 'checkIDKEY' )
&& (!(defined('MPFORM_SKIP_IDKEY')&&(MPFORM_SKIP_IDKEY))) ) {
$submission_id = $admin->checkIDKEY('submission_id', false, 'GET');
} else {
$submission_id = (int) $_GET['submission_id'];
}
if ((!$submission_id)
&& (!(defined('MPFORM_SKIP_IDKEY')&&(MPFORM_SKIP_IDKEY)))) {
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']
.' (IDKEY) '.__FILE__.':'.__LINE__,
ADMIN_URL.'/pages/modify.php?page_id='.(int)$page_id);
exit();
}
// Get submission details
$query_content
= $database->query(
"SELECT *"
. " FROM `".TP_MPFORM."submissions`"
. " WHERE `submission_id` = '$submission_id'"
);
$submission = $query_content->fetchRow();
// Get the user details of whoever did this submission
$query_user
= "SELECT username,display_name"
. " FROM `".TABLE_PREFIX."users`"
. " WHERE `user_id` = '".$submission['submitted_by']."'";
$get_user = $database->query($query_user);
if($get_user->numRows() != 0) {
$user = $get_user->fetchRow();
} else {
$user['display_name'] = 'Unknown';
$user['username'] = 'unknown';
}
echo '<table class="settings_table" cellpadding="0" cellspacing="0" border="0" width="100%">'
. '<caption>'
. $TEXT['SUBMISSION_ID']
. ': '
. $submission['submission_id']
. '</caption>'
. '<tr>'
. '<th>'
. $TEXT['SUBMITTED']
. ': '
. '</th>'
. '<td>'
. date(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when'])
. '</td>'
. '</td>'
. '<tr>'
. '<th>'
. $TEXT['USER']
. ': '
. '</th>'
. '<td>'
. $user['display_name']
. ' ('
. $user['username']
. ')'
. '</td>'
. '</tr>'
. '<tr>'
. '<td colspan="2">';
$lines = explode("\n",$submission['body']);
foreach($lines as $k => $v) {
$hr = explode('url]',$v);
if (count($hr)>1) {
$hr[0] = substr($hr[0],0,-1);
$hr[1] = substr($hr[1],0,-2);
$v = $hr[0]."[url]".$hr[1]."[/url]".$hr[2];
echo str_replace(
array('[url]','[/url]'),
array('<a href="','" target="_blank">'.$hr[1].'</a>'),
$v
);
} else {
echo $v;
}
echo "<br>";
}
echo '</td></tr></table>';
$sModuleUrl = WB_URL.'/modules/'.basename(dirname(__FILE__));
$sIconDir = $sModuleUrl.'/images';
echo '<table cellpadding="0" cellspacing="0" border="0" width="99%">'
. '<tr>'
. '<td align="left">'
. '<button class="mod_mpform_button" onclick="javascript: confirm_link(\''
. $TEXT['ARE_YOU_SURE']
. "', '"
. $sModuleUrl
. '/delete_submission.php?page_id='
. $page_id
. '§ion_id='
. $section_id
. '&submission_id='
. ((method_exists( $admin, 'getIDKEY')
&& (!(defined('MPFORM_SKIP_IDKEY')&&(MPFORM_SKIP_IDKEY))))
? $admin->getIDKEY($submission_id)
: $submission_id)
. '\');">'
. '<img src="'
. $sIconDir
. '/delete.png" alt="" width="16" height="16" border="0" />'
. $TEXT['DELETE']
. '</button>'
. '</td>'
. '<td align="right">'
. '<button class="mod_mpform_button" onclick="javascript: window.location = \''
. ADMIN_URL
. '/pages/modify.php?page_id='
. $page_id
. '\';">'
. $TEXT['BACK']
. '</button>'
. '</td></tr></table>';
// Print admin footer
$admin->print_footer();