Project

General

Profile

1
<?php
2

    
3
// $Id: save_settings.php 227 2005-11-20 10:22:27Z ryan $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, Ryan Djurovich
9

    
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

    
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

    
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

    
24
*/
25

    
26
/*
27
The Website Baker Project would like to thank Rudolph Lartey <www.carbonect.com>
28
for his contributions to this module - adding extra field types
29
*/
30

    
31
require('../../config.php');
32

    
33
// Include WB admin wrapper script
34
$update_when_modified = true; // Tells script to update when this page was last updated
35
require(WB_PATH.'/modules/admin.php');
36

    
37
// This code removes any <?php tags and adds slashes
38
$friendly = array('&lt;', '&gt;', '?php');
39
$raw = array('<', '>', '');
40
$header = $admin->add_slashes($_POST['header']);
41
$field_loop = $admin->add_slashes($_POST['field_loop']);
42
$footer = $admin->add_slashes($_POST['footer']);
43
$email_to = $admin->add_slashes($_POST['email_to']);
44
$use_captcha = $_POST['use_captcha'];
45
if($_POST['email_from_field'] == '') {
46
	$email_from = $admin->add_slashes($_POST['email_from']);
47
} else {
48
	$email_from = $admin->add_slashes($_POST['email_from_field']);
49
}
50
$email_subject = $admin->add_slashes($_POST['email_subject']);
51
$success_message = $admin->add_slashes($_POST['success_message']);
52
if(!is_numeric($_POST['max_submissions'])) {
53
	$max_submissions = 50;
54
} else {
55
	$max_submissions = $_POST['max_submissions'];
56
}
57
if(!is_numeric($_POST['stored_submissions'])) {
58
	$stored_submissions = 100;
59
} else {
60
	$stored_submissions = $_POST['stored_submissions'];
61
}
62
// Make sure max submissions is not smaller than stored submissions
63
if($max_submissions < $stored_submissions) {
64
	$max_submissions = $stored_submissions;
65
}
66

    
67
// Update settings
68
$database->query("UPDATE ".TABLE_PREFIX."mod_form_settings SET header = '$header', field_loop = '$field_loop', footer = '$footer', email_to = '$email_to', email_from = '$email_from', email_subject = '$email_subject', success_message = '$success_message', max_submissions = '$max_submissions', stored_submissions = '$stored_submissions', use_captcha = '$use_captcha' WHERE section_id = '$section_id'");
69

    
70
// Check if there is a db error, otherwise say successful
71
if($database->is_error()) {
72
	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
73
} else {
74
	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
75
}
76

    
77
// Print admin footer
78
$admin->print_footer();
79

    
80
?>
(15-15/17)