Project

General

Profile

1
<?php
2

    
3
// $Id: save_settings.php 915 2009-01-21 19:27:01Z Ruebenwurzel $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, 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 = $admin->add_slashes($_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_fromname = $admin->add_slashes($_POST['email_fromname']);
51
$email_subject = $admin->add_slashes($_POST['email_subject']);
52
$success_page = $admin->add_slashes($_POST['success_page']);
53
$success_email_to = $admin->add_slashes($_POST['success_email_to']);
54
$success_email_from = $admin->add_slashes($_POST['success_email_from']);
55
$success_email_fromname = $admin->add_slashes($_POST['success_email_fromname']);
56
$success_email_text = $admin->add_slashes($_POST['success_email_text']);
57
$success_email_subject = $admin->add_slashes($_POST['success_email_subject']);
58
if(!is_numeric($_POST['max_submissions'])) {
59
	$max_submissions = 50;
60
} else {
61
	$max_submissions = $_POST['max_submissions'];
62
}
63
if(!is_numeric($_POST['stored_submissions'])) {
64
	$stored_submissions = 100;
65
} else {
66
	$stored_submissions = $_POST['stored_submissions'];
67
}
68
// Make sure max submissions is not greater than stored submissions if stored_submissions <>0
69
if($max_submissions > $stored_submissions) {
70
	$max_submissions = $stored_submissions;
71
}
72

    
73
// Update settings
74
$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_fromname = '$email_fromname', email_subject = '$email_subject', success_page = '$success_page', success_email_to = '$success_email_to', success_email_from = '$success_email_from', success_email_fromname = '$success_email_fromname', success_email_text = '$success_email_text', success_email_subject = '$success_email_subject', max_submissions = '$max_submissions', stored_submissions = '$stored_submissions', use_captcha = '$use_captcha' WHERE section_id = '$section_id'");
75

    
76
// Check if there is a db error, otherwise say successful
77
if($database->is_error()) {
78
	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
79
} else {
80
	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
81
}
82

    
83
// Print admin footer
84
$admin->print_footer();
85

    
86
?>
(17-17/21)