Project

General

Profile

1 2 Manuela
<?php
2
/**
3
 *
4
 * @category        module
5
 * @package         Form
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       WebsiteBaker Org. e.V.
8
 * @link            http://websitebaker.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.3.6 and higher
12
 * @version         $Id$
13
 * @filesource      $HeadURL$
14
 * @lastmodified    $Date$
15
 * @description
16
 */
17
18
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
19
//if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }
20
21
// Include WB admin wrapper script
22
require(WB_PATH.'/modules/admin.php');
23
// load module language file
24
$sAddonName = basename(__DIR__);
25
require(WB_PATH .'/modules/'.$sAddonName.'/languages/EN.php');
26
if(file_exists(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php')) {
27
    require(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php');
28
}
29
/* */
30
31
include_once (WB_PATH.'/framework/functions.php');
32
33
// Get page
34
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
35
$page = intval(isset(${$requestMethod}['page'])) ? ${$requestMethod}['page'] : 1;
36
37
// Get id
38
$submission_id = intval($admin->checkIDKEY('submission_id', false, 'GET'));
39
if (!$submission_id) {
40
 $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page='.$page.'&amp;page_id='.$page_id.'#submissions');
41
}
42
43
// Get submission details
44
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'mod_form_submissions` '
45
      . 'WHERE `submission_id` = '.$submission_id.' ';
46
if($query_content = $database->query($sql)) {
47
48
    $submission = $query_content->fetchRow(MYSQLI_ASSOC);
49
}
50
51
//print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />';
52
//print_r( $page ); print '</pre>';
53
54
// Get the user details of whoever did this submission
55
$sql  = 'SELECT `username`,`display_name`, `email` FROM `'.TABLE_PREFIX.'users` '
56
      . 'WHERE `user_id` = '.$submission['submitted_by'];
57
if($get_user = $database->query($sql)) {
58
    if($get_user->numRows() != 0) {
59
        $user = $get_user->fetchRow(MYSQLI_ASSOC);
60
    } else {
61
        $user['display_name'] = $TEXT['GUEST'];
62
        $user['username'] = $TEXT['UNKNOWN'];
63
        $user['email'] = $TEXT['UNKNOWN'];
64
    }
65
}
66
//$sSectionIdPrefix = ( defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' )  ? '#'.SEC_ANCHOR : 'Sec' );
67
$sSectionIdPrefix = 'submissions';
68
?>
69
<table class="frm-submission" >
70
    <tbody>
71
        <tr>
72
            <td><?php echo $TEXT['SUBMISSION_ID']; ?>:</td>
73
            <td><?php echo $submission['submission_id']; ?></td>
74
        </tr>
75
        <tr>
76
            <td><?php echo $TEXT['SUBMITTED']; ?>:</td>
77
            <td><?php echo gmdate(DATE_FORMAT .', '.TIME_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
78
        </tr>
79
        <tr>
80
            <td><?php echo $TEXT['USER'].' '; ?>:</td>
81
            <td><?php echo $user['display_name'].' '; ?></td>
82
        </tr>
83
        <tr>
84
            <td><?php echo $TEXT['EMAIL'].' '; ?>:</td>
85
            <td><?php echo $user['email'].' '; ?></td>
86
        </tr>
87
        <tr>
88
            <td colspan="2">
89
                <hr />
90
            </td>
91
        </tr>
92
        <tr>
93
            <td colspan="2">
94
                <?php echo nl2br($submission['body']); ?>
95
            </td>
96
        </tr>
97
    </tbody>
98
</table>
99
100
<br />
101
102
<input type="button" value="<?php echo $TEXT['CLOSE']; ?>" onclick="window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page=<?php echo $page?>&amp;page_id=<?php echo $page_id.'#'.$sSectionIdPrefix; ?>';" style="width: 150px; margin-top: 5px;" />
103
<input type="button" value="<?php echo $TEXT['DELETE']; ?>" onclick="confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $admin->getIDKEY($submission_id).'#'.$sSectionIdPrefix; ?>');" style="width: 150px; margin-top: 5px;" />
104
<?php
105
106
// Print admin footer
107
$admin->print_footer();