-
Notifications
You must be signed in to change notification settings - Fork 2
/
contact_us.php
128 lines (97 loc) · 3.9 KB
/
contact_us.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
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);
if (isset($_GET['action']) && ($_GET['action'] == 'send') && isset($_POST['formid']) && ($_POST['formid'] == $sessiontoken)) {
$error = false;
$name = tep_db_prepare_input($_POST['name']);
$email_address = tep_db_prepare_input($_POST['email']);
$enquiry = tep_db_prepare_input($_POST['enquiry']);
if (!tep_validate_email($email_address)) {
$error = true;
$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
$actionRecorder = new actionRecorder('ar_contact_us', (isset($_SESSION['customer_id']) ? $customer_id : null), $name);
if (!$actionRecorder->canPerform()) {
$error = true;
$actionRecorder->record(false);
$messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15)));
}
if ($error == false) {
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
$actionRecorder->record();
tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
}
}
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
require(DIR_WS_INCLUDES . 'template_top.php');
?>
<div class="page-header">
<h1><?php echo HEADING_TITLE; ?></h1>
</div>
<?php
if ($messageStack->size('contact') > 0) {
echo $messageStack->output('contact');
}
if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
<div class="contentContainer">
<div class="contentText">
<div class="alert alert-info"><?php echo TEXT_SUCCESS; ?></div>
</div>
<div class="pull-right">
<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'glyphicon glyphicon-chevron-right', tep_href_link(FILENAME_DEFAULT)); ?>
</div>
</div>
<?php
} else {
?>
<?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', 'class="form-horizontal"', true); ?>
<div class="contentContainer">
<div class="contentText">
<p class="inputRequirement text-right"><?php echo FORM_REQUIRED_INFORMATION; ?></p>
<div class="clearfix"></div>
<div class="form-group has-feedback">
<label for="inputFromName" class="control-label col-xs-3"><?php echo ENTRY_NAME; ?></label>
<div class="col-xs-9">
<?php
echo tep_draw_input_field('name', NULL, 'required autofocus="autofocus" aria-required="true" id="inputFromName" placeholder="' . ENTRY_NAME . '"');
echo FORM_REQUIRED_INPUT;
?>
</div>
</div>
<div class="form-group has-feedback">
<label for="inputFromEmail" class="control-label col-xs-3"><?php echo ENTRY_EMAIL; ?></label>
<div class="col-xs-9">
<?php
echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="inputFromEmail" placeholder="' . ENTRY_EMAIL . '"');
echo FORM_REQUIRED_INPUT;
?>
</div>
</div>
<div class="form-group has-feedback">
<label for="inputEnquiry" class="control-label col-xs-3"><?php echo ENTRY_ENQUIRY; ?></label>
<div class="col-xs-9">
<?php
echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, NULL, 'required aria-required="true" id="inputEnquiry" placeholder="' . ENTRY_ENQUIRY . '"');
echo FORM_REQUIRED_INPUT;
?>
</div>
</div>
</div>
<div class="buttonSet">
<div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'glyphicon glyphicon-send', null, 'primary', null, 'btn-success'); ?></div>
</div>
</div>
</form>
<?php
}
require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>