1
|
<?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: save_comment.php 1457 2011-06-25 17:18:50Z Luisehahne $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/tags/2.8.2/wb/modules/news/save_comment.php $
|
15
|
* @lastmodified $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
|
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
|
$admin_header = false;
|
33
|
// Tells script to update when this page was last updated
|
34
|
$update_when_modified = true;
|
35
|
// show the info banner
|
36
|
// $print_info_banner = true;
|
37
|
// Include WB admin wrapper script
|
38
|
require(WB_PATH.'/modules/admin.php');
|
39
|
|
40
|
if (!$admin->checkFTAN())
|
41
|
{
|
42
|
$admin->print_header();
|
43
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id );
|
44
|
}
|
45
|
|
46
|
$id = intval($admin->getIDKEY($comment_id));
|
47
|
|
48
|
// Validate all fields
|
49
|
if($admin->get_post('title') == '' AND $admin->get_post('comment') == '')
|
50
|
{
|
51
|
$admin->print_header();
|
52
|
$admin->print_error($MESSAGE['GENERIC']['FILL_IN_ALL'], WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'§ion_id='.$section_id.'comment_id='.$id);
|
53
|
}
|
54
|
else
|
55
|
{
|
56
|
$title = strip_tags($admin->get_post_escaped('title'));
|
57
|
$comment = strip_tags($admin->get_post_escaped('comment'));
|
58
|
$post_id = $admin->getIDKEY($admin->get_post('post_id'));
|
59
|
|
60
|
// do not allow droplets in user input!
|
61
|
$title = str_replace(array("[[", "]]"), array("[[", "]]"), $title);
|
62
|
$comment = str_replace(array("[[", "]]"), array("[[", "]]"), $comment);
|
63
|
}
|
64
|
|
65
|
// Update row
|
66
|
$database->query("UPDATE ".TABLE_PREFIX."mod_news_comments SET title = '$title', comment = '$comment' WHERE comment_id = '$comment_id'");
|
67
|
|
68
|
$admin->print_header();
|
69
|
// Check if there is a db error, otherwise say successful
|
70
|
if($database->is_error())
|
71
|
{
|
72
|
$admin->print_error($database->get_error(), WB_URL.'/modules/news/modify_comment.php?page_id='.$page_id.'§ion_id='.$section_id.'&comment_id='.$id);
|
73
|
}
|
74
|
else
|
75
|
{
|
76
|
$admin->print_success($TEXT['SUCCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
|
77
|
}
|
78
|
|
79
|
// Print admin footer
|
80
|
$admin->print_footer();
|
81
|
|
82
|
?>
|