parent
b0d9e4c931
commit
18b82ae616
@ -0,0 +1,90 @@ |
||||
<?php // $Id: download.php 12218 2007-05-01 18:27:14Z yannoo $
|
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2008 Dokeos SPRL |
||||
|
||||
For a full list of contributors, see "credits.txt". |
||||
The full license can be read in "license.txt". |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium |
||||
info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
/** |
||||
============================================================================== |
||||
* This file is responsible for passing requested documents to the browser. |
||||
* Html files are parsed to fix a few problems with URLs, |
||||
* but this code will hopefully be replaced soon by an Apache URL |
||||
* rewrite mechanism. |
||||
* |
||||
* @package dokeos.document |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/* |
||||
============================================================================== |
||||
MAIN CODE |
||||
============================================================================== |
||||
*/ |
||||
|
||||
session_cache_limiter('public'); |
||||
|
||||
include('../inc/global.inc.php'); |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
include(api_get_path(LIBRARY_PATH).'document.lib.php'); |
||||
|
||||
// IMPORTANT to avoid caching of documents |
||||
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); |
||||
header('Cache-Control: public'); |
||||
header('Pragma: no-cache'); |
||||
|
||||
//protection |
||||
api_protect_course_script(true); |
||||
|
||||
$doc_url = $_GET['file']; |
||||
//change the '&' that got rewritten to '///' by mod_rewrite back to '&' |
||||
$doc_url = str_replace('///', '&', $doc_url); |
||||
//still a space present? it must be a '+' (that got replaced by mod_rewrite) |
||||
$doc_url = str_replace(' ', '+', $doc_url); |
||||
$doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
||||
|
||||
include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); |
||||
|
||||
if (! isset($_course)) |
||||
{ |
||||
api_not_allowed(true); |
||||
} |
||||
//if the rewrite rule asks for a directory, we redirect to the document explorer |
||||
if (is_dir(api_get_path(SYS_COURSE_PATH).$_course['path'].'/upload/blog/'.$doc_url)) |
||||
{ |
||||
//remove last slash if present |
||||
while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
||||
//create the path |
||||
$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
||||
//redirect |
||||
header('Location: '.$document_explorer); |
||||
} |
||||
|
||||
$blog_table_attachment = '`'.$_course['dbNameGlu'].'blog_attachment'.'`'; |
||||
|
||||
// launch event |
||||
event_download($doc_url); |
||||
$sys_course_path = api_get_path(SYS_COURSE_PATH); |
||||
$full_file_name = $sys_course_path.$_course['path'].'/upload/blog/'.$doc_url; |
||||
|
||||
$sql = 'SELECT filename FROM '.$blog_table_attachment.' WHERE path LIKE BINARY "'.$doc_url.'"'; |
||||
$result= api_sql_query($sql, __FILE__, __LINE__); |
||||
$row= Database::fetch_array($result); |
||||
DocumentManager::file_send_for_download($full_file_name,TRUE, $row['filename']); |
||||
exit; |
||||
?> |
@ -1,57 +1,58 @@ |
||||
<?php |
||||
/** |
||||
* @todo use Database :: get_course_table |
||||
* @todo move the tool constants to the appropriate place |
||||
* @todo make config settings out of $forum_setting |
||||
* |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @version february 2006, dokeos 1.8 |
||||
*/ |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Database Variables |
||||
----------------------------------------------------------- |
||||
*/ |
||||
$table_categories = "`".$_course["dbNameGlu"]."forum_category"."`"; |
||||
$table_forums = "`".$_course["dbNameGlu"]."forum_forum"."`"; |
||||
$table_threads = "`".$_course["dbNameGlu"]."forum_thread"."`"; |
||||
$table_posts = "`".$_course["dbNameGlu"]."forum_post"."`"; |
||||
$table_mailcue = "`".$_course["dbNameGlu"]."forum_mailcue"."`"; |
||||
|
||||
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
||||
$table_users = Database :: get_main_table(TABLE_MAIN_USER); |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Constants |
||||
----------------------------------------------------------- |
||||
*/ |
||||
define("TOOL_FORUM_CATEGORY",'forum_category'); |
||||
define("TOOL_FORUM",'forum'); |
||||
define("TOOL_FORUM_THREAD",'forum_thread'); |
||||
define("TOOL_FORUM_POST",'forum_post'); |
||||
|
||||
|
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Some configuration settings |
||||
(these can go to the dokeos config settings afterwards) |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// if this setting is true then an I-frame will be displayed when replying |
||||
$forum_setting['show_thread_iframe_on_reply']=true; |
||||
// if this setting is true then students and teachers can check a checkbox so that they receive a mail when somebody replies to the thread |
||||
$forum_setting['allow_post_notificiation']=true; |
||||
// when this setting is true then the course admin can post threads that are important. These posts remain on top all the time (until made unsticky) |
||||
// these special posts are indicated with a special icon also |
||||
$forum_setting['allow_sticky']=true; |
||||
// when this setting is true there will be a column that displays the latest post (date and poster) of the given forum. This requires quite some sql statements that |
||||
// might slow down the page with the fora. |
||||
// note: I'm currently investigating how it would be possible to increase the performance of this part. |
||||
$forum_setting['show_last_post']=false; |
||||
|
||||
<?php |
||||
/** |
||||
* @todo use Database :: get_course_table |
||||
* @todo move the tool constants to the appropriate place |
||||
* @todo make config settings out of $forum_setting |
||||
* |
||||
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @version february 2006, dokeos 1.8 |
||||
*/ |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Database Variables |
||||
----------------------------------------------------------- |
||||
*/ |
||||
$table_categories = "`".$_course["dbNameGlu"]."forum_category"."`"; |
||||
$table_forums = "`".$_course["dbNameGlu"]."forum_forum"."`"; |
||||
$table_threads = "`".$_course["dbNameGlu"]."forum_thread"."`"; |
||||
$table_posts = "`".$_course["dbNameGlu"]."forum_post"."`"; |
||||
$table_mailcue = "`".$_course["dbNameGlu"]."forum_mailcue"."`"; |
||||
|
||||
$forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
||||
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
||||
$table_users = Database :: get_main_table(TABLE_MAIN_USER); |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Constants |
||||
----------------------------------------------------------- |
||||
*/ |
||||
define("TOOL_FORUM_CATEGORY",'forum_category'); |
||||
define("TOOL_FORUM",'forum'); |
||||
define("TOOL_FORUM_THREAD",'forum_thread'); |
||||
define("TOOL_FORUM_POST",'forum_post'); |
||||
|
||||
|
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Some configuration settings |
||||
(these can go to the dokeos config settings afterwards) |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// if this setting is true then an I-frame will be displayed when replying |
||||
$forum_setting['show_thread_iframe_on_reply']=true; |
||||
// if this setting is true then students and teachers can check a checkbox so that they receive a mail when somebody replies to the thread |
||||
$forum_setting['allow_post_notificiation']=true; |
||||
// when this setting is true then the course admin can post threads that are important. These posts remain on top all the time (until made unsticky) |
||||
// these special posts are indicated with a special icon also |
||||
$forum_setting['allow_sticky']=true; |
||||
// when this setting is true there will be a column that displays the latest post (date and poster) of the given forum. This requires quite some sql statements that |
||||
// might slow down the page with the fora. |
||||
// note: I'm currently investigating how it would be possible to increase the performance of this part. |
||||
$forum_setting['show_last_post']=false; |
||||
|
||||
?> |
File diff suppressed because it is too large
Load Diff
@ -1,354 +1,355 @@ |
||||
<?php |
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2006-2008 Dokeos S.A. |
||||
Copyright (c) 2006 Ghent University (UGent) |
||||
|
||||
For a full list of contributors, see "credits.txt". |
||||
The full license can be read in "license.txt". |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium |
||||
Mail: info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = 'forum'; |
||||
|
||||
// including the global dokeos file |
||||
require ('../inc/global.inc.php'); |
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
// including additional library scripts |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); |
||||
$nameTools=get_lang('Forum'); |
||||
|
||||
|
||||
//are we in a lp ? |
||||
$origin = ''; |
||||
if(isset($_GET['origin'])) |
||||
{ |
||||
$origin = Security::remove_XSS($_GET['origin']); |
||||
$origin_string = '&origin='.$origin; |
||||
} |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Including necessary files |
||||
----------------------------------------------------------- |
||||
*/ |
||||
include('forumconfig.inc.php'); |
||||
include('forumfunction.inc.php'); |
||||
|
||||
|
||||
/* |
||||
============================================================================== |
||||
MAIN DISPLAY SECTION |
||||
============================================================================== |
||||
*/ |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Retrieving forum and forum categorie information |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// we are getting all the information about the current forum and forum category. |
||||
// note pcool: I tried to use only one sql statement (and function) for this |
||||
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table |
||||
$current_forum=get_forum_information($_GET['forum']); // note: this has to be validated that it is an existing forum. |
||||
$current_forum_category=get_forumcategory_information($current_forum['forum_category']); |
||||
|
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Header and Breadcrumbs |
||||
----------------------------------------------------------- |
||||
*/ |
||||
$interbreadcrumb[]=array("url" => "index.php?search=".Security::remove_XSS($_GET['search']),"name" => $nameTools); |
||||
$interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id']."&search=".Security::remove_XSS(urlencode($_GET['search'])),"name" => prepare4display($current_forum_category['cat_title'])); |
||||
$interbreadcrumb[]=array("url" => "viewforum.php?forum=".Security::remove_XSS($_GET['forum'])."&search=".Security::remove_XSS(urlencode($_GET['search'])),"name" => prepare4display($current_forum['forum_title'])); |
||||
if($origin=='learnpath') |
||||
{ |
||||
include(api_get_path(INCLUDE_PATH).'reduced_header.inc.php'); |
||||
} else |
||||
{ |
||||
// the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string |
||||
Display :: display_header(''); |
||||
api_display_tool_title($nameTools); |
||||
} |
||||
|
||||
//echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />'; |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Actions |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// Change visibility of a forum or a forum category |
||||
if (($_GET['action']=='invisible' OR $_GET['action']=='visible') AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit()) |
||||
{ |
||||
$message=change_visibility($_GET['content'], $_GET['id'],$_GET['action']);// note: this has to be cleaned first |
||||
} |
||||
if (($_GET['action']=='lock' OR $_GET['action']=='unlock') AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit()) |
||||
{ |
||||
$message=change_lock_status($_GET['content'], $_GET['id'],$_GET['action']);// note: this has to be cleaned first |
||||
} |
||||
if ($_GET['action']=='delete' AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit()) |
||||
{ |
||||
$message=delete_forum_forumcategory_thread($_GET['content'],$_GET['id']); // note: this has to be cleaned first |
||||
} |
||||
if ($_GET['action']=='move' and isset($_GET['thread'])) |
||||
{ |
||||
$message=move_thread_form(); |
||||
} |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Is the user allowed here? |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// if the user is not a course administrator and the forum is hidden |
||||
// then the user is not allowed here. |
||||
if (!api_is_allowed_to_edit() AND ($current_forum_category['visibility']==0 OR $current_forum['visibility']==0)) |
||||
{ |
||||
forum_not_allowed_here(); |
||||
} |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Display the action messages |
||||
----------------------------------------------------------- |
||||
*/ |
||||
if (isset($message)) |
||||
{ |
||||
Display :: display_confirmation_message($message); |
||||
} |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Action Links |
||||
----------------------------------------------------------- |
||||
*/ |
||||
echo '<span style="float:right;">'.search_link().'</span>'; |
||||
// The link should appear when |
||||
// 1. the course admin is here |
||||
// 2. the course member is here and new threads are allowed |
||||
// 3. a visitor is here and new threads AND allowed AND anonymous posts are allowed |
||||
if (api_is_allowed_to_edit() 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 '<a href="newthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).$origin_string.'">'.Display::return_icon('forumthread_new.gif').' '.get_lang('NewTopic').'</a>'; |
||||
} |
||||
else |
||||
{ |
||||
echo get_lang('ForumLocked'); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Display |
||||
----------------------------------------------------------- |
||||
*/ |
||||
echo "<table class=\"data_table\" width='100%'>\n"; |
||||
|
||||
// the current forum |
||||
if($origin != 'learnpath') |
||||
{ |
||||
echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"7\">"; |
||||
echo '<span class="forum_title">'.prepare4display($current_forum['forum_title']).'</span>'; |
||||
|
||||
if (!empty ($current_forum['forum_comment'])) |
||||
{ |
||||
echo '<br><span class="forum_description">'.prepare4display($current_forum['forum_comment']).'</span>'; |
||||
} |
||||
|
||||
if (!empty ($current_forum_category['cat_title'])) |
||||
{ |
||||
echo '<br /><span class="forum_low_description">'.prepare4display($current_forum_category['cat_title'])."</span><br />"; |
||||
} |
||||
|
||||
echo "</th>\n"; |
||||
echo "\t</tr>\n"; |
||||
} |
||||
|
||||
echo "</th>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// The column headers (to do: make this sortable) |
||||
echo "\t<tr class=\"forum_threadheader\">\n"; |
||||
echo "\t\t<td></td>\n"; |
||||
echo "\t\t<td>".get_lang('Title')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Replies')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Views')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Author')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('LastPost')."</td>\n"; |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo "\t\t<td>".get_lang('Actions')."</td>\n"; |
||||
} |
||||
echo "\t</tr>\n"; |
||||
|
||||
// getting al the threads |
||||
$threads=get_threads($_GET['forum']); // note: this has to be cleaned first |
||||
|
||||
$whatsnew_post_info=$_SESSION['whatsnew_post_info']; |
||||
|
||||
$counter=0; |
||||
if(is_array($threads)) |
||||
{ |
||||
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() OR !($row['thread_replies']=='0' AND $row['visible']=='0')) |
||||
{ |
||||
if($counter%2==0) |
||||
{ |
||||
$class="row_odd"; |
||||
} |
||||
else |
||||
{ |
||||
$class="row_even"; |
||||
} |
||||
echo "\t<tr class=\"$class\">\n"; |
||||
echo "\t\t<td>"; |
||||
if (is_array($whatsnew_post_info[$_GET['forum']][$row['thread_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']])) |
||||
{ |
||||
echo icon('../img/forumthread.gif'); |
||||
} |
||||
else |
||||
{ |
||||
echo icon('../img/forumthread.gif'); |
||||
} |
||||
|
||||
if ($row['thread_sticky']==1) |
||||
{ |
||||
echo icon('../img/exclamation.gif'); |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t\t<td><a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".$row['thread_id'].$origin_string."&search=".Security::remove_XSS(urlencode($_GET['search']))."\" ".class_visible_invisible($row['visibility']).">".prepare4display($row['thread_title'])."</a></td>\n"; |
||||
echo "\t\t<td>".$row['thread_replies']."</td>\n"; |
||||
if ($row['user_id']=='0') |
||||
{ |
||||
$name=prepare4display($row['thread_poster_name']); |
||||
} |
||||
else |
||||
{ |
||||
$name=$row['firstname'].' '.$row['lastname']; |
||||
} |
||||
echo "\t\t<td>".$row['thread_views']."</td>\n"; |
||||
|
||||
if ($row['last_poster_user_id']=='0') |
||||
{ |
||||
$name=$row['poster_name']; |
||||
} |
||||
else |
||||
{ |
||||
$name=$row['last_poster_firstname'].' '.$row['last_poster_lastname']; |
||||
} |
||||
|
||||
if($origin != 'learnpath') |
||||
{ |
||||
echo "\t\t<td>".display_user_link($row['user_id'], $name)."</td>\n"; |
||||
} |
||||
else |
||||
{ |
||||
echo "\t\t<td>".$name."</td>\n"; |
||||
} |
||||
|
||||
// if the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread |
||||
if (($row['visible']=='1' OR api_is_allowed_to_edit()) && $origin!='learnpath') |
||||
{ |
||||
$last_post=$row['thread_date']." ".get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name); |
||||
} |
||||
else if($origin!='learnpath') |
||||
{ |
||||
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC"; |
||||
$last_post_result=api_sql_query($last_post_sql, __LINE__, __FILE__); |
||||
$last_post_row=mysql_fetch_array($last_post_result); |
||||
$name=$last_post_row['firstname'].' '.$last_post_row['lastname']; |
||||
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name); |
||||
} |
||||
else |
||||
{ |
||||
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC"; |
||||
$last_post_result=api_sql_query($last_post_sql, __LINE__, __FILE__); |
||||
$last_post_row=mysql_fetch_array($last_post_result); |
||||
$name=$last_post_row['firstname'].' '.$last_post_row['lastname']; |
||||
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.$name; |
||||
} |
||||
echo "\t\t<td>".$last_post."</td>\n"; |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo "\t\t<td>"; |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&action=delete&content=thread&id=".$row['thread_id'].$origin_string."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeleteCompleteThread"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>"; |
||||
display_visible_invisible_icon('thread', $row['thread_id'], $row['visibility'], array("forum"=>$_GET['forum'],'origin'=>$origin)); |
||||
display_lock_unlock_icon('thread',$row['thread_id'], $row['locked'], array("forum"=>$_GET['forum'],'origin'=>$origin)); |
||||
echo "<a href=\"viewforum.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&action=move&thread=".$row['thread_id'].$origin_string."\">".icon('../img/deplacer_fichier.gif',get_lang('MoveThread'))."</a>"; |
||||
echo "</td>\n"; |
||||
} |
||||
echo "\t</tr>\n"; |
||||
} |
||||
$counter++; |
||||
|
||||
|
||||
} |
||||
} |
||||
|
||||
echo "</table>"; |
||||
|
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
if($origin != 'learnpath') |
||||
{ |
||||
Display :: display_footer(); |
||||
} |
||||
?> |
||||
|
||||
|
||||
|
||||
<?php |
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2006-2008 Dokeos S.A. |
||||
Copyright (c) 2006 Ghent University (UGent) |
||||
|
||||
For a full list of contributors, see "credits.txt". |
||||
The full license can be read in "license.txt". |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium |
||||
Mail: info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
// name of the language file that needs to be included |
||||
$language_file = 'forum'; |
||||
|
||||
// including the global dokeos file |
||||
require ('../inc/global.inc.php'); |
||||
|
||||
// notice for unauthorized people. |
||||
api_protect_course_script(true); |
||||
|
||||
// the section (tabs) |
||||
$this_section=SECTION_COURSES; |
||||
|
||||
// including additional library scripts |
||||
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
||||
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php'); |
||||
$nameTools=get_lang('Forum'); |
||||
|
||||
|
||||
//are we in a lp ? |
||||
$origin = ''; |
||||
if(isset($_GET['origin'])) |
||||
{ |
||||
$origin = Security::remove_XSS($_GET['origin']); |
||||
$origin_string = '&origin='.$origin; |
||||
} |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Including necessary files |
||||
----------------------------------------------------------- |
||||
*/ |
||||
include('forumconfig.inc.php'); |
||||
include('forumfunction.inc.php'); |
||||
|
||||
|
||||
/* |
||||
============================================================================== |
||||
MAIN DISPLAY SECTION |
||||
============================================================================== |
||||
*/ |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Retrieving forum and forum categorie information |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// we are getting all the information about the current forum and forum category. |
||||
// note pcool: I tried to use only one sql statement (and function) for this |
||||
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table |
||||
$current_forum=get_forum_information($_GET['forum']); // note: this has to be validated that it is an existing forum. |
||||
$current_forum_category=get_forumcategory_information($current_forum['forum_category']); |
||||
|
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Header and Breadcrumbs |
||||
----------------------------------------------------------- |
||||
*/ |
||||
$interbreadcrumb[]=array("url" => "index.php?search=".Security::remove_XSS($_GET['search']),"name" => $nameTools); |
||||
$interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id']."&search=".Security::remove_XSS(urlencode($_GET['search'])),"name" => prepare4display($current_forum_category['cat_title'])); |
||||
$interbreadcrumb[]=array("url" => "viewforum.php?forum=".Security::remove_XSS($_GET['forum'])."&search=".Security::remove_XSS(urlencode($_GET['search'])),"name" => prepare4display($current_forum['forum_title'])); |
||||
if($origin=='learnpath') |
||||
{ |
||||
include(api_get_path(INCLUDE_PATH).'reduced_header.inc.php'); |
||||
} else |
||||
{ |
||||
// the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string |
||||
Display :: display_header(''); |
||||
api_display_tool_title($nameTools); |
||||
} |
||||
|
||||
//echo '<link href="forumstyles.css" rel="stylesheet" type="text/css" />'; |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Actions |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// Change visibility of a forum or a forum category |
||||
if (($_GET['action']=='invisible' OR $_GET['action']=='visible') AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit()) |
||||
{ |
||||
$message=change_visibility($_GET['content'], $_GET['id'],$_GET['action']);// note: this has to be cleaned first |
||||
} |
||||
if (($_GET['action']=='lock' OR $_GET['action']=='unlock') AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit()) |
||||
{ |
||||
$message=change_lock_status($_GET['content'], $_GET['id'],$_GET['action']);// note: this has to be cleaned first |
||||
} |
||||
if ($_GET['action']=='delete' AND isset($_GET['content']) AND isset($_GET['id']) AND api_is_allowed_to_edit()) |
||||
{ |
||||
$message=delete_forum_forumcategory_thread($_GET['content'],$_GET['id']); // note: this has to be cleaned first |
||||
} |
||||
if ($_GET['action']=='move' and isset($_GET['thread'])) |
||||
{ |
||||
$message=move_thread_form(); |
||||
} |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Is the user allowed here? |
||||
----------------------------------------------------------- |
||||
*/ |
||||
// if the user is not a course administrator and the forum is hidden |
||||
// then the user is not allowed here. |
||||
if (!api_is_allowed_to_edit() AND ($current_forum_category['visibility']==0 OR $current_forum['visibility']==0)) |
||||
{ |
||||
forum_not_allowed_here(); |
||||
} |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Display the action messages |
||||
----------------------------------------------------------- |
||||
*/ |
||||
if (isset($message)) |
||||
{ |
||||
Display :: display_confirmation_message($message); |
||||
} |
||||
|
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Action Links |
||||
----------------------------------------------------------- |
||||
*/ |
||||
echo '<span style="float:right;">'.search_link().'</span>'; |
||||
// The link should appear when |
||||
// 1. the course admin is here |
||||
// 2. the course member is here and new threads are allowed |
||||
// 3. a visitor is here and new threads AND allowed AND anonymous posts are allowed |
||||
if (api_is_allowed_to_edit() 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 '<a href="newthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).$origin_string.'">'.Display::return_icon('forumthread_new.gif').' '.get_lang('NewTopic').'</a>'; |
||||
} |
||||
else |
||||
{ |
||||
echo get_lang('ForumLocked'); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
----------------------------------------------------------- |
||||
Display |
||||
----------------------------------------------------------- |
||||
*/ |
||||
echo "<table class=\"data_table\" width='100%'>\n"; |
||||
|
||||
// the current forum |
||||
if($origin != 'learnpath') |
||||
{ |
||||
echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"7\">"; |
||||
echo '<span class="forum_title">'.prepare4display($current_forum['forum_title']).'</span>'; |
||||
|
||||
if (!empty ($current_forum['forum_comment'])) |
||||
{ |
||||
echo '<br><span class="forum_description">'.prepare4display($current_forum['forum_comment']).'</span>'; |
||||
} |
||||
|
||||
if (!empty ($current_forum_category['cat_title'])) |
||||
{ |
||||
echo '<br /><span class="forum_low_description">'.prepare4display($current_forum_category['cat_title'])."</span><br />"; |
||||
} |
||||
|
||||
echo "</th>\n"; |
||||
echo "\t</tr>\n"; |
||||
} |
||||
|
||||
echo "</th>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// The column headers (to do: make this sortable) |
||||
echo "\t<tr class=\"forum_threadheader\">\n"; |
||||
echo "\t\t<td></td>\n"; |
||||
echo "\t\t<td>".get_lang('Title')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Replies')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Views')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('Author')."</td>\n"; |
||||
echo "\t\t<td>".get_lang('LastPost')."</td>\n"; |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo "\t\t<td>".get_lang('Actions')."</td>\n"; |
||||
} |
||||
echo "\t</tr>\n"; |
||||
|
||||
// getting al the threads |
||||
$threads=get_threads($_GET['forum']); // note: this has to be cleaned first |
||||
|
||||
$whatsnew_post_info=$_SESSION['whatsnew_post_info']; |
||||
|
||||
$counter=0; |
||||
if(is_array($threads)) |
||||
{ |
||||
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() OR !($row['thread_replies']=='0' AND $row['visible']=='0')) |
||||
{ |
||||
if($counter%2==0) |
||||
{ |
||||
$class="row_odd"; |
||||
} |
||||
else |
||||
{ |
||||
$class="row_even"; |
||||
} |
||||
echo "\t<tr class=\"$class\">\n"; |
||||
echo "\t\t<td>"; |
||||
if (is_array($whatsnew_post_info[$_GET['forum']][$row['thread_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']])) |
||||
{ |
||||
echo icon('../img/forumthread.gif'); |
||||
} |
||||
else |
||||
{ |
||||
echo icon('../img/forumthread.gif'); |
||||
} |
||||
|
||||
if ($row['thread_sticky']==1) |
||||
{ |
||||
echo icon('../img/exclamation.gif'); |
||||
} |
||||
echo "</td>\n"; |
||||
echo "\t\t<td>"; |
||||
echo "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".$row['thread_id'].$origin_string."&search=".Security::remove_XSS(urlencode($_GET['search']))."\" ".class_visible_invisible($row['visibility']).">".prepare4display($row['thread_title'])."</a></td>\n"; |
||||
echo "\t\t<td>".$row['thread_replies']."</td>\n"; |
||||
if ($row['user_id']=='0') |
||||
{ |
||||
$name=prepare4display($row['thread_poster_name']); |
||||
} |
||||
else |
||||
{ |
||||
$name=$row['firstname'].' '.$row['lastname']; |
||||
} |
||||
echo "\t\t<td>".$row['thread_views']."</td>\n"; |
||||
|
||||
if ($row['last_poster_user_id']=='0') |
||||
{ |
||||
$name=$row['poster_name']; |
||||
} |
||||
else |
||||
{ |
||||
$name=$row['last_poster_firstname'].' '.$row['last_poster_lastname']; |
||||
} |
||||
|
||||
if($origin != 'learnpath') |
||||
{ |
||||
echo "\t\t<td>".display_user_link($row['user_id'], $name)."</td>\n"; |
||||
} |
||||
else |
||||
{ |
||||
echo "\t\t<td>".$name."</td>\n"; |
||||
} |
||||
|
||||
// if the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread |
||||
if (($row['visible']=='1' OR api_is_allowed_to_edit()) && $origin!='learnpath') |
||||
{ |
||||
$last_post=$row['thread_date']." ".get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name); |
||||
} |
||||
else if($origin!='learnpath') |
||||
{ |
||||
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC"; |
||||
$last_post_result=api_sql_query($last_post_sql, __LINE__, __FILE__); |
||||
$last_post_row=mysql_fetch_array($last_post_result); |
||||
$name=$last_post_row['firstname'].' '.$last_post_row['lastname']; |
||||
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name); |
||||
} |
||||
else |
||||
{ |
||||
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC"; |
||||
$last_post_result=api_sql_query($last_post_sql, __LINE__, __FILE__); |
||||
$last_post_row=mysql_fetch_array($last_post_result); |
||||
$name=$last_post_row['firstname'].' '.$last_post_row['lastname']; |
||||
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.$name; |
||||
} |
||||
echo "\t\t<td>".$last_post."</td>\n"; |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo "\t\t<td>"; |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&action=delete&content=thread&id=".$row['thread_id'].$origin_string."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeleteCompleteThread"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>"; |
||||
display_visible_invisible_icon('thread', $row['thread_id'], $row['visibility'], array("forum"=>$_GET['forum'],'origin'=>$origin)); |
||||
display_lock_unlock_icon('thread',$row['thread_id'], $row['locked'], array("forum"=>$_GET['forum'],'origin'=>$origin)); |
||||
echo "<a href=\"viewforum.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&action=move&thread=".$row['thread_id'].$origin_string."\">".icon('../img/deplacer_fichier.gif',get_lang('MoveThread'))."</a>"; |
||||
echo "</td>\n"; |
||||
} |
||||
echo "\t</tr>\n"; |
||||
} |
||||
$counter++; |
||||
|
||||
|
||||
} |
||||
} |
||||
|
||||
echo "</table>"; |
||||
|
||||
/* |
||||
============================================================================== |
||||
FOOTER |
||||
============================================================================== |
||||
*/ |
||||
if($origin != 'learnpath') |
||||
{ |
||||
Display :: display_footer(); |
||||
} |
||||
?> |
||||
|
||||
|
||||
|
||||
|
@ -1,189 +1,186 @@ |
||||
<?php |
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2006 Dokeos S.A. |
||||
Copyright (c) 2006 Ghent University (UGent) |
||||
|
||||
For a full list of contributors, see "credits.txt". |
||||
The full license can be read in "license.txt". |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium |
||||
Mail: info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
/** |
||||
************************************************************************** |
||||
* IMPORTANT NOTICE |
||||
* Please do not change anything is this code yet because there are still |
||||
* some significant code that need to happen and I do not have the time to |
||||
* merge files and test it all over again. So for the moment, please do not |
||||
* touch the code |
||||
* -- Patrick Cool <patrick.cool@UGent.be> |
||||
************************************************************************** |
||||
*/ |
||||
|
||||
$rows=get_posts($current_thread['thread_id']); |
||||
|
||||
|
||||
|
||||
foreach ($rows as $row) |
||||
{ |
||||
echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">\n"; |
||||
// the style depends on the status of the message: approved or not |
||||
if ($row['visible']=='0') |
||||
{ |
||||
$titleclass='forum_message_post_title_2_be_approved'; |
||||
$messageclass='forum_message_post_text_2_be_approved'; |
||||
$leftclass='forum_message_left_2_be_approved'; |
||||
} |
||||
else |
||||
{ |
||||
$titleclass='forum_message_post_title'; |
||||
$messageclass='forum_message_post_text'; |
||||
$leftclass='forum_message_left'; |
||||
} |
||||
|
||||
echo "\t<tr>\n"; |
||||
echo "\t\t<td rowspan=\"3\" class=\"$leftclass\">"; |
||||
if ($row['user_id']=='0') |
||||
{ |
||||
$name=prepare4display($row['poster_name']); |
||||
} |
||||
else |
||||
{ |
||||
$name=$row['firstname'].' '.$row['lastname']; |
||||
<?php |
||||
/* |
||||
============================================================================== |
||||
Dokeos - elearning and course management software |
||||
|
||||
Copyright (c) 2008 Dokeos SPRL |
||||
Copyright (c) 2006 Ghent University (UGent) |
||||
|
||||
For a full list of contributors, see "credits.txt". |
||||
The full license can be read in "license.txt". |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium |
||||
Mail: info@dokeos.com |
||||
============================================================================== |
||||
*/ |
||||
|
||||
/** |
||||
* These files are a complete rework of the forum. The database structure is |
||||
* based on phpBB but all the code is rewritten. A lot of new functionalities |
||||
* are added: |
||||
* - forum categories and forums can be sorted up or down, locked or made invisible |
||||
* - consistent and integrated forum administration |
||||
* - forum options: are students allowed to edit their post? |
||||
* moderation of posts (approval) |
||||
* reply only forums (students cannot create new threads) |
||||
* multiple forums per group |
||||
* - sticky messages |
||||
* - new view option: nested view |
||||
* - quoting a message |
||||
* |
||||
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University |
||||
* @Copyright Ghent University |
||||
* @Copyright Patrick Cool |
||||
* |
||||
* @package dokeos.forum |
||||
*/ |
||||
|
||||
/** |
||||
************************************************************************** |
||||
* IMPORTANT NOTICE |
||||
* Please do not change anything is this code yet because there are still |
||||
* some significant code that need to happen and I do not have the time to |
||||
* merge files and test it all over again. So for the moment, please do not |
||||
* touch the code |
||||
* -- Patrick Cool <patrick.cool@UGent.be> |
||||
************************************************************************** |
||||
*/ |
||||
|
||||
$rows=get_posts($current_thread['thread_id']); |
||||
|
||||
|
||||
|
||||
foreach ($rows as $row) |
||||
{ |
||||
echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">\n"; |
||||
// the style depends on the status of the message: approved or not |
||||
if ($row['visible']=='0') |
||||
{ |
||||
$titleclass='forum_message_post_title_2_be_approved'; |
||||
$messageclass='forum_message_post_text_2_be_approved'; |
||||
$leftclass='forum_message_left_2_be_approved'; |
||||
} |
||||
else |
||||
{ |
||||
$titleclass='forum_message_post_title'; |
||||
$messageclass='forum_message_post_text'; |
||||
$leftclass='forum_message_left'; |
||||
} |
||||
|
||||
echo "\t<tr>\n"; |
||||
echo "\t\t<td rowspan=\"3\" class=\"$leftclass\">"; |
||||
if ($row['user_id']=='0') |
||||
{ |
||||
$name=prepare4display($row['poster_name']); |
||||
} |
||||
else |
||||
{ |
||||
$name=$row['firstname'].' '.$row['lastname']; |
||||
} |
||||
if($origin!='learnpath') |
||||
{ |
||||
|
||||
if (api_get_course_setting('allow_user_image_forum')) { |
||||
echo '<br />'.display_user_image($row['user_id'],$name).'<br />'; |
||||
} |
||||
|
||||
{ |
||||
|
||||
if (api_get_course_setting('allow_user_image_forum')) { |
||||
echo '<br />'.display_user_image($row['user_id'],$name).'<br />'; |
||||
} |
||||
|
||||
echo display_user_link($row['user_id'], $name).'<br />'; |
||||
} |
||||
else |
||||
{ |
||||
echo $name. '<br />'; |
||||
} |
||||
echo $row['post_date'].'<br /><br />'; |
||||
// 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 (($current_forum['allow_edit']==1 AND $row['user_id']==$_user['user_id']) or api_is_allowed_to_edit()) |
||||
{ |
||||
echo "<a href=\"editpost.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".Security::remove_XSS($_GET['thread'])."&post=".$row['post_id']."&origin=".$origin."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>\n"; |
||||
} |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".Security::remove_XSS($_GET['thread'])."&action=delete&content=post&id=".$row['post_id']."&origin=".$origin."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeletePost"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>\n"; |
||||
display_visible_invisible_icon('post', $row['post_id'], $row['visible'],array('forum'=>Security::remove_XSS($_GET['forum']),'thread'=>Security::remove_XSS($_GET['thread']), 'origin'=>$origin )); |
||||
echo "\n"; |
||||
echo "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".Security::remove_XSS($_GET['thread'])."&action=move&post=".$row['post_id']."&origin=".$origin."\">".icon('../img/deplacer_fichier.gif',get_lang('MovePost'))."</a>"; |
||||
} |
||||
echo '<br /><br />'; |
||||
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) |
||||
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit()) |
||||
{ |
||||
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) |
||||
{ |
||||
echo '<a href="reply.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&post='.$row['post_id'].'&action=replymessage&origin='.$origin.'">'.get_lang('ReplyToMessage').'</a><br />'; |
||||
echo '<a href="reply.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&post='.$row['post_id'].'&action=quote&origin='.$origin.'">'.get_lang('QuoteMessage').'</a><br /><br />'; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
if ($current_forum_category['locked']==1) |
||||
{ |
||||
echo get_lang('ForumcategoryLocked').'<br />'; |
||||
} |
||||
if ($current_forum['locked']==1) |
||||
{ |
||||
echo get_lang('ForumLocked').'<br />'; |
||||
} |
||||
if ($current_thread['locked']==1) |
||||
{ |
||||
echo get_lang('ThreadLocked').'<br />'; |
||||
} |
||||
} |
||||
echo "</td>\n"; |
||||
// show the |
||||
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']])) |
||||
{ |
||||
$post_image=icon('../img/forumpostnew.gif'); |
||||
} |
||||
else |
||||
{ |
||||
$post_image=icon('../img/forumpost.gif'); |
||||
} |
||||
if ($row['post_notification']=='1' AND $row['poster_id']==$_user['user_id']) |
||||
{ |
||||
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified')); |
||||
} |
||||
// The post title |
||||
echo "\t\t<td class=\"$titleclass\">".prepare4display($row['post_title'])."</td>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// The post message |
||||
echo "\t<tr>\n"; |
||||
echo "\t\t<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// The added resources |
||||
/* |
||||
echo "<tr><td>"; |
||||
if (check_added_resources("forum_post", $row["post_id"])) |
||||
{ |
||||
|
||||
echo "<i>".get_lang("AddedResources")."</i><br/>"; |
||||
if ($row['visible']=='0') |
||||
{ |
||||
$addedresource_style="invisible"; |
||||
} |
||||
display_added_resources("forum_post", $row["post_id"], $addedresource_style); |
||||
|
||||
} |
||||
echo "</td></tr>"; |
||||
*/ |
||||
|
||||
|
||||
|
||||
// The post has been displayed => it can be removed from the what's new array |
||||
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]); |
||||
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]); |
||||
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]); |
||||
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]); |
||||
echo "</table>"; |
||||
} |
||||
|
||||
?> |
||||
} |
||||
echo $row['post_date'].'<br /><br />'; |
||||
// 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 (($current_forum['allow_edit']==1 AND $row['user_id']==$_user['user_id']) or api_is_allowed_to_edit()) |
||||
{ |
||||
echo "<a href=\"editpost.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".Security::remove_XSS($_GET['thread'])."&post=".$row['post_id']."&origin=".$origin."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>\n"; |
||||
} |
||||
if (api_is_allowed_to_edit()) |
||||
{ |
||||
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".Security::remove_XSS($_GET['thread'])."&action=delete&content=post&id=".$row['post_id']."&origin=".$origin."\" onclick=\"javascript:if(!confirm('".addslashes(htmlentities(get_lang("DeletePost"),ENT_QUOTES,$charset))."')) return false;\">".icon('../img/delete.gif',get_lang('Delete'))."</a>\n"; |
||||
display_visible_invisible_icon('post', $row['post_id'], $row['visible'],array('forum'=>Security::remove_XSS($_GET['forum']),'thread'=>Security::remove_XSS($_GET['thread']), 'origin'=>$origin )); |
||||
echo "\n"; |
||||
echo "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".Security::remove_XSS($_GET['thread'])."&action=move&post=".$row['post_id']."&origin=".$origin."\">".icon('../img/deplacer_fichier.gif',get_lang('MovePost'))."</a>"; |
||||
} |
||||
echo '<br /><br />'; |
||||
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) |
||||
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit()) |
||||
{ |
||||
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) |
||||
{ |
||||
echo '<a href="reply.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&post='.$row['post_id'].'&action=replymessage&origin='.$origin.'">'.get_lang('ReplyToMessage').'</a><br />'; |
||||
echo '<a href="reply.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&post='.$row['post_id'].'&action=quote&origin='.$origin.'">'.get_lang('QuoteMessage').'</a><br /><br />'; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
if ($current_forum_category['locked']==1) |
||||
{ |
||||
echo get_lang('ForumcategoryLocked').'<br />'; |
||||
} |
||||
if ($current_forum['locked']==1) |
||||
{ |
||||
echo get_lang('ForumLocked').'<br />'; |
||||
} |
||||
if ($current_thread['locked']==1) |
||||
{ |
||||
echo get_lang('ThreadLocked').'<br />'; |
||||
} |
||||
} |
||||
echo "</td>\n"; |
||||
// show the |
||||
if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$row['thread_id']])) |
||||
{ |
||||
$post_image=icon('../img/forumpostnew.gif'); |
||||
} |
||||
else |
||||
{ |
||||
$post_image=icon('../img/forumpost.gif'); |
||||
} |
||||
if ($row['post_notification']=='1' AND $row['poster_id']==$_user['user_id']) |
||||
{ |
||||
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified')); |
||||
} |
||||
// The post title |
||||
echo "\t\t<td class=\"$titleclass\">".prepare4display($row['post_title'])."</td>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// The post message |
||||
echo "\t<tr>\n"; |
||||
echo "\t\t<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>\n"; |
||||
echo "\t</tr>\n"; |
||||
|
||||
// The check if there is an attachment |
||||
$attachment_list=get_attachment($row['post_id']); |
||||
|
||||
if (!empty($attachment_list)) |
||||
{ |
||||
echo '<tr><td height="50%">'; |
||||
$realname=$attachment_list['path']; |
||||
$user_filename=$attachment_list['filename']; |
||||
|
||||
echo Display::return_icon('attachment.gif',get_lang('attachment')); |
||||
echo '<a href="download.php?file='; |
||||
echo $realname; |
||||
echo ' "> '.$user_filename.' </a>'; |
||||
echo '<span class="forum_attach_comment" >'.$attachment_list['comment'].'</span><br />'; |
||||
echo '</td></tr>'; |
||||
} |
||||
|
||||
// The post has been displayed => it can be removed from the what's new array |
||||
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]); |
||||
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']]); |
||||
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]); |
||||
unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']]); |
||||
echo "</table>"; |
||||
} |
||||
?> |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue