Newer
Older
if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access Denied');
$info=array();
$qstr='';
if($email && $_REQUEST['a']!='add'){
$title='Update Email';
$action='update';
$submit_text='Save Changes';
$info=$email->getInfo();
$info['id']=$email->getId();
if($info['mail_delete'])
$info['postfetch']='delete';
elseif($info['mail_archivefolder'])
$info['postfetch']='archive';
else
$info['postfetch']=''; //nothing.
if($info['userpass'])
$passwdtxt='To change password enter new password above.';
$qstr.='&id='.$email->getId();
}else {
$title='Add New Email';
$action='create';
$submit_text='Submit';
$info['ispublic']=isset($info['ispublic'])?$info['ispublic']:1;
$info['ticket_auto_response']=isset($info['ticket_auto_response'])?$info['ticket_auto_response']:1;
$info['message_auto_response']=isset($info['message_auto_response'])?$info['message_auto_response']:1;
$qstr.='&a='.$_REQUEST['a'];
}
$info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
?>
<h2>Email Address</h2>
<form action="emails.php?<?php echo $qstr; ?>" method="post" id="save">
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
<input type="hidden" name="do" value="<?php echo $action; ?>">
<input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
<input type="hidden" name="id" value="<?php echo $info['id']; ?>">
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr>
<th colspan="2">
<h4><?php echo $title; ?></h4>
<em><strong>Email Information</strong>: Login details are optional BUT required when IMAP/POP or SMTP are enabled.</em>
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="180" class="required">
Email Address
</td>
<td>
<input type="text" size="35" name="email" value="<?php echo $info['email']; ?>">
<span class="error">* <?php echo $errors['email']; ?></span>
</td>
</tr>
<tr>
<td width="180" class="required">
Email Name
</td>
<td>
<input type="text" size="35" name="name" value="<?php echo $info['name']; ?>">
<span class="error">* <?php echo $errors['name']; ?> </span>
</td>
</tr>
<tr>
<td width="180">
Login Username
</td>
<td>
<input type="text" size="35" name="userid" value="<?php echo $info['userid']; ?>">
<span class="error"> <?php echo $errors['userid']; ?> </span>
</td>
</tr>
<tr>
<td width="180">
Login Password
</td>
<td>
<input type="password" size="35" name="passwd" value="<?php echo $info['passwd']; ?>">
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
<span class="error"> <?php echo $errors['passwd']; ?> </span>
<br><em><?php echo $passwdtxt; ?></em>
</td>
</tr>
<tr>
<th colspan="2">
<em><strong>Mail Account</strong>: Optional setting for fetching incoming emails. Mail fetching must be enabled with autocron active or external cron setup. <font class="error"> <?php echo $errors['mail']; ?></font></em>
</th>
</tr>
<tr><td>Status</td>
<td>
<label><input type="radio" name="mail_active" value="1" <?php echo $info['mail_active']?'checked="checked"':''; ?> /><strong>Enable</strong></label>
<label><input type="radio" name="mail_active" value="0" <?php echo !$info['mail_active']?'checked="checked"':''; ?> />Disable</label>
<font class="error"> <?php echo $errors['mail_active']; ?></font>
</td>
</tr>
<tr><td>Host</td>
<td><input type="text" name="mail_host" size=35 value="<?php echo $info['mail_host']; ?>">
<font class="error"> <?php echo $errors['mail_host']; ?></font>
</td>
</tr>
<tr><td>Port</td>
<td><input type="text" name="mail_port" size=6 value="<?php echo $info['mail_port']?$info['mail_port']:''; ?>">
<font class="error"> <?php echo $errors['mail_port']; ?></font>
</td>
</tr>
<tr><td>Protocol</td>
<td>
<select name="mail_protocol">
<option value='POP'>— Select Mail Protocol —</option>
<option value='POP' <?php echo ($info['mail_protocol']=='POP')?'selected="selected"':''; ?> >POP</option>
<option value='IMAP' <?php echo ($info['mail_protocol']=='IMAP')?'selected="selected"':''; ?> >IMAP</option>
</select>
<font class="error"> <?php echo $errors['mail_protocol']; ?></font>
</td>
</tr>
<tr><td>Encryption</td>
<td>
<select name="mail_encryption">
<option value='NONE'>None</option>
<option value='SSL' <?php echo ($info['mail_encryption']=='SSL')?'selected="selected"':''; ?> >SSL</option>
</select>
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<font class="error"> <?php echo $errors['mail_encryption']; ?></font>
</td>
</tr>
<tr><td>Fetch Frequency</td>
<td>
<input type="text" name="mail_fetchfreq" size=4 value="<?php echo $info['mail_fetchfreq']?$info['mail_fetchfreq']:''; ?>"> Delay intervals in minutes
<font class="error"> <?php echo $errors['mail_fetchfreq']; ?></font>
</td>
</tr>
<tr><td>Emails Per Fetch</td>
<td>
<input type="text" name="mail_fetchmax" size=4 value="<?php echo $info['mail_fetchmax']?$info['mail_fetchmax']:''; ?>"> Maximum emails to process per fetch.
<font class="error"> <?php echo $errors['mail_fetchmax']; ?></font>
</td>
</tr>
<tr>
<td width="180">
New Ticket Priority:
</td>
<td>
<select name="priority_id">
<option value="">— Select Priority —</option>
<?php
$sql='SELECT priority_id,priority_desc FROM '.PRIORITY_TABLE.' pri ORDER by priority_urgency DESC';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id,$name)=db_fetch_row($res)){
$selected=($info['priority_id'] && $id==$info['priority_id'])?'selected="selected"':'';
echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name);
}
}
?>
</select>
<span class="error"><?php echo $errors['priority_id']; ?></span>
</td>
</tr>
<tr>
<td width="180">
New Ticket Dept.
</td>
<td>
<select name="dept_id">
<option value="">— Select Department —</option>
<?php
$sql='SELECT dept_id,dept_name FROM '.DEPT_TABLE.' dept ORDER by dept_name';
if(($res=db_query($sql)) && db_num_rows($res)){
while(list($id,$name)=db_fetch_row($res)){
$selected=($info['dept_id'] && $id==$info['dept_id'])?'selected="selected"':'';
echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name);
}
}
?>
</select>
<span class="error"><?php echo $errors['dept_id']; ?></span>
</td>
</tr>
<tr>
<td width="180">
Auto-response
</td>
<td>
<input type="checkbox" name="noautoresp" value="1" <?php echo $info['noautoresp']?'checked="checked"':''; ?> >
<strong>Disable</strong> new ticket auto-response for this email. Overwrite global and dept. settings.
</td>
</tr>
<tr><td valign="top">Fetched Emails</td>
<td>
<input type="radio" name="postfetch" value="archive" <?php echo ($info['postfetch']=='archive')? 'checked="checked"': ''; ?> >
Move to: <input type="text" name="mail_archivefolder" size="20" value="<?php echo $info['mail_archivefolder']; ?>"/> folder.
<font class="error"> <?php echo $errors['mail_folder']; ?></font>
<input type="radio" name="postfetch" value="delete" <?php echo ($info['postfetch']=='delete')? 'checked="checked"': ''; ?> >
Delete fetched emails
<input type="radio" name="postfetch" value="" <?php echo (isset($info['postfetch']) && !$info['postfetch'])? 'checked="checked"': ''; ?> >
Do nothing (Not recommended)
<br><em>Moving fetched emails to a backup folder is highly recommended.</em> <font class="error"><?php echo $errors['postfetch']; ?></font>
</td>
</tr>
<tr>
<th colspan="2">
<em><strong>SMTP Settings</strong>: When enabled the <b>email account</b> will use SMTP server instead of internal PHP mail() function for outgoing emails. <font class="error"> <?php echo $errors['smtp']; ?></font></em>
</th>
</tr>
<tr><td>Status</td>
<td>
<label><input type="radio" name="smtp_active" value="1" <?php echo $info['smtp_active']?'checked':''; ?> />Enable</label>
<label><input type="radio" name="smtp_active" value="0" <?php echo !$info['smtp_active']?'checked':''; ?> />Disable</label>
<font class="error"> <?php echo $errors['smtp_active']; ?></font>
</td>
</tr>
<tr><td>SMTP Host</td>
<td><input type="text" name="smtp_host" size=35 value="<?php echo $info['smtp_host']; ?>">
<font class="error"> <?php echo $errors['smtp_host']; ?></font>
</td>
</tr>
<tr><td>SMTP Port</td>
<td><input type="text" name="smtp_port" size=6 value="<?php echo $info['smtp_port']?$info['smtp_port']:''; ?>">
<font class="error"> <?php echo $errors['smtp_port']; ?></font>
</td>
</tr>
<tr><td>Authentication Required?</td>
<td>
<label><input type="radio" name="smtp_auth" value="1"
<?php echo $info['smtp_auth']?'checked':''; ?> />Yes</label>
<label><input type="radio" name="smtp_auth" value="0"
<?php echo !$info['smtp_auth']?'checked':''; ?> />NO</label>
<font class="error"> <?php echo $errors['smtp_auth']; ?></font>
</td>
</tr>
<tr>
<td>Allow Header Spoofing?</td>
<td>
<input type="checkbox" name="smtp_spoofing" value="1" <?php echo $info['smtp_spoofing'] ?'checked="checked"':''; ?>>
Allow email header spoofing <em>(only applies to emails being sent through this account)</em>
</td>
</tr>
<tr>
<th colspan="2">
<em><strong>Internal Notes</strong>: Admin's notes. <span class="error"> <?php echo $errors['notes']; ?></span></em>
</th>
</tr>
<tr>
<td colspan=2>
<textarea name="notes" cols="21" rows="5" style="width: 60%;"><?php echo $info['notes']; ?></textarea>
</td>
</tr>
</tbody>
</table>
<p style="padding-left:225px;">
<input type="submit" name="submit" value="<?php echo $submit_text; ?>">
<input type="reset" name="reset" value="Reset">
<input type="button" name="cancel" value="Cancel" onclick='window.location.href="emails.php"'>
</p>
</form>