Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
commit | author | age
92bc67 1 <?php
T 2 /*
3 Copyright (c) 2007, Till Brehm, projektfarm Gmbh
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
8
9     * Redistributions of source code must retain the above copyright notice,
10       this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright notice,
12       this list of conditions and the following disclaimer in the documentation
13       and/or other materials provided with the distribution.
14     * Neither the name of ISPConfig nor the names of its contributors
15       may be used to endorse or promote products derived from this software without
16       specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30
31 /******************************************
32 * Begin Form configuration
33 ******************************************/
34
35 $tform_def_file = "form/spamfilter_config.tform.php";
36
37 /******************************************
38 * End Form configuration
39 ******************************************/
40
7fe908 41 require_once '../../lib/config.inc.php';
MC 42 require_once '../../lib/app.inc.php';
92bc67 43
910093 44 //* Check permissions for module
T 45 $app->auth->check_module_permissions('mail');
92bc67 46
T 47 // Loading classes
48 $app->uses('tpl,tform,tform_actions');
49 $app->load('tform_actions');
50
51 class page_action extends tform_actions {
7fe908 52
92bc67 53     function onShowEdit() {
T 54         global $app, $conf;
7fe908 55
92bc67 56         if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
7fe908 57
92bc67 58         if($app->tform->errorMessage == '') {
T 59             $app->uses('ini_parser,getconf');
7fe908 60
92bc67 61             $section = $this->active_tab;
T 62             $server_id = $this->id;
7fe908 63
MC 64             $this->dataRecord = $app->getconf->get_server_config($server_id, $section);
92bc67 65         }
7fe908 66
MC 67         $record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
68
92bc67 69         $record['id'] = $this->id;
T 70         $app->tpl->setVar($record);
71     }
7fe908 72
92bc67 73     function onUpdateSave($sql) {
T 74         global $app;
7fe908 75
92bc67 76         if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
T 77         $app->uses('ini_parser,getconf');
7fe908 78
92bc67 79         $section = $app->tform->getCurrentTab();
T 80         $server_id = $this->id;
7fe908 81
92bc67 82         $server_config_array = $app->getconf->get_server_config($server_id);
7fe908 83         $server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
92bc67 84         $server_config_str = $app->ini_parser->get_ini_string($server_config_array);
7fe908 85
2af58c 86         $sql = "UPDATE server SET config = ? WHERE server_id = ?";
MC 87         $app->db->query($sql, $server_config_str, $server_id);
92bc67 88     }
7fe908 89
92bc67 90 }
T 91
92 $app->tform_actions = new page_action;
93 $app->tform_actions->onLoad();
94
95
7fe908 96 ?>