';
if (is_array($threads)) {
$html = '';
$count = 1;
-
foreach ($threads as $row) {
// Thread who have no replies yet and the only post is invisible should not be displayed to students.
if (api_is_allowed_to_edit(false, true) ||
@@ -491,7 +478,7 @@ if (is_array($threads)) {
$row['lastname']
),
array(
- "title" => api_htmlentities($poster_username, ENT_QUOTES)
+ 'title' => api_htmlentities($poster_username, ENT_QUOTES)
)
);
}
@@ -533,11 +520,11 @@ if (is_array($threads)) {
. Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL)
. " {$row['thread_replies']} ".get_lang('Replies').'
';
$html .= Display::return_icon(
- 'post-forum.png',
- null,
- null,
- ICON_SIZE_SMALL
- ).' '.$row['thread_views'].' '.get_lang('Views').'
'.$newPost;
+ 'post-forum.png',
+ null,
+ null,
+ ICON_SIZE_SMALL
+ ).' '.$row['thread_views'].' '.get_lang('Views').'
'.$newPost;
$html .= '';
$last_post_info = get_last_post_by_thread(
@@ -623,8 +610,7 @@ if (is_array($threads)) {
}
}
$iconnotify = 'notification_mail_na.png';
- if (
- is_array(
+ if (is_array(
isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null
)
) {
diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php
index 4490e6c8bd..416c0439ae 100755
--- a/main/forum/viewthread.php
+++ b/main/forum/viewthread.php
@@ -197,8 +197,8 @@ if ($my_message != 'PostDeletedSpecial') {
}
// new thread link
if ((
- api_is_allowed_to_edit(false, true) &&
- !(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId)
+ api_is_allowed_to_edit(false, true) &&
+ !(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId)
) ||
($current_forum['allow_new_threads'] == 1 && isset($_user['user_id'])) ||
($current_forum['allow_new_threads'] == 1 && !isset($_user['user_id']) && $current_forum['allow_anonymous'] == 1)
diff --git a/main/forum/viewthread_nested.inc.php b/main/forum/viewthread_nested.inc.php
index 0f78515b8d..5f90106cb0 100755
--- a/main/forum/viewthread_nested.inc.php
+++ b/main/forum/viewthread_nested.inc.php
@@ -143,12 +143,12 @@ foreach ($posts as $post) {
) {
if ($locked == false) {
$deleteUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
- 'forum' => $clean_forum_id,
- 'thread' => $clean_thread_id,
- 'action' => 'delete',
- 'content' => 'post',
- 'id' => $post['post_id']
- ]);
+ 'forum' => $clean_forum_id,
+ 'thread' => $clean_thread_id,
+ 'action' => 'delete',
+ 'content' => 'post',
+ 'id' => $post['post_id']
+ ]);
$iconEdit .= Display::url(
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL),
$deleteUrl,
@@ -292,8 +292,7 @@ foreach ($posts as $post) {
$html .= '';
// note: this can be removed here because it will be displayed in the tree
- if (
- isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) &&
+ if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) &&
!empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) &&
!empty($whatsnew_post_info[$_GET['forum']][$post['thread_id']])
) {
diff --git a/main/forum/viewthread_threaded.inc.php b/main/forum/viewthread_threaded.inc.php
index c79490a5b8..c00d7d0ed7 100755
--- a/main/forum/viewthread_threaded.inc.php
+++ b/main/forum/viewthread_threaded.inc.php
@@ -42,8 +42,7 @@ if (isset($_GET['post']) && $_GET['post']) {
// Are we in a lp ?
$origin = api_get_origin();
// Delete attachment file.
-if (
- isset($_GET['action']) &&
+if (isset($_GET['action']) &&
$_GET['action'] == 'delete_attach' &&
isset($_GET['id_attach'])
) {
@@ -69,8 +68,7 @@ foreach ($rows as $post) {
$indent = $post['indent_cnt'] * '20';
$thread_structure .= "";
- if (
- !empty($whatsnew_post_info[$forumId][$post['thread_id']]) &&
+ if (!empty($whatsnew_post_info[$forumId][$post['thread_id']]) &&
isset($whatsnew_post_info[$forumId][$threadId][$post['post_id']]) &&
!empty($whatsnew_post_info[$forumId][$threadId][$post['post_id']])
) {
@@ -79,11 +77,8 @@ foreach ($rows as $post) {
$post_image = Display::return_icon('forumpost.gif');
}
$thread_structure .= $post_image;
- if (
- isset($_GET['post']) &&
- $_GET['post'] == $post['post_id'] || (
- $counter == 1 AND !isset($_GET['post'])
- )
+ if (isset($_GET['post']) && $_GET['post'] == $post['post_id'] ||
+ ($counter == 1 && !isset($_GET['post']))
) {
$thread_structure .= ''.prepare4display($post['post_title']).'';
$prev_next_array[] = $post['post_id'];
@@ -98,10 +93,8 @@ foreach ($rows as $post) {
]),
['class' => empty($post['visible']) ? 'text-muted' : null]
);
-
$prev_next_array[] = $post['post_id'];
}
-
$thread_structure .= '
';
$count++;
}
@@ -150,13 +143,13 @@ $class_next = '';
$first_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
'&forum='.$forumId.'&thread='.$threadId.
'&gradebook='.$gradebook.'&id=1&post='.$prev_next_array[0];
-$last_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
+$last_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
'&forum='.$forumId.'&thread='.$threadId.
'&gradebook='.$gradebook.'&post='.$prev_next_array[$max - 1];
-$prev_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
+$prev_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
'&forum='.$forumId.'&thread='.$threadId.
'&gradebook='.$gradebook.'&post='.$prev_next_array[$prev_id];
-$next_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
+$next_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
'&forum='.$forumId.'&thread='.$threadId.
'&post='.$prev_next_array[$next_id];
@@ -236,8 +229,9 @@ $groupInfo = GroupManager::get_group_properties($groupId);
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
// The course admin him/herself can do this off course always
-if (
-(isset($groupInfo['iid']) && GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo)) || (
+if ((isset($groupInfo['iid']) &&
+ GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo)
+ ) || (
$current_forum['allow_edit'] == 1 &&
$row['user_id'] == $_user['user_id']
) || (
@@ -276,8 +270,9 @@ if (!empty($my_post) && is_array($my_post)) {
$post_minor = (int) $id_posts[0];
}
-if (
- (isset($groupInfo['iid']) && GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo)) ||
+if ((isset($groupInfo['iid']) &&
+ GroupManager::is_tutor_of_group(api_get_user_id(), $groupInfo)
+ ) ||
api_is_allowed_to_edit(false, true) &&
!(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId)
) {
@@ -392,17 +387,16 @@ if (($current_forum_category && $current_forum_category['locked'] == 0) &&
echo "";
// Note: this can be removed here because it will be displayed in the tree
-if (
- isset($whatsnew_post_info[$forumId][$threadId][$rows[$display_post_id]['post_id']]) AND
- !empty($whatsnew_post_info[$forumId][$threadId][$rows[$display_post_id]['post_id']]) AND
+if (isset($whatsnew_post_info[$forumId][$threadId][$rows[$display_post_id]['post_id']]) &&
+ !empty($whatsnew_post_info[$forumId][$threadId][$rows[$display_post_id]['post_id']]) &&
!empty($whatsnew_post_info[$_GET['forum']][$rows[$display_post_id]['thread_id']])
) {
$post_image = Display::return_icon('forumpostnew.gif');
} else {
$post_image = Display::return_icon('forumpost.gif');
}
-if (
- $rows[$display_post_id]['post_notification'] == '1' AND
+
+if ($rows[$display_post_id]['post_notification'] == '1' &&
$rows[$display_post_id]['poster_id'] == $_user['user_id']
) {
$post_image .= Display::return_icon('forumnotification.gif', get_lang('YouWillBeNotified'));
@@ -432,8 +426,7 @@ if (!empty($attachment_list) && is_array($attachment_list)) {
echo '';
- if (
- ($current_forum['allow_edit'] == 1 && $rows[$display_post_id]['user_id'] == $_user['user_id']) ||
+ if (($current_forum['allow_edit'] == 1 && $rows[$display_post_id]['user_id'] == $_user['user_id']) ||
(api_is_allowed_to_edit(false, true) && !(api_is_session_general_coach() && $current_forum['session_id'] != $sessionId))
) {
echo '