@ -144,6 +144,7 @@ function show_add_forumcategory_form($inputvalues = array(),$lp_id) {
$check = Security::check_token('post');
if ($check) {
$values = $form->exportValues();
store_forumcategory($values);
}
Security::clear_token();
@ -477,16 +478,16 @@ function store_forumcategory($values) {
$new_max = $row['sort_max'] + 1;
$session_id = api_get_session_id();
$clean_cat_title = Database::escape_string(Security::remove_XSS(stripslashes( $values['forum_category_title'])) );
$clean_cat_title = Database::escape_string($values['forum_category_title']);
if (isset($values['forum_category_id'])) { // Storing after edition.
$sql = "UPDATE ".$table_categories." SET cat_title='".$clean_cat_title."', cat_comment='".Database::escape_string(Security::remove_XSS(stripslashes( $values['forum_category_comment'])) )."' WHERE cat_id='".Database::escape_string($values['forum_category_id'])."'";
$sql = "UPDATE ".$table_categories." SET cat_title='".$clean_cat_title."', cat_comment='".Database::escape_string($values['forum_category_comment'])."' WHERE cat_id='".Database::escape_string($values['forum_category_id'])."'";
Database::query($sql);
$last_id = Database::insert_id();
api_item_property_update(api_get_course_info(), TOOL_FORUM_CATEGORY, $values['forum_category_id'], 'ForumCategoryUpdated', api_get_user_id());
$return_message = get_lang('ForumCategoryEdited');
} else {
$sql = "INSERT INTO ".$table_categories." (cat_title, cat_comment, cat_order, session_id) VALUES ('".$clean_cat_title."','".Database::escape_string(Security::remove_XSS(stripslashes( $values['forum_category_comment'])) )."','".Database::escape_string($new_max)."','".Database::escape_string($session_id)."')";
$sql = "INSERT INTO ".$table_categories." (cat_title, cat_comment, cat_order, session_id) VALUES ('".$clean_cat_title."','".Database::escape_string($values['forum_category_comment'])."','".Database::escape_string($new_max)."','".Database::escape_string($session_id)."')";
Database::query($sql);
$last_id = Database::insert_id();
if ($last_id > 0) {
@ -2516,9 +2517,9 @@ function store_edit_post($values) {
$gradebook = Security::remove_XSS($_GET['gradebook']);
// First we check if the change affects the thread and if so we commit the changes (sticky and post_title=thread_title are relevant).
//if (array_key_exists('is_first_post_of_thread',$values) AND $values['is_first_post_of_thread']=='1') {
$sql = "UPDATE $table_threads SET thread_title='".Database::escape_string(stripslashes( $values['post_title']) )."',
$sql = "UPDATE $table_threads SET thread_title='".Database::escape_string($values['post_title'])."',
thread_sticky='".Database::escape_string(isset($values['thread_sticky']) ? $values['thread_sticky'] : null)."'," .
"thread_title_qualify='".Database::escape_string(Security::remove_XSS(stripslashes( $values['calification_notebook_title'])) )."'," .
"thread_title_qualify='".Database::escape_string($values['calification_notebook_title'])."'," .
"thread_qualify_max='".Database::escape_string($values['numeric_calification'])."',".
"thread_weight='".Database::escape_string($values['weight_calification'])."'".
" WHERE thread_id='".Database::escape_string($values['thread_id'])."'";
@ -2526,8 +2527,8 @@ function store_edit_post($values) {
Database::query($sql);
//}
// Update the post_title and the post_text.
$sql = "UPDATE $table_posts SET post_title='".Database::escape_string(Security::remove_XSS(stripslashes( $values['post_title'])) )."',
post_text='".Database::escape_string(Security::remove_XSS(stripslashes( $values['post_text'])) )."',
$sql = "UPDATE $table_posts SET post_title='".Database::escape_string($values['post_title'])."',
post_text='".Database::escape_string($values['post_text'])."',
post_notification='".Database::escape_string(isset($values['post_notification'])?$values['post_notification']:null)."'
WHERE post_id='".Database::escape_string($values['post_id'])."'";
Database::query($sql);
@ -3257,7 +3258,7 @@ function prepare4display($input) {
// TODO: Security should be implemented outside this function.
// Change this to COURSEMANAGERLOWSECURITY or COURSEMANAGER to lower filtering and allow more styles (see comments of Security::remove_XSS() method to learn about other levels).
return Security::remove_XSS($input, STUDENT);
return Security::remove_XSS($input, STUDENT, true );
}
/**