Project

General

Profile

1
<?php
2

    
3
// $Id: save_settings.php 298 2006-02-03 21:43:09Z stefan $
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
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) {
45
	$use_captcha = $_POST['use_captcha'];
46
} else {
47
	$use_captcha = false;
48
}
49
if($_POST['email_from_field'] == '') {
50
	$email_from = $admin->add_slashes($_POST['email_from']);
51
} else {
52
	$email_from = $admin->add_slashes($_POST['email_from_field']);
53
}
54
$email_subject = $admin->add_slashes($_POST['email_subject']);
55
$success_message = $admin->add_slashes($_POST['success_message']);
56
if(!is_numeric($_POST['max_submissions'])) {
57
	$max_submissions = 50;
58
} else {
59
	$max_submissions = $_POST['max_submissions'];
60
}
61
if(!is_numeric($_POST['stored_submissions'])) {
62
	$stored_submissions = 100;
63
} else {
64
	$stored_submissions = $_POST['stored_submissions'];
65
}
66
// Make sure max submissions is not greater than stored submissions
67
if($max_submissions > $stored_submissions) {
68
	$max_submissions = $stored_submissions;
69
}
70

    
71
// Update settings
72
$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'");
73

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

    
81
// Print admin footer
82
$admin->print_footer();
83

    
84
?>
(15-15/17)