Revision 298
Added by stefan over 18 years ago
save_settings.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 | 3 |
// $Id$ |
4 |
|
|
4 |
|
|
5 | 5 |
/* |
6 | 6 |
|
7 | 7 |
Website Baker Project <http://www.websitebaker.org/> |
... | ... | |
27 | 27 |
The Website Baker Project would like to thank Rudolph Lartey <www.carbonect.com> |
28 | 28 |
for his contributions to this module - adding extra field types |
29 | 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('<', '>', '?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']);
|
|
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('<', '>', '?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 | 43 |
$email_to = $admin->add_slashes($_POST['email_to']); |
44 | 44 |
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { |
45 | 45 |
$use_captcha = $_POST['use_captcha']; |
46 | 46 |
} else { |
47 | 47 |
$use_captcha = false; |
48 | 48 |
} |
49 |
if($_POST['email_from_field'] == '') {
|
|
49 |
if($_POST['email_from_field'] == '') { |
|
50 | 50 |
$email_from = $admin->add_slashes($_POST['email_from']); |
51 | 51 |
} else { |
52 | 52 |
$email_from = $admin->add_slashes($_POST['email_from_field']); |
53 |
}
|
|
54 |
$email_subject = $admin->add_slashes($_POST['email_subject']);
|
|
53 |
} |
|
54 |
$email_subject = $admin->add_slashes($_POST['email_subject']); |
|
55 | 55 |
$success_message = $admin->add_slashes($_POST['success_message']); |
56 | 56 |
if(!is_numeric($_POST['max_submissions'])) { |
57 | 57 |
$max_submissions = 50; |
... | ... | |
63 | 63 |
} else { |
64 | 64 |
$stored_submissions = $_POST['stored_submissions']; |
65 | 65 |
} |
66 |
// Make sure max submissions is not smaller than stored submissions
|
|
67 |
if($max_submissions < $stored_submissions) {
|
|
66 |
// Make sure max submissions is not greater than stored submissions
|
|
67 |
if($max_submissions > $stored_submissions) {
|
|
68 | 68 |
$max_submissions = $stored_submissions; |
69 | 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 |
|
|
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 | 84 |
?> |
Also available in: Unified diff
/modules/form/save_settings.php
/modules/form/view.php