This repository was archived by the owner on Jun 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave_settings.php
More file actions
87 lines (77 loc) · 3.57 KB
/
save_settings.php
File metadata and controls
87 lines (77 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* @module form
* @version see info.php of this module
* @authors Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke, LEPTON project
* @copyright 2004-2010 Ryan Djurovich, Rudolph Lartey, John Maats, Dietrich Roland Pehlke
* @copyright 2010-2014 LEPTON project
* @license see info.php of this module
* @license terms see info.php of this module
*/
// include class.secure.php to protect this file and the whole CMS!
if (defined('LEPTON_PATH')) {
include(LEPTON_PATH.'/framework/class.secure.php');
} else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
} else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
// end include class.secure.php
// Include admin wrapper script
$update_when_modified = true; // Tells script to update when this page was last updated
require(LEPTON_PATH.'/modules/admin.php');
// This code removes any <?php tags and adds slashes
$friendly = array('<', '>', '?php');
$raw = array('<', '>', '');
$header = addslashes($_POST['header']);
$field_loop = addslashes($_POST['field_loop']);
$footer = addslashes($_POST['footer']);
$email_to = addslashes($_POST['email_to']);
$use_captcha = addslashes($_POST['use_captcha']);
if($_POST['email_from_field'] == '') {
$email_from = addslashes($_POST['email_from']);
} else {
$email_from = addslashes($_POST['email_from_field']);
}
$email_fromname = addslashes($_POST['email_fromname']);
$email_subject = addslashes($_POST['email_subject']);
$success_page = addslashes($_POST['success_page']);
$success_email_to = addslashes($_POST['success_email_to']);
$success_email_from = addslashes($_POST['success_email_from']);
$success_email_fromname = addslashes($_POST['success_email_fromname']);
$success_email_text = addslashes($_POST['success_email_text']);
$success_email_subject = addslashes($_POST['success_email_subject']);
if(!is_numeric($_POST['max_submissions'])) {
$max_submissions = 50;
} else {
$max_submissions = $_POST['max_submissions'];
}
if(!is_numeric($_POST['stored_submissions'])) {
$stored_submissions = 1000;
} else {
$stored_submissions = $_POST['stored_submissions'];
}
// Make sure max submissions is not greater than stored submissions if stored_submissions <>0
if($max_submissions > $stored_submissions) {
$max_submissions = $stored_submissions;
}
// Update settings
$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'");
// Check if there is a db error, otherwise say successful
if($database->is_error()) {
$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
} else {
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
}
// Print admin footer
$admin->print_footer();
?>