| 1 | <?php
 | 
  
    | 2 | 
 | 
  
    | 3 | // $Id: save_settings.php 40 2005-09-07 19:22:34Z 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('<', '>', '?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($_POST['email_from_field'] == '') {
 | 
  
    | 45 | 	$email_from = $admin->add_slashes($_POST['email_from']);
 | 
  
    | 46 | } else {
 | 
  
    | 47 | 	$email_from = $admin->add_slashes($_POST['email_from_field']);
 | 
  
    | 48 | }
 | 
  
    | 49 | $email_subject = $admin->add_slashes($_POST['email_subject']);
 | 
  
    | 50 | $success_message = $admin->add_slashes($_POST['success_message']);
 | 
  
    | 51 | if(!is_numeric($_POST['max_submissions'])) {
 | 
  
    | 52 | 	$max_submissions = 50;
 | 
  
    | 53 | } else {
 | 
  
    | 54 | 	$max_submissions = $_POST['max_submissions'];
 | 
  
    | 55 | }
 | 
  
    | 56 | if(!is_numeric($_POST['stored_submissions'])) {
 | 
  
    | 57 | 	$stored_submissions = 100;
 | 
  
    | 58 | } else {
 | 
  
    | 59 | 	$stored_submissions = $_POST['stored_submissions'];
 | 
  
    | 60 | }
 | 
  
    | 61 | // Make sure max submissions is not smaller than stored submissions
 | 
  
    | 62 | if($max_submissions < $stored_submissions) {
 | 
  
    | 63 | 	$max_submissions = $stored_submissions;
 | 
  
    | 64 | }
 | 
  
    | 65 | 
 | 
  
    | 66 | // Update settings
 | 
  
    | 67 | $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' WHERE section_id = '$section_id'");
 | 
  
    | 68 | 
 | 
  
    | 69 | // Check if there is a db error, otherwise say successful
 | 
  
    | 70 | if($database->is_error()) {
 | 
  
    | 71 | 	$admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
 | 
  
    | 72 | } else {
 | 
  
    | 73 | 	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
 | 
  
    | 74 | }
 | 
  
    | 75 | 
 | 
  
    | 76 | // Print admin footer
 | 
  
    | 77 | $admin->print_footer();
 | 
  
    | 78 | 
 | 
  
    | 79 | ?>
 |