Project

General

Profile

1
<?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.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: save_comment.php 1538 2011-12-10 15:06:15Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/news/save_comment.php $
14
 * @lastmodified    $Date: 2011-12-10 16:06:15 +0100 (Sat, 10 Dec 2011) $
15
 *
16
 */
17

    
18
require('../../config.php');
19

    
20
// Get id
21
if(!isset($_POST['comment_id']) OR !is_numeric($_POST['comment_id']) OR !isset($_POST['post_id']) OR !is_numeric($_POST['post_id']))
22
{
23
	header("Location: ".ADMIN_URL."/pages/index.php");
24
	exit( 0 );
25
}
26
else
27
{
28
	$comment_id = (int)$_POST['comment_id'];
29
}
30

    
31
$admin_header = false;
32
// Tells script to update when this page was last updated
33
$update_when_modified = true;
34
// show the info banner
35
// $print_info_banner = true;
36
// Include WB admin wrapper script
37
require(WB_PATH.'/modules/admin.php');
38

    
39
if (!$admin->checkFTAN())
40
{
41
	$admin->print_header();
42
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
43
}
44

    
45
$id = intval($admin->getIDKEY($comment_id));
46

    
47
// Validate all fields
48
if($admin->get_post('title') == '' AND $admin->get_post('comment') == '')
49
{
50
	$admin->print_header();
51
	$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'comment_id='.$id);
52
}
53
else
54
{
55
	$title = strip_tags($admin->get_post_escaped('title'));
56
	$comment = strip_tags($admin->get_post_escaped('comment'));
57
	$post_id = $admin->getIDKEY($admin->get_post('post_id'));
58

    
59
	// do not allow droplets in user input!
60
	$title = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $title);
61
	$comment = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $comment);
62
}
63

    
64
// Update row
65
$database->query("UPDATE ".TABLE_PREFIX."mod_news_comments SET title = '$title', comment = '$comment' WHERE comment_id = '$comment_id'");
66

    
67
$admin->print_header();
68
// Check if there is a db error, otherwise say successful
69
if($database->is_error())
70
{
71
	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'&comment_id='.$id);
72
}
73
else
74
{
75
	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
76
}
77

    
78
// Print admin footer
79
$admin->print_footer();
(26-26/34)