Project

General

Profile

1 2 Manuela
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.3.6 and higher
12
 * @version         $Id$
13
 * @filesource      $HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17
18
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
19
// Include WB admin wrapper script
20
$update_when_modified = true; // Tells script to update when this page was last updated
21
$admin_header = false;
22
require(WB_PATH.'/modules/admin.php');
23
if (!$admin->checkFTAN())
24
{
25
    $admin->print_header();
26
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
27
}
28
$admin->print_header();
29
30
// This code removes any <?php tags and adds slashes
31
$friendly = array('&lt;', '&gt;', '?php');
32
$raw = array('<', '>', '');
33
$header = $admin->StripCodeFromText( $_POST['header'] );
34
$post_loop = $admin->StripCodeFromText( $_POST['post_loop']);
35
$footer = $admin->StripCodeFromText( $_POST['footer']);
36
$post_header = $admin->StripCodeFromText( $_POST['post_header']);
37
$post_footer = $admin->StripCodeFromText( $_POST['post_footer']);
38
$comments_header = $admin->StripCodeFromText( $_POST['comments_header']);
39
$comments_loop = $admin->StripCodeFromText( $_POST['comments_loop']);
40
$comments_footer = $admin->StripCodeFromText( $_POST['comments_footer']);
41
$comments_page = $admin->StripCodeFromText( $_POST['comments_page']);
42
$commenting = $_POST['commenting'];
43
$posts_per_page = intval($_POST['posts_per_page']);
44
$use_captcha = intval($_POST['use_captcha']);
45
if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) {
46
    $resize = $_POST['resize'];
47
} else {
48
    $resize = '';
49
}
50
$sql  = 'UPDATE '.TABLE_PREFIX.'mod_news_settings SET '
51
      . '`header`=\''.$database->escapeString($header).'\', '
52
      . '`post_loop`=\''.$database->escapeString($post_loop).'\', '
53
      . '`footer`=\''.$database->escapeString($footer).'\', '
54
      . '`posts_per_page`=\''.$database->escapeString($posts_per_page).'\', '
55
      . '`post_header`=\''.$database->escapeString($post_header).'\', '
56
      . '`post_footer`=\''.$database->escapeString($post_footer).'\', '
57
      . '`comments_header`=\''.$database->escapeString($comments_header).'\', '
58
      . '`comments_loop`=\''.$database->escapeString($comments_loop).'\', '
59
      . '`comments_footer`=\''.$database->escapeString($comments_footer).'\', '
60
      . '`comments_page`=\''.$database->escapeString($comments_page).'\', '
61
      . '`commenting`=\''.$database->escapeString($commenting).'\', '
62
      . '`resize`=\''.$database->escapeString($resize).'\', '
63
      . '`use_captcha`=\''.$database->escapeString($use_captcha).'\' '
64
      . 'WHERE `section_id`='.$database->escapeString($section_id).' '
65
      . '';
66
// Update settings
67
$database->query($sql);
68
69
70
// Check if there is a db error, otherwise say successful
71
if($database->is_error()) {
72
    $admin->print_error($database->get_error(), ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
73
} else {
74
    $admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
75
}
76
77
// Print admin footer
78
$admin->print_footer();