forked from sitracker/sitracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact_new.php
More file actions
140 lines (117 loc) · 6.78 KB
/
contact_new.php
File metadata and controls
140 lines (117 loc) · 6.78 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
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
<?php
// contact_new.php - Adds a new contact
//
// SiT (Support Incident Tracker) - Support call tracking system
// Copyright (C) 2010-2014 The Support Incident Tracker Project
// Copyright (C) 2000-2009 Salford Software Ltd. and Contributors
//
// This software may be used and distributed according to the terms
// of the GNU General Public License, incorporated herein by reference.
//
// This Page Is Valid XHTML 1.0 Transitional! 31Oct05
require ('core.php');
$permission = PERM_CONTACT_ADD; // Add new contact
require (APPLICATION_LIBPATH . 'functions.inc.php');
// This page requires authentication
require (APPLICATION_LIBPATH . 'auth.inc.php');
// External variables
$siteid = clean_int($_REQUEST['siteid']);
$submit = cleanvar($_REQUEST['submit']);
$title = $strNewContact;
if (empty($submit) OR !empty($_SESSION['formerrors']['new_contact']))
{
include (APPLICATION_INCPATH . 'htmlheader.inc.php');
$returnpage = cleanvar($_REQUEST['return']);
if (!empty($_REQUEST['name']))
{
$name = explode(' ',cleanvar(urldecode($_REQUEST['name'])), 2);
$_SESSION['formdata']['new_contact']['forenames'] = ucfirst($name[0]);
$_SESSION['formdata']['new_contact']['surname'] = ucfirst($name[1]);
}
if (!empty($_REQUEST['email']))
{
$_SESSION['formdata']['new_contact']['email'] = clean_emailstring($_REQUEST['email']);
}
echo show_form_errors('new_contact');
clear_form_errors('new_contact');
echo "<h2>".icon('contact', 32)." {$strNewContact}</h2>";
plugin_do('contact_new');
echo "<h5 class='warning'>{$strAvoidDupes}</h5>";
echo "<form name='contactform' action='{$_SERVER['PHP_SELF']}' ";
echo "method='post' onsubmit=\"return confirm_action('{$strAreYouSureAdd}')\">";
echo "<table class='maintable vertical'>";
echo "<tr><th>{$strName}</th>\n";
echo "<td>";
echo "\n<table><tr><td align='center'>{$strTitle}<br />";
echo "<input maxlength='50' name='courtesytitle' title=\"";
echo "{$strCourtesyTitle}\" size='7' value='".show_form_value('new_contact', 'courtesytitle')."' /></td>\n";
echo "<td align='center'>{$strForenames}<br />";
echo "<input class='required' maxlength='100' name='forenames' ";
echo "size='15' title=\"{$strForenames}\" value='".show_form_value('new_contact', 'forenames')."' /></td>\n";
echo "<td align='center'>{$strSurname}<br />";
echo "<input class='required' maxlength='100' name='surname' ";
echo "size='20' title=\"{$strSurname}\" value='".show_form_value('new_contact', 'surname')."' /> <span class='required'>{$strRequired}</span></td></tr>\n";
echo "</table>\n</td></tr>\n";
if (!empty($_SESSION['formdata']['new_contact']['siteid'])) $siteid = $_SESSION['formdata']['new_contact']['siteid'];
echo "<tr><th>{$strJobTitle}</th><td><input maxlength='255'";
echo " name='jobtitle' size='35' title=\"{$strJobTitle}\" value='".show_form_value('new_contact', 'jobtitle')."' /></td></tr>\n";
echo "<tr><th>{$strSite}</th><td>";
echo site_drop_down('siteid', $siteid, TRUE)."<span class='required'>{$strRequired}</span></td></tr>\n";
echo "<tr><th>{$strDepartment}</th><td><input maxlength='255' name='department' size='35' value='".show_form_value('new_contact', 'department')."' /></td></tr>\n";
echo "<tr><th>{$strEmail}</th><td>";
echo "<input class='required' maxlength='100' name='email' size='35' value='".show_form_value('new_contact', 'email')."' /> <span class='required'>{$strRequired}</span> ";
echo "<label>";
echo html_checkbox('dataprotection_email', 'No');
echo "{$strEmail} {$strDataProtection}</label>".help_link("EmailDataProtection");
echo "</td></tr>\n";
echo "<tr><th>{$strTelephone}</th><td><input maxlength='50' name='phone' size='35' value='".show_form_value('new_contact', 'phone')."' /> ";
echo "<label>";
echo html_checkbox('dataprotection_phone', 'No');
echo "{$strTelephone} {$strDataProtection}</label>".help_link("TelephoneDataProtection");
echo "</td></tr>\n";
echo "<tr><th>{$strMobile}</th><td><input maxlength='100' name='mobile' size='35' value='".show_form_value('new_contact', 'mobile')."' /></td></tr>\n";
echo "<tr><th>{$strFax}</th><td><input maxlength='50' name='fax' size='35' value='".show_form_value('new_contact', 'fax')."' /></td></tr>\n";
echo "<tr><th>{$strAddress}</th><td><label>";
echo html_checkbox('dataprotection_address', 'No');
echo " {$strAddress} {$strDataProtection}</label>";
echo help_link("AddressDataProtection")."</td></tr>\n";
echo "<tr><th></th><td><label><input type='checkbox' name='usesiteaddress' value='yes' onclick=\"$('hidden').toggle();\" /> {$strSpecifyAddress}</label></td></tr>\n";
echo "<tbody id='hidden' style='display:none'>";
echo "<tr><th>{$strAddress1}</th>";
echo "<td><input maxlength='255' name='address1' size='35' value='".show_form_value('new_contact', 'address1')."' /></td></tr>\n";
echo "<tr><th>{$strAddress2}</th>";
echo "<td><input maxlength='255' name='address2' size='35' value='".show_form_value('new_contact', 'address2')."' /></td></tr>\n";
echo "<tr><th>{$strCity}</th><td><input maxlength='255' name='city' size='35' value='".show_form_value('new_contact', 'city')."' /></td></tr>\n";
echo "<tr><th>{$strCounty}</th><td><input maxlength='255' name='county' size='35' value='".show_form_value('new_contact', 'county')."' /></td></tr>\n";
echo "<tr><th>{$strCountry}</th><td>";
echo country_drop_down('country', $CONFIG['home_country'])."</td></tr>\n";
echo "<tr><th>{$strPostcode}</th><td><input maxlength='255' name='postcode' size='35' value='".show_form_value('new_contact', 'postcode')."' /></td></tr>\n";
echo "</tbody>";
echo "<tr><th>{$strNotes}</th><td><textarea cols='60' rows='5' name='notes'>";
if ($_SESSION['formdata']['new_contact']['notes'] != '')
{
echo $_SESSION['formdata']['new_contact']['notes'];
}
echo "</textarea></td></tr>\n";
echo "<tr><th>{$strEmailDetails}</th>";
// Check the box to send portal details, only if portal is enabled
echo "<td><input type='checkbox' id='emaildetails' name='emaildetails' value='on'";
if ($CONFIG['portal'] == TRUE) echo " checked='checked'";
else echo " disabled='disabled'";
echo " />";
echo "<label for='emaildetails'>{$strEmailContactLoginDetails}</label></td></tr>";
plugin_do('contact_new_form');
echo "</table>\n\n";
if (!empty($returnpage)) echo "<input type='hidden' name='return' value='{$returnpage}' />";
echo "<p class='formbuttons'><input name='reset' type='reset' value='{$strReset}' /> ";
echo "<input name='submit' type='submit' value=\"{$strSave}\" /></p>";
echo "</form>\n";
//cleanup form vars
clear_form_data('new_contact');
include (APPLICATION_INCPATH . 'htmlfooter.inc.php');
}
else
{
echo process_new_contact();
}
?>