More cleaning files removing \n and \t chars

skala
Julio Montoya 15 years ago
parent 4517e6ee3c
commit f1ed519ef5
  1. 8
      main/forum/viewthread.php
  2. 9
      main/forum/viewthread_flat.inc.php
  3. 26
      main/forum/viewthread_nested.inc.php
  4. 40
      main/forum/viewthread_threaded.inc.php

@ -73,8 +73,8 @@ if (!empty($_SESSION['toolgroup'])) {
$group_properties = GroupManager :: get_group_properties($session_toolgroup); $group_properties = GroupManager :: get_group_properties($session_toolgroup);
$interbreadcrumb[] = array("url"=>"../group/group.php", "name" => get_lang('Groups')); $interbreadcrumb[] = array("url"=>"../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array("url"=>"../group/group_space.php?gidReq=".$session_toolgroup, "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); $interbreadcrumb[] = array("url"=>"../group/group_space.php?gidReq=".$session_toolgroup, "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array("url"=>"viewforum.php?forum=".Security::remove_XSS($_GET['forum'])."&gidReq=".$session_toolgroup."&origin=".$origin."&search=".Security::remove_XSS(urlencode($my_search)),"name" => prepare4display($current_forum['forum_title'])); $interbreadcrumb[] = array("url"=>"viewforum.php?forum=".Security::remove_XSS($_GET['forum'])."&gidReq=".$session_toolgroup."&origin=".$origin."&search=".Security::remove_XSS(urlencode($my_search)),"name" => Security::remove_XSS($current_forum['forum_title']));
$interbreadcrumb[] = array("url"=>"viewthread.php?forum=".Security::remove_XSS($_GET['forum'])."&gradebook=".$gradebook."&thread=".Security::remove_XSS($_GET['thread']),"name" => prepare4display($current_thread['thread_title'])); $interbreadcrumb[] = array("url"=>"viewthread.php?forum=".Security::remove_XSS($_GET['forum'])."&gradebook=".$gradebook."&thread=".Security::remove_XSS($_GET['thread']),"name" => Security::remove_XSS($current_thread['thread_title']));
Display :: display_header(''); Display :: display_header('');
api_display_tool_title($nameTools); api_display_tool_title($nameTools);
@ -87,8 +87,8 @@ if (!empty($_SESSION['toolgroup'])) {
require_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php'; require_once api_get_path(INCLUDE_PATH).'reduced_header.inc.php';
} else { } else {
$interbreadcrumb[]=array("url" => "index.php?gradebook=$gradebook&search=".Security::remove_XSS(urlencode($my_search)),"name" => $nameTools); $interbreadcrumb[]=array("url" => "index.php?gradebook=$gradebook&search=".Security::remove_XSS(urlencode($my_search)),"name" => $nameTools);
$interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id']."&origin=".$origin."&search=".Security::remove_XSS(urlencode($my_search)),"name" => prepare4display($current_forum_category['cat_title'])); $interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id']."&origin=".$origin."&search=".Security::remove_XSS(urlencode($my_search)),"name" => Security::remove_XSS($current_forum_category['cat_title']));
$interbreadcrumb[]=array("url" => "viewforum.php?forum=".Security::remove_XSS($_GET['forum'])."&origin=".$origin."&search=".Security::remove_XSS(urlencode($my_search)),"name" => prepare4display($current_forum['forum_title'])); $interbreadcrumb[]=array("url" => "viewforum.php?forum=".Security::remove_XSS($_GET['forum'])."&origin=".$origin."&search=".Security::remove_XSS(urlencode($my_search)),"name" => Security::remove_XSS($current_forum['forum_title']));
$message = isset($message) ? $message : ''; $message = isset($message) ? $message : '';
// the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string // the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string
Display :: display_header(''); Display :: display_header('');

@ -1,7 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script manages the display of forum threads in flat view * This script manages the display of forum threads in flat view
* @copyright Julio Montoya <gugli100@gmail.com> UI Improvements + lots of bugfixes
* @package chamilo.forum * @package chamilo.forum
*/ */
//delete attachment file //delete attachment file
@ -14,7 +15,7 @@ if (isset($current_thread['thread_id'])){
$rows=get_posts($current_thread['thread_id']); $rows=get_posts($current_thread['thread_id']);
$increment=0; $increment=0;
foreach ($rows as $row) { foreach ($rows as $row) {
echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">"; echo '<table width="100%" class="post" cellspacing="5" border="0">';
// the style depends on the status of the message: approved or not // the style depends on the status of the message: approved or not
if ($row['visible']=='0') { if ($row['visible']=='0') {
$titleclass='forum_message_post_title_2_be_approved'; $titleclass='forum_message_post_title_2_be_approved';
@ -108,12 +109,12 @@ if (isset($current_thread['thread_id'])){
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified')); $post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified'));
} }
// The post title // The post title
echo "<td class=\"$titleclass\">".prepare4display(Security::remove_XSS($row['post_title'], STUDENT))."</td>"; echo "<td class=\"$titleclass\">".prepare4display($row['post_title'])."</td>";
echo "</tr>"; echo "</tr>";
// The post message // The post message
echo "<tr>"; echo "<tr>";
echo "<td class=\"$messageclass\">".prepare4display(Security::remove_XSS($row['post_text'], STUDENT))."</td>"; echo "<td class=\"$messageclass\">".prepare4display($row['post_text'])."</td>";
echo "</tr>"; echo "</tr>";
// The check if there is an attachment // The check if there is an attachment

@ -2,19 +2,17 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @Copyright Ghent University * @author Julio Montoya <gugli100@gmail.com> UI Improvements + lots of bugfixes
* @Copyright Patrick Cool * @copyright Ghent University
* * @package chamilo.forum
* @package dokeos.forum
*/ */
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
//are we in a lp ? //are we in a lp ?
$origin = ''; $origin = '';
if(isset($_GET['origin'])) if(isset($_GET['origin'])) {
{
$origin = Security::remove_XSS($_GET['origin']); $origin = Security::remove_XSS($_GET['origin']);
} }
@ -41,8 +39,8 @@ foreach ($rows as $post) {
$indent=$post['indent_cnt']*'20'; $indent=$post['indent_cnt']*'20';
echo "<div style=\"margin-left: ".$indent."px;\">"; echo "<div style=\"margin-left: ".$indent."px;\">";
echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">"; echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">";
echo "\t<tr>"; echo "<tr>";
echo "\t\t<td rowspan=\"3\" class=\"$leftclass\">"; echo "<td rowspan=\"3\" class=\"$leftclass\">";
if ($post['user_id']=='0') { if ($post['user_id']=='0') {
$name=$post['poster_name']; $name=$post['poster_name'];
} else { } else {
@ -108,13 +106,13 @@ foreach ($rows as $post) {
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified')); $post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified'));
} }
// The post title // The post title
echo "\t\t<td class=\"$titleclass\">".prepare4display(Security::remove_XSS($post['post_title'], STUDENT))."</td>"; echo "<td class=\"$titleclass\">".prepare4display($post['post_title'])."</td>";
echo "\t</tr>"; echo "</tr>";
// The post message // The post message
echo "\t<tr>"; echo "<tr>";
echo "\t\t<td class=\"$messageclass\">".prepare4display(Security::remove_XSS($post['post_text'], STUDENT))."</td>"; echo "<td class=\"$messageclass\">".prepare4display($post['post_text'])."</td>";
echo "\t</tr>"; echo "</tr>";
// The check if there is an attachment // The check if there is an attachment

@ -15,24 +15,12 @@
* - new view option: nested view * - new view option: nested view
* - quoting a message * - quoting a message
* *
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @Copyright Ghent University * @author Julio Montoya <gugli100@gmail.com> UI Improvements + lots of bugfixes
* @Copyright Patrick Cool
* *
* @package dokeos.forum * @package chamilo.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>
**************************************************************************
*/
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$rows = get_posts($_GET['thread']); // note: this has to be cleaned first $rows = get_posts($_GET['thread']); // note: this has to be cleaned first
@ -81,7 +69,7 @@ foreach ($rows as $post) {
$thread_structure.= $post_image; $thread_structure.= $post_image;
if ($_GET['post']==$post['post_id'] OR ($counter==1 AND !isset($_GET['post']))) if ($_GET['post']==$post['post_id'] OR ($counter==1 AND !isset($_GET['post'])))
{ {
$thread_structure.='<strong>'.prepare4display(Security::remove_XSS($post['post_title'],STUDENT)).'</strong></div>'; $thread_structure.='<strong>'.prepare4display($post['post_title']).'</strong></div>';
$prev_next_array[]=$post['post_id']; $prev_next_array[]=$post['post_id'];
} }
else else
@ -95,7 +83,7 @@ foreach ($rows as $post) {
$class=''; $class='';
} }
$count_loop=($count==0)?'&id=1' : ''; $count_loop=($count==0)?'&id=1' : '';
$thread_structure.= "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;post=".$post['post_id']."&amp;origin=$origin$count_loop\" $class>".prepare4display(Security::remove_XSS($post['post_title'],STUDENT))."</a></div>"; $thread_structure.= "<a href=\"viewthread.php?".api_get_cidreq()."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread'])."&amp;post=".$post['post_id']."&amp;origin=$origin$count_loop\" $class>".prepare4display($post['post_title'])."</a></div>";
$prev_next_array[]=$post['post_id']; $prev_next_array[]=$post['post_id'];
} }
$count++; $count++;
@ -173,16 +161,14 @@ else
$leftclass='forum_message_left'; $leftclass='forum_message_left';
} }
// --------------------------------------
// Displaying the message // Displaying the message
// --------------------------------------
// we mark the image we are displaying as set // we mark the image we are displaying as set
unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$rows[$display_post_id]['post_id']]); unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$rows[$display_post_id]['post_id']]);
echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">"; echo "<table width=\"100%\" class=\"post\" cellspacing=\"5\" border=\"0\">";
echo "\t<tr>"; echo "<tr>";
echo "\t\t<td rowspan=\"3\" class=\"$leftclass\">"; echo "<td rowspan=\"3\" class=\"$leftclass\">";
if ($rows[$display_post_id]['user_id']=='0') { if ($rows[$display_post_id]['user_id']=='0') {
$name=prepare4display($rows[$display_post_id]['poster_name']); $name=prepare4display($rows[$display_post_id]['poster_name']);
} else { } else {
@ -278,13 +264,13 @@ if ($rows[$display_post_id]['post_notification']=='1' AND $rows[$display_post_id
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified')); $post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified'));
} }
// The post title // The post title
echo "\t\t<td class=\"$titleclass\">".prepare4display(Security::remove_XSS($rows[$display_post_id]['post_title'], STUDENT))."</td>"; echo "<td class=\"$titleclass\">".prepare4display($rows[$display_post_id]['post_title'])."</td>";
echo "\t</tr>"; echo "</tr>";
// The post message // The post message
echo "\t<tr>"; echo "<tr>";
echo "\t\t<td class=\"$messageclass\">".prepare4display(Security::remove_XSS($rows[$display_post_id]['post_text'], STUDENT))."</td>"; echo "<td class=\"$messageclass\">".prepare4display($rows[$display_post_id]['post_text'])."</td>";
echo "\t</tr>"; echo "</tr>";
// The check if there is an attachment // The check if there is an attachment
$attachment_list = get_attachment($display_post_id); $attachment_list = get_attachment($display_post_id);
@ -312,8 +298,6 @@ 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']][$row['post_id']]);
echo "</table>"; echo "</table>";
// --------------------------------------
// Displaying the thread (structure) // Displaying the thread (structure)
// --------------------------------------
echo $thread_structure; echo $thread_structure;

Loading…
Cancel
Save