/
email-settings.php
executable file
·145 lines (123 loc) · 3.29 KB
/
email-settings.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
<?
#This program is copyright by Andre Coetzee email: ac@main.me
#and is licensed under the GPL v3
#
#
#
#
#Please add yourself to: http://www.accounting-123.com
#Developers, Software Vendors, Support, Accountants, Users
#
#
#The full software license can be found here:
#http://www.accounting-123.com/a.php?a=153/GPLv3
#
#
#
#
#
#
#
#
#
#
#
require ("settings.php");
$OUTPUT = settings();
require("template.php");
function settings() {
extract($_POST);
db_conn('cubit');
$err="";
$save=false;
if(isset($from)) {
$save=true;
require_lib("validate");
$v = new validate();
$v->isOk($sig, "string", 0, 255, "Invalid signature.");
$v->isOk($from, "email", 1, 255, "Invalid from e-mail address.");
$v->isOk($reply, "email", 0, 255, "Invalid reply e-mail address.");
$v->isOk($host, "string", 1, 255, "Invalid smtp server. You need to fill in the SMTP HOST field, you can get this from your ISP.<br>
Examples: smtp.saix.net OR smtp.mweb.co.za");
if ($v->isError()) {
$err = $v->genErrors();
} else {
$sig=remval($sig);
$from=remval($from);
$reply=remval($reply);
$host=remval($host);
$Sl="SELECT * FROM esettings";
$Ri=db_exec($Sl);
if(pg_num_rows($Ri)<1) {
$Sl="INSERT INTO esettings(sig,fromname,reply,smtp_host,smtp_auth,smtp_user,smtp_pass) VALUES
('$sig','$from','$reply','$host','0','','')";
$Ri=db_exec($Sl);
} else {
$Sl="UPDATE esettings SET sig='$sig',fromname='$from',reply='$reply',smtp_host='$host'";
$Ri=db_exec($Sl);
}
r2sListRestore("emailsettings");
}
}
$Sl="SELECT * FROM esettings";
$Ri=db_exec($Sl);
$sd=pg_fetch_array($Ri);
if(!$save) {
$ex="<li class=err>Please set your email settings & then click 'Update'</li>";
} else {
$ex="<li class=err>Email settings saved</li>";
}
if(pg_num_rows($Ri)<1) {
$sd['sig'] = "";
$sd['fromname'] = "";
$sd['reply'] = "";
$sd['smtp_host']="smtp.saix.net";
$exx="<li class=err>These are default settings. If these settings do not work, contact your ISP for correct details.</li>";
} else {
$exx="";
}
$sd = array_merge($sd, $_POST);
if (!isset ($retdata))
$retdata = "";
$out = "<h3>Email Settings</h3>
$exx
$ex
<br />
$err
<table ".TMPL_tblDflts.">
<form action='".SELF."' method=post>
$retdata
<tr>
<th colspan='2'>Settings</th>
</tr>
<tr class='".bg_class()."'>
<td align='center' colspan='2'><b>An asterisk (".REQ.") symbol marks required fields.</b></td>
</tr>
<tr class='".bg_class()."'>
<td>Signature</td>
<td><input type='text' size='25' name='sig' value='$sd[sig]'></td>
</tr>
<tr class='".bg_class()."'>
<td>".REQ." From E-mail Address</td>
<td><input type='text' size='25' name='from' value='$sd[fromname]'></td>
</tr>
<tr class='".bg_class()."'>
<td>Reply To E-mail Address</td>
<td><input type='text' size='25' name='reply' value='$sd[reply]'></td>
</tr>
<tr class='".bg_class()."'>
<td>".REQ." SMTP Server</td>
<td><input type='text' size='25' name='host' value='$sd[smtp_host]'></td>
</tr>
<tr>
<td colspan=2 align=right><input type=submit value='Update »'></td>
</tr>
</form>
</table>
<p>
<table boder=0 cellpadding='".TMPL_tblCellPadding."' cellspacing='".TMPL_tblCellSpacing."'>
<tr><th>Quick Links</th></tr>
<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>
</table>";
return $out;
}