1<?php
2    /*
3     * $Id: adminsystem.php 1439 2009-11-17 23:31:04Z dmorton $
4     *
5     * MAIA MAILGUARD LICENSE v.1.0
6     *
7     * Copyright 2004 by Robert LeBlanc <rjl@renaissoft.com>
8     *                   David Morton   <mortonda@dgrmm.net>
9     * All rights reserved.
10     *
11     * PREAMBLE
12     *
13     * This License is designed for users of Maia Mailguard
14     * ("the Software") who wish to support the Maia Mailguard project by
15     * leaving "Maia Mailguard" branding information in the HTML output
16     * of the pages generated by the Software, and providing links back
17     * to the Maia Mailguard home page.  Users who wish to remove this
18     * branding information should contact the copyright owner to obtain
19     * a Rebranding License.
20     *
21     * DEFINITION OF TERMS
22     *
23     * The "Software" refers to Maia Mailguard, including all of the
24     * associated PHP, Perl, and SQL scripts, documentation files, graphic
25     * icons and logo images.
26     *
27     * GRANT OF LICENSE
28     *
29     * Redistribution and use in source and binary forms, with or without
30     * modification, are permitted provided that the following conditions
31     * are met:
32     *
33     * 1. Redistributions of source code must retain the above copyright
34     *    notice, this list of conditions and the following disclaimer.
35     *
36     * 2. Redistributions in binary form must reproduce the above copyright
37     *    notice, this list of conditions and the following disclaimer in the
38     *    documentation and/or other materials provided with the distribution.
39     *
40     * 3. The end-user documentation included with the redistribution, if
41     *    any, must include the following acknowledgment:
42     *
43     *    "This product includes software developed by Robert LeBlanc
44     *    <rjl@renaissoft.com>."
45     *
46     *    Alternately, this acknowledgment may appear in the software itself,
47     *    if and wherever such third-party acknowledgments normally appear.
48     *
49     * 4. At least one of the following branding conventions must be used:
50     *
51     *    a. The Maia Mailguard logo appears in the page-top banner of
52     *       all HTML output pages in an unmodified form, and links
53     *       directly to the Maia Mailguard home page; or
54     *
55     *    b. The "Powered by Maia Mailguard" graphic appears in the HTML
56     *       output of all gateway pages that lead to this software,
57     *       linking directly to the Maia Mailguard home page; or
58     *
59     *    c. A separate Rebranding License is obtained from the copyright
60     *       owner, exempting the Licensee from 4(a) and 4(b), subject to
61     *       the additional conditions laid out in that license document.
62     *
63     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
64     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
65     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
66     * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
67     * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
68     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
69     * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
70     * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
71     * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
72     * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
73     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74     *
75     */
76
77    require_once ("core.php");
78    require_once ("maia_db.php");
79    require_once ("authcheck.php");
80    require_once ("display.php");
81    $display_language = get_display_language($euid);
82    require_once ("./locale/$display_language/db.php");
83    require_once ("./locale/$display_language/display.php");
84    require_once ("./locale/$display_language/adminsystem.php");
85
86    require_once ("smarty.php");
87    $smarty->assign("auth_method", $auth_method);
88
89    // Only the superadministrator should be here.
90    if (!is_superadmin($uid)) {
91       header("Location: index.php" . $sid);
92       exit();
93    }
94
95    // Cancel any impersonations currently in effect
96    // by resetting EUID = UID and forcing a reload
97    // of this page.
98    if ($uid != $euid) {
99       $euid = $uid;
100       $_SESSION["euid"] = $uid;
101       header("Location: adminsystem.php" . $sid);
102       exit();
103    }
104
105    $select = "SELECT enable_user_autocreation, " .
106                     "enable_false_negative_management, " .
107                     "enable_stats_tracking, " .
108                     "enable_virus_scanning, " .
109                     "enable_spam_filtering, " .
110                     "enable_banned_files_checking, " .
111                     "enable_bad_header_checking, " .
112                     "enable_charts, " .
113                     "enable_spamtraps, " .
114                     "enable_stats_reporting, " .
115                     "enable_address_linking, " .
116                     "enable_privacy_invasion, " .
117                     "enable_username_changes, " .
118                     "internal_auth, " .
119                     "system_default_user_is_local, " .
120                     "user_virus_scanning, " .
121                     "user_spam_filtering, " .
122                     "user_banned_files_checking, " .
123                     "user_bad_header_checking, " .
124                     "size_limit, " .
125                     "oversize_policy, " .
126                     "key_file, " .
127                     "admin_email, " .
128                     "expiry_period, " .
129                     "ham_cache_expiry_period, " .
130                     "reminder_threshold_count, " .
131                     "reminder_threshold_size, " .
132                     "reminder_template_file, " .
133                     "reminder_login_url, " .
134                     "smtp_server, " .
135                     "smtp_port, " .
136                     "newuser_template_file, " .
137                     "currency_label, " .
138                     "bandwidth_cost, " .
139                     "chart_ham_colour, " .
140                     "chart_spam_colour, " .
141                     "chart_virus_colour, " .
142                     "chart_fp_colour, " .
143                     "chart_fn_colour, " .
144                     "chart_suspected_ham_colour, " .
145                     "chart_suspected_spam_colour, " .
146                     "chart_wl_colour, " .
147                     "chart_bl_colour, " .
148                     "chart_background_colour, " .
149                     "chart_font_colour, " .
150//                     "chart_autogeneration_interval, " .
151                     "banner_title, " .
152                     "use_icons, " .
153                     "use_logo, " .
154                     "logo_url, " .
155                     "logo_file, " .
156                     "logo_alt_text, " .
157                     "virus_info_url, " .
158                     "virus_lookup, " .
159                     "primary_report_server, " .
160                     "primary_report_port, " .
161                     "secondary_report_server, " .
162                     "secondary_report_port, " .
163                     "reporter_sitename, " .
164                     "reporter_username, " .
165                     "reporter_password " .
166              "FROM maia_config WHERE id = 0";
167    $sth = $dbh->query($select);
168    if ($row = $sth->fetchrow()) {
169        $smarty->assign('enable_user_autocreation', ($row["enable_user_autocreation"] == 'Y'));
170        $smarty->assign('enable_false_negative_management', ($row["enable_false_negative_management"] == 'Y'));
171        $smarty->assign('enable_stats_tracking', ($row["enable_stats_tracking"] == 'Y'));
172        $smarty->assign('enable_virus_scanning', ($row["enable_virus_scanning"] == 'Y'));
173        $smarty->assign('enable_spam_filtering', ($row["enable_spam_filtering"] == 'Y'));
174        $smarty->assign('enable_banned_files_checking', ($row["enable_banned_files_checking"] == 'Y'));
175        $smarty->assign('enable_bad_header_checking', ($row["enable_bad_header_checking"] == 'Y'));
176        $smarty->assign('enable_charts', ($row["enable_charts"] == 'Y'));
177        $smarty->assign('enable_spamtraps', ($row["enable_spamtraps"] == 'Y'));
178        $smarty->assign('enable_stats_reporting', ($row["enable_stats_reporting"] == 'Y'));
179        $smarty->assign('enable_address_linking', ($row["enable_address_linking"] == 'Y'));
180  	$smarty->assign('enable_privacy_invasion', ($row["enable_privacy_invasion"] == 'Y'));
181  	$smarty->assign('enable_username_changes', ($row["enable_username_changes"] == 'Y'));
182        $smarty->assign('internal_auth', ($row["internal_auth"] == 'Y'));
183        $smarty->assign('system_default_user_is_local', ($row["system_default_user_is_local"] == 'Y'));
184        $smarty->assign('user_virus_scanning', ($row["user_virus_scanning"] == 'Y'));
185        $smarty->assign('user_spam_filtering', ($row["user_spam_filtering"] == 'Y'));
186        $smarty->assign('user_banned_files_checking', ($row["user_banned_files_checking"] == 'Y'));
187        $smarty->assign('user_bad_header_checking', ($row["user_bad_header_checking"] == 'Y'));
188        $smarty->assign('size_limit', $row["size_limit"]);
189        $smarty->assign('key_file',  $row["key_file"]);
190        $smarty->assign('oversize_policy', $row["oversize_policy"]);
191        $smarty->assign('admin_email', $row["admin_email"]);
192        $smarty->assign('expiry_period', $row["expiry_period"]);
193        $smarty->assign('ham_cache_expiry_period', $row["ham_cache_expiry_period"]);
194        $smarty->assign('reminder_threshold_count', $row["reminder_threshold_count"]);
195        $smarty->assign('reminder_threshold_size', $row["reminder_threshold_size"]);
196        $smarty->assign('reminder_template_file', $row["reminder_template_file"]);
197        $smarty->assign('reminder_login_url', $row["reminder_login_url"]);
198        $smarty->assign('smtp_server', strtolower($row["smtp_server"]));
199        $smarty->assign('smtp_port', $row["smtp_port"]);
200        $smarty->assign('newuser_template_file', $row["newuser_template_file"]);
201        $smarty->assign('currency_label', $row["currency_label"]);
202        $smarty->assign('bandwidth_cost', $row["bandwidth_cost"]);
203        $smarty->assign('chart_ham_colour', $row["chart_ham_colour"]);
204        $smarty->assign('chart_spam_colour', $row["chart_spam_colour"]);
205        $smarty->assign('chart_virus_colour', $row["chart_virus_colour"]);
206        $smarty->assign('chart_fp_colour', $row["chart_fp_colour"]);
207        $smarty->assign('chart_fn_colour', $row["chart_fn_colour"]);
208        $smarty->assign('chart_suspected_ham_colour', $row["chart_suspected_ham_colour"]);
209        $smarty->assign('chart_suspected_spam_colour', $row["chart_suspected_spam_colour"]);
210        $smarty->assign('chart_wl_colour', $row["chart_wl_colour"]);
211        $smarty->assign('chart_bl_colour', $row["chart_bl_colour"]);
212        $smarty->assign('chart_background_colour', $row["chart_background_colour"]);
213        $smarty->assign('chart_font_colour', $row["chart_font_colour"]);
214//        $smarty->assign('chart_autogeneration_interval', $row["chart_autogeneration_interval"]);
215        $smarty->assign('banner_title', $row["banner_title"]);
216        $smarty->assign('use_icons', ($row["use_icons"] == 'Y'));
217        $smarty->assign('use_logo', ($row["use_logo"] == 'Y'));
218        $smarty->assign('logo_url', $row["logo_url"]);
219        $smarty->assign('logo_file', $row["logo_file"]);
220        $smarty->assign('logo_alt_text', $row["logo_alt_text"]);
221        $smarty->assign('virus_info_url', $row["virus_info_url"]);
222        $smarty->assign('virus_lookup', $row["virus_lookup"]);
223        $smarty->assign('primary_report_server', strtolower($row["primary_report_server"]));
224        $smarty->assign('primary_report_port', $row["primary_report_port"]);
225        $smarty->assign('secondary_report_server', strtolower($row["secondary_report_server"]));
226        $smarty->assign('secondary_report_port', $row["secondary_report_port"]);
227        $smarty->assign('reporter_sitename', $row["reporter_sitename"]);
228        $smarty->assign('reporter_username', strtolower($row["reporter_username"]));
229        $smarty->assign('reporter_password', $row["reporter_password"]);
230    }
231    $sth->free();
232
233    $smarty->display('adminsystem.tpl');
234
235?>
236