Project

General

Profile

1 1425 Luisehahne
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
17
 */
18
19
require('../../config.php');
20
21
// Get id
22
if(!isset($_POST['comment_id']) OR !is_numeric($_POST['comment_id']) OR !isset($_POST['post_id']) OR !is_numeric($_POST['post_id']))
23
{
24
	header("Location: ".ADMIN_URL."/pages/index.php");
25
	exit( 0 );
26
}
27
else
28
{
29
	$comment_id = (int)$_POST['comment_id'];
30
}
31
32
// Include WB admin wrapper script
33
$update_when_modified = true; // Tells script to update when this page was last updated
34
require(WB_PATH.'/modules/admin.php');
35
36
if (!$admin->checkFTAN())
37
{
38
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
39
	exit();
40
}
41
42
$id = $admin->getIDKEY($comment_id);
43
44
// Validate all fields
45
if($admin->get_post('title') == '' AND $admin->get_post('comment') == '')
46
{
47
	$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);
48
}
49
else
50
{
51
	$title = strip_tags($admin->get_post_escaped('title'));
52
	$comment = strip_tags($admin->get_post_escaped('comment'));
53
	$post_id = $admin->getIDKEY($admin->get_post('post_id'));
54
55
	// do not allow droplets in user input!
56
	$title = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $title);
57
	$comment = str_replace(array("[[", "]]"), array("&#91;&#91;", "&#93;&#93;"), $comment);
58
}
59
60
// Update row
61
$database->query("UPDATE ".TABLE_PREFIX."mod_news_comments SET title = '$title', comment = '$comment' WHERE comment_id = '$comment_id'");
62
63
// Check if there is a db error, otherwise say successful
64
if($database->is_error())
65
{
66
	$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'&section_id='.$section_id.'&comment_id='.$id);
67
}
68
else
69
{
70
	$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
71
}
72
73
// Print admin footer
74
$admin->print_footer();
75
76 562 Ruebenwurz
?>