1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_advanced_notifications.php
|
5
|
part of pfSense
|
6
|
Copyright (C) 2009 Scott Ullrich <sullrich@gmail.com>
|
7
|
|
8
|
Redistribution and use in source and binary forms, with or without
|
9
|
modification, are permitted provided that the following conditions are met:
|
10
|
|
11
|
1. Redistributions of source code must retain the above copyright notice,
|
12
|
this list of conditions and the following disclaimer.
|
13
|
|
14
|
2. Redistributions in binary form must reproduce the above copyright
|
15
|
notice, this list of conditions and the following disclaimer in the
|
16
|
documentation and/or other materials provided with the distribution.
|
17
|
|
18
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
POSSIBILITY OF SUCH DAMAGE.
|
28
|
*/
|
29
|
/*
|
30
|
pfSense_MODULE: system
|
31
|
*/
|
32
|
|
33
|
##|+PRIV
|
34
|
##|*IDENT=page-system-advanced-notifications
|
35
|
##|*NAME=System: Advanced: Tunables page
|
36
|
##|*DESCR=Allow access to the 'System: Advanced: Tunables' page.
|
37
|
##|*MATCH=system_advanced-sysctrl.php*
|
38
|
##|-PRIV
|
39
|
|
40
|
require("guiconfig.inc");
|
41
|
require("notices.inc");
|
42
|
|
43
|
// Growl
|
44
|
if($config['notifications']['growl']['password'])
|
45
|
$pconfig['password'] = $config['notifications']['growl']['password'];
|
46
|
if($config['notifications']['growl']['ipaddress'])
|
47
|
$pconfig['ipaddress'] = $config['notifications']['growl']['ipaddress'];
|
48
|
|
49
|
// SMTP
|
50
|
if($config['notifications']['smtp']['ipaddress'])
|
51
|
$pconfig['smtpipaddress'] = $config['notifications']['smtp']['ipaddress'];
|
52
|
if($config['notifications']['smtp']['notifyemailaddress'])
|
53
|
$pconfig['smtpnotifyemailaddress'] = $config['notifications']['smtp']['notifyemailaddress'];
|
54
|
|
55
|
if ($_POST) {
|
56
|
|
57
|
unset($input_errors);
|
58
|
$pconfig = $_POST;
|
59
|
|
60
|
/* if this is an AJAX caller then handle via JSON */
|
61
|
if (isAjax() && is_array($input_errors)) {
|
62
|
input_errors2Ajax($input_errors);
|
63
|
exit;
|
64
|
}
|
65
|
|
66
|
if ($_POST['apply']) {
|
67
|
$retval = 0;
|
68
|
system_setup_sysctl();
|
69
|
$savemsg = get_std_save_message($retval);
|
70
|
}
|
71
|
|
72
|
if ($_POST['Submit'] == "Save") {
|
73
|
$tunableent = array();
|
74
|
|
75
|
// Growl
|
76
|
$config['notifications']['growl']['ipaddress'] = $_POST['ipaddress'];
|
77
|
$config['notifications']['growl']['password'] = $_POST['password'];
|
78
|
|
79
|
// SMTP
|
80
|
$config['notifications']['smtp']['ipaddress'] = $_POST['smtpipaddress'];
|
81
|
$config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress'];
|
82
|
|
83
|
write_config();
|
84
|
|
85
|
// Send test message via growl
|
86
|
register_via_growl();
|
87
|
notify_via_growl("This is a test message form pfSense. It is safe to ignore this message.");
|
88
|
|
89
|
// Send test message via smtp
|
90
|
notify_via_smtp("This is a test message form pfSense. It is safe to ignore this message.");
|
91
|
|
92
|
pfSenseHeader("system_advanced_notifications.php");
|
93
|
exit;
|
94
|
}
|
95
|
}
|
96
|
|
97
|
include("head.inc");
|
98
|
|
99
|
$pgtitle = array("System","Advanced: Notifications");
|
100
|
include("head.inc");
|
101
|
|
102
|
?>
|
103
|
|
104
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
105
|
<?php include("fbegin.inc"); ?>
|
106
|
<form action="system_advanced_notifications.php" method="post">
|
107
|
<?php
|
108
|
if ($input_errors)
|
109
|
print_input_errors($input_errors);
|
110
|
if ($savemsg)
|
111
|
print_info_box($savemsg);
|
112
|
?>
|
113
|
</form>
|
114
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
115
|
<tr>
|
116
|
<td>
|
117
|
<?php
|
118
|
$tab_array = array();
|
119
|
$tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
|
120
|
$tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
|
121
|
$tab_array[] = array("Networking", false, "system_advanced_network.php");
|
122
|
$tab_array[] = array("Miscellaneous", false, "system_advanced_notifications.php");
|
123
|
$tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
|
124
|
$tab_array[] = array("Notifications", true, "system_advanced_notifications.php");
|
125
|
display_top_tabs($tab_array);
|
126
|
?>
|
127
|
</td>
|
128
|
</tr>
|
129
|
<tr>
|
130
|
<td id="mainarea">
|
131
|
<div class="tabcont">
|
132
|
<form action="system_advanced_notifications.php" method="post" name="iform">
|
133
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
134
|
<!-- GROWL -->
|
135
|
<tr>
|
136
|
<td colspan="2" valign="top" class="listtopic">Growl</td>
|
137
|
</tr>
|
138
|
<tr>
|
139
|
<td width="22%" valign="top" class="vncell">IP Address</td>
|
140
|
<td width="78%" class="vtable">
|
141
|
<input name='ipaddress' value='<?php echo $pconfig['ipaddress']; ?>'><br/>
|
142
|
This is the IP address that you would like to send growl notifications to.
|
143
|
</td>
|
144
|
</tr>
|
145
|
<tr>
|
146
|
<td width="22%" valign="top" class="vncell">Password</td>
|
147
|
<td width="78%" class="vtable">
|
148
|
<input name='password' type='password' value='<?php echo $pconfig['password']; ?>'><br/>
|
149
|
Enter the password of the remote growl notification device.
|
150
|
</td>
|
151
|
</tr>
|
152
|
<tr>
|
153
|
<td colspan="2" class="list" height="12"> </td>
|
154
|
</tr>
|
155
|
<!-- SMTP -->
|
156
|
<tr>
|
157
|
<td colspan="2" valign="top" class="listtopic">SMTP E-Mail</td>
|
158
|
</tr>
|
159
|
<tr>
|
160
|
<td width="22%" valign="top" class="vncell">IP Address of E-Mail server</td>
|
161
|
<td width="78%" class="vtable">
|
162
|
<input name='smtpipaddress' value='<?php echo $pconfig['smtpipaddress']; ?>'><br/>
|
163
|
This is the IP address of the SMTP E-Mail server that will be used to send notifications to.
|
164
|
</td>
|
165
|
</tr>
|
166
|
<tr>
|
167
|
<td width="22%" valign="top" class="vncell">Notification E-Mail address</td>
|
168
|
<td width="78%" class="vtable">
|
169
|
<input name='smtpnotifyemailaddress' type='input' value='<?php echo $pconfig['smtpnotifyemailaddress']; ?>'><br/>
|
170
|
Enter the e-mail address that you would like email notifications sent to.
|
171
|
</td>
|
172
|
</tr>
|
173
|
<tr>
|
174
|
<td valign="top" class="">
|
175
|
|
176
|
</td>
|
177
|
<td>
|
178
|
<br/>
|
179
|
<input type='submit' id='Submit' name='Submit' value='Save'></form>
|
180
|
</td>
|
181
|
</tr>
|
182
|
</table>
|
183
|
</div>
|
184
|
</td>
|
185
|
</tr>
|
186
|
</table>
|
187
|
<?php include("fend.inc"); ?>
|
188
|
</body>
|
189
|
</html>
|