From 57ed8945b7ba8d81863d8d2e3972e296ef63b316 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 9 Dec 2014 17:00:57 +0100 Subject: [PATCH] Adding cidreq + format code. --- main/forum/editpost.php | 6 +++++- main/forum/forumsearch.php | 9 +++------ main/forum/newthread.php | 5 +++-- main/forum/reply.php | 3 ++- main/forum/viewforum.php | 28 ++++++++++++++-------------- main/forum/viewforumcategory.php | 7 ++++--- main/forum/viewthread.php | 29 +++++++++++++++++------------ 7 files changed, 48 insertions(+), 39 deletions(-) diff --git a/main/forum/editpost.php b/main/forum/editpost.php index a2f5ad44bb..e7d39c15b6 100755 --- a/main/forum/editpost.php +++ b/main/forum/editpost.php @@ -201,7 +201,11 @@ echo ''; /* End new display forum */ // Set forum attachment data into $_SESSION -getAttachedFiles($current_forum['forum_id'], $current_thread['thread_id'], $current_post['post_id']); +getAttachedFiles( + $current_forum['forum_id'], + $current_thread['thread_id'], + $current_post['post_id'] +); // The form for the reply echo '
'; echo '
'; diff --git a/main/forum/forumsearch.php b/main/forum/forumsearch.php index 2802a4d62f..c4abea1080 100755 --- a/main/forum/forumsearch.php +++ b/main/forum/forumsearch.php @@ -57,9 +57,9 @@ if (isset($_SESSION['gradebook'])){ if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array ( - 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], - 'name' => get_lang('ToolGradebook') - ); + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], + 'name' => get_lang('ToolGradebook') + ); } if (!empty ($_GET['gidReq'])) { @@ -87,9 +87,6 @@ if ($origin == 'learnpath') { Display :: display_header($nameTools); } -// Display the tool title. -// api_display_tool_title($nameTools); - // Tool introduction Display::display_introduction_section(TOOL_FORUM); diff --git a/main/forum/newthread.php b/main/forum/newthread.php index fa82da7c4b..cb0ae34457 100755 --- a/main/forum/newthread.php +++ b/main/forum/newthread.php @@ -154,7 +154,8 @@ handle_forum_and_forumcategories(); // Action links echo ''; // Set forum attachment data into $_SESSION @@ -178,4 +179,4 @@ if (!empty($values) && isset($values['SubmitPost'])) { if ($origin != 'learnpath') { Display :: display_footer(); -} \ No newline at end of file +} diff --git a/main/forum/reply.php b/main/forum/reply.php index 0d4fd45306..1393cfcc1b 100755 --- a/main/forum/reply.php +++ b/main/forum/reply.php @@ -143,7 +143,8 @@ if ($origin == 'learnpath') { if ($origin != 'learnpath') { echo ''; } else { echo '
 
'; diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index cef9e2c7fb..45355a1f46 100755 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -77,7 +77,7 @@ if (!empty($groupId)) { //Course if (!api_is_allowed_to_edit(false, true) AND //is a student (($current_forum_category && $current_forum_category['visibility'] == 0) OR - $current_forum['visibility'] == 0 OR !$user_has_access_in_group) + $current_forum['visibility'] == 0 OR !$user_has_access_in_group) ) { api_not_allowed(); } @@ -294,20 +294,20 @@ if (api_is_allowed_to_edit(false, true) OR ($current_forum['allow_new_threads'] == 1 AND isset($_user['user_id'])) OR ($current_forum['allow_new_threads'] == 1 AND !isset($_user['user_id']) AND $current_forum['allow_anonymous'] == 1) ) { - if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) { - if (!api_is_anonymous()) { - if ($my_forum == strval(intval($my_forum))) { - echo ''. + if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) { + if (!api_is_anonymous()) { + if ($my_forum == strval(intval($my_forum))) { + echo ''. Display::return_icon('new_thread.png',get_lang('NewTopic'),'',ICON_SIZE_MEDIUM).''; - } else { - $my_forum = strval(intval($my_forum)); - echo ''. + } else { + $my_forum = strval(intval($my_forum)); + echo ''. Display::return_icon('new_thread.png',get_lang('NewTopic'),'',ICON_SIZE_MEDIUM).''; - } - } - } else { - echo get_lang('ForumLocked'); - } + } + } + } else { + echo get_lang('ForumLocked'); + } } echo '
'; @@ -354,7 +354,7 @@ if (is_array($threads)) { !($row['thread_replies'] == '0' AND $row['visibility'] == '0') ) { if ($counter % 2 == 0) { - $class = 'row_odd'; + $class = 'row_odd'; } else { $class = 'row_even'; } diff --git a/main/forum/viewforumcategory.php b/main/forum/viewforumcategory.php index 5eadf7aea9..bff410c948 100755 --- a/main/forum/viewforumcategory.php +++ b/main/forum/viewforumcategory.php @@ -75,11 +75,11 @@ $interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook.'&sear if (!empty($_GET['action']) && !empty($_GET['content'])) { if ($_GET['action']=='add' && $_GET['content']=='forum' ) { - $interbreadcrumb[] = array('url' =>'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&origin='.$origin,'name' => $current_forum_category['cat_title']); + $interbreadcrumb[] = array('url' =>'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&origin='.$origin,'name' => $current_forum_category['cat_title']); $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('AddForum')); } } else { - $interbreadcrumb[] = array('url' => '#','name' => $current_forum_category['cat_title']); + $interbreadcrumb[] = array('url' => '#','name' => $current_forum_category['cat_title']); } // Are we in a lp ? @@ -108,7 +108,8 @@ if (!api_is_allowed_to_edit(false,true) AND ($current_forum_category && $current /* Action Links */ echo '
'; echo ''.search_link().''; -echo ''.Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).''; +echo ''. + Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).''; if (api_is_allowed_to_edit(false,true)) { echo ' '.Display::return_icon('new_forum.png', get_lang('AddForum'),'',ICON_SIZE_MEDIUM).''; } diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php index 0b27816a33..109964863d 100755 --- a/main/forum/viewthread.php +++ b/main/forum/viewthread.php @@ -132,7 +132,6 @@ if ($my_message != 'PostDeletedSpecial') { if ($origin != 'learnpath') { echo ''. Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).''; - } // The reply to thread link should only appear when the forum_category is not locked AND the forum is not locked AND the thread is not locked. // If one of the three levels is locked then the link should not be displayed. @@ -145,7 +144,14 @@ if ($my_message != 'PostDeletedSpecial') { Display::return_icon('reply_thread.png', get_lang('ReplyToThread'), '', ICON_SIZE_MEDIUM).''; } // new thread link - if ((api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) OR ($current_forum['allow_new_threads'] == 1 AND isset($_user['user_id'])) OR ($current_forum['allow_new_threads'] == 1 AND !isset($_user['user_id']) AND $current_forum['allow_anonymous'] == 1)) { + if ( + ( + api_is_allowed_to_edit(false, true) && + !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session']) + ) OR + ($current_forum['allow_new_threads'] == 1 AND isset($_user['user_id'])) OR + ($current_forum['allow_new_threads'] == 1 AND !isset($_user['user_id']) AND $current_forum['allow_anonymous'] == 1) + ) { if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) { echo '  '; } else { @@ -184,15 +190,16 @@ if ($my_message != 'PostDeletedSpecial') { } if (isset($_GET['msg']) && isset($_GET['type'])) { - switch($_GET['type']) { - case 'error': - Display::display_error_message($_GET['msg']); - break; - case 'confirmation': - Display::display_confirmation_message($_GET['msg']); - break; - } + switch($_GET['type']) { + case 'error': + Display::display_error_message($_GET['msg']); + break; + case 'confirmation': + Display::display_confirmation_message($_GET['msg']); + break; + } } + switch ($viewmode) { case 'flat': include_once 'viewthread_flat.inc.php'; @@ -209,8 +216,6 @@ if ($my_message != 'PostDeletedSpecial') { } } -/* FOOTER */ - if ($origin != 'learnpath') { Display :: display_footer(); }