UI Improvements + lots of bugfixes * @package chamilo.forum */ // Delete attachment file if ((isset($_GET['action']) && $_GET['action'] == 'delete_attach') && isset($_GET['id_attach']) ) { delete_attachment(0, $_GET['id_attach']); } // Are we in a lp ? $origin = api_get_origin(); $sessionId = api_get_session_id(); $_user = api_get_user_info(); $userId = api_get_user_id(); $groupId = api_get_group_id(); // Decide whether we show the latest post first $sortDirection = isset($_GET['posts_order']) && $_GET['posts_order'] === 'desc' ? 'DESC' : ($origin != 'learnpath' ? 'ASC' : 'DESC'); if (isset($current_thread['thread_id'])) { $rows = getPosts($current_forum, $current_thread['thread_id'], $sortDirection); $increment = 0; $clean_forum_id = intval($_GET['forum']); $clean_thread_id = intval($_GET['thread']); $locked = api_resource_is_locked_by_gradebook( $clean_thread_id, LINK_FORUM_THREAD ); $closedPost = null; if (!empty($rows)) { $postCount = count($rows); foreach ($rows as $row) { if ($row['user_id'] == '0') { $name = prepare4display($row['poster_name']); } else { $name = api_get_person_name($row['firstname'], $row['lastname']); } $username = sprintf(get_lang('LoginX'), $row['username']); if (($current_forum_category && $current_forum_category['locked'] == 0) && $current_forum['locked'] == 0 && $current_thread['locked'] == 0 || api_is_allowed_to_edit(false, true) ) { if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) { if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { $buttonReply = Display::toolbarButton( get_lang('ReplyToMessage'), 'reply.php?'.api_get_cidreq().'&'.http_build_query([ 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'post' => $row['post_id'], 'action' => 'replymessage' ]), 'reply', 'primary', ['id' => "reply-to-post-{$row['post_id']}"] ); $buttonQuote = Display::toolbarButton( get_lang('QuoteMessage'), 'reply.php?'.api_get_cidreq().'&'.http_build_query([ 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'post' => $row['post_id'], 'action' => 'quote' ]), 'quote-left', 'success', ['id' => "quote-post-{$row['post_id']}"] ); } } } else { if (($current_forum_category && $current_forum_category['locked'] == 1)) { $closedPost = Display::tag( 'div', ' '.get_lang('ForumcategoryLocked'), array('class' => 'alert alert-warning post-closed') ); } if ($current_forum['locked'] == 1) { $closedPost = Display::tag( 'div', ' '.get_lang('ForumLocked'), array('class' => 'alert alert-warning post-closed') ); } if ($current_thread['locked'] == 1) { $closedPost = Display::tag( 'div', ' '.get_lang('ThreadLocked'), array('class' => 'alert alert-warning post-closed') ); } } $html = ''; $html .= '