Browse Source

Adding cidreq + format code.

Julio Montoya 10 years ago
parent
commit
57ed8945b7

+ 5 - 1
main/forum/editpost.php

@@ -201,7 +201,11 @@ echo '</div></div></div>';
 /* 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 '<div class="row">';
 echo '<div class="span12">';

+ 3 - 6
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);
 

+ 3 - 2
main/forum/newthread.php

@@ -154,7 +154,8 @@ handle_forum_and_forumcategories();
 // Action links
 echo '<div class="actions">';
 echo '<span style="float:right;">'.search_link().'</span>';
-echo '<a href="viewforum.php?origin='.$origin.'&forum='.Security::remove_XSS($_GET['forum']).'&'.api_get_cidreq().'">'.Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>';
+echo '<a href="viewforum.php?origin='.$origin.'&forum='.Security::remove_XSS($_GET['forum']).'&'.api_get_cidreq().'">'.
+    Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 // Set forum attachment data into $_SESSION
@@ -178,4 +179,4 @@ if (!empty($values) && isset($values['SubmitPost'])) {
 
 if ($origin != 'learnpath') {
     Display :: display_footer();
-}
+}

+ 2 - 1
main/forum/reply.php

@@ -143,7 +143,8 @@ if ($origin == 'learnpath') {
 if ($origin != 'learnpath') {
     echo '<div class="actions">';
     echo '<span style="float:right;">'.search_link().'</span>';
-    echo '<a href="viewthread.php?forum='.Security::remove_XSS($_GET['forum']).'&amp;gradebook='.$gradebook.'&amp;thread='.Security::remove_XSS($_GET['thread']).'&amp;origin='.$origin.'">'.Display::return_icon('back.png', get_lang('BackToThread'), '', ICON_SIZE_MEDIUM).'</a>';
+    echo '<a href="viewthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&amp;gradebook='.$gradebook.'&amp;thread='.Security::remove_XSS($_GET['thread']).'&amp;origin='.$origin.'">'.
+        Display::return_icon('back.png', get_lang('BackToThread'), '', ICON_SIZE_MEDIUM).'</a>';
     echo '</div>';
 } else {
     echo '<div style="height:15px">&nbsp;</div>';

+ 14 - 14
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 '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&amp;forum='.Security::remove_XSS($my_forum).$origin_string.'">'.
+    if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) {
+        if (!api_is_anonymous()) {
+            if ($my_forum == strval(intval($my_forum))) {
+                echo '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&amp;forum='.Security::remove_XSS($my_forum).$origin_string.'">'.
                     Display::return_icon('new_thread.png',get_lang('NewTopic'),'',ICON_SIZE_MEDIUM).'</a>';
-		    } else {
-		    	$my_forum = strval(intval($my_forum));
-				echo '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&amp;forum='.$my_forum.$origin_string.'">'.
+            } else {
+                $my_forum = strval(intval($my_forum));
+                echo '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&amp;forum='.$my_forum.$origin_string.'">'.
                     Display::return_icon('new_thread.png',get_lang('NewTopic'),'',ICON_SIZE_MEDIUM).'</a>';
-			}
-		}
-	} else {
-		echo get_lang('ForumLocked');
-	}
+            }
+        }
+    } else {
+        echo get_lang('ForumLocked');
+    }
 }
 echo '</div>';
 
@@ -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';
             }

+ 4 - 3
main/forum/viewforumcategory.php

@@ -75,11 +75,11 @@ $interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook.'&amp;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'].'&amp;origin='.$origin,'name' => $current_forum_category['cat_title']);
+        $interbreadcrumb[] = array('url' =>'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&amp;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 '<div class="actions">';
 echo '<span style="float:right;">'.search_link().'</span>';
-echo '<a href="index.php?gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>';
+echo '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'.
+    Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>';
 if (api_is_allowed_to_edit(false,true)) {
     echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'].'&amp;action=add&amp;content=forum"> '.Display::return_icon('new_forum.png', get_lang('AddForum'),'',ICON_SIZE_MEDIUM).'</a>';
 }

+ 17 - 12
main/forum/viewthread.php

@@ -132,7 +132,6 @@ if ($my_message != 'PostDeletedSpecial') {
     if ($origin != 'learnpath') {
         echo '<a href="'.$forumUrl.'viewforum.php?forum='.Security::remove_XSS($_GET['forum']).'&'.api_get_cidreq().'">'.
             Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'</a>';
-
     }
     // 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).'</a>';
             }
             // 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 '&nbsp;&nbsp;';
                 } 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();
 }