This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
MatritumCantat_Web/www/components/com_simpleboard/thread.php

163 lines
8.4 KiB
PHP
Raw Permalink Normal View History

<?php
//
// Copyright (C) 2003 Jan de Graaff
// All rights reserved.
//
// This program uses parts of the original Simpleboard Application
// 0.7.0b written by Josh Levine; http://www.joshlevine.net
//
// This source file is part of the SimpleBoard Component, a Mambo 4.5
// custom Component By Jan de Graaff - http://tsmf.jigsnet.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please note that the GPL states that any headers in files and
// Copyright notices as well as credits in headers, source files
// and output (screens, prints, etc.) can not be removed.
// You can extend them with your own credits, though...
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
// Dont allow direct linking
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $simpleboardPath;
// arrows and lines
$join = "<img src=\"$sbs/tree-join.gif\" width=\"12\" height=\"18\" alt=\"thread link\" />";
$end = "<img src=\"$sbs/tree-end.gif\" width=\"12\" height=\"18\" alt=\"thread link\" />";
$blank = "<img src=\"$sbs/tree-blank.gif\" width=\"12\" height=\"18\" alt=\"thread link\" />";
$vert = "<img src=\"$sbs/tree-vert.gif\" width=\"12\" height=\"18\" alt=\"thread link\" />";
$loc_emoticons=$sbs.'/emoticons';
// topic emoticons
$topic_emoticons=array();
$topic_emoticons[0]=$sbs.'/emoticons/default.gif';
$topic_emoticons[1]=$sbs.'/emoticons/exclam.gif';
$topic_emoticons[2]=$sbs.'/emoticons/question.gif';
$topic_emoticons[3]=$sbs.'/emoticons/arrow.gif';
$topic_emoticons[4]=$sbs.'/emoticons/love.gif';
$topic_emoticons[5]=$sbs.'/emoticons/grin.gif';
$topic_emoticons[6]=$sbs.'/emoticons/shock.gif';
$topic_emoticons[7]=$sbs.'/emoticons/smile.gif';
$c=0;
function thread_flat(&$tree,&$leaves,$branchid=0,$level=0)
{
global $c;
foreach($leaves[$branchid] as $leaf)
{
$leaf->level=$level;
$tree[]=$leaf;
$c++;
if (is_array($leaves[$leaf->id]))
thread_flat($tree,$leaves,$leaf->id,$level+1);
}
return $tree;
}
$tree=thread_flat($tree,$messages);
?>
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="contentpane">
<tr>
<?php if ($sbConfig['showNew'] && $my->id !=0){echo '<td width="10" class="sectiontableheader">&nbsp;</td>';}?>
<td class="sectiontableheader" align="center" width="5">&nbsp;</td>
<td class="sectiontableheader" align="center" width="5">&nbsp;</td>
<?php if ( $my_id == 0 ) { echo '<td class="sectiontableheader" width="5" align="center">&nbsp;</td>';} ?>
<td class="sectiontableheader" width="60%" align="center"><strong><?php echo _GEN_TOPICS;?></strong></td>
<td class="sectiontableheader" width="15%" align="center"><strong><?php echo _GEN_AUTHOR;?></strong></td>
<td class="sectiontableheader" align="center"><strong><?php echo _GEN_DATE;?></strong></td>
</tr>
<?php foreach($tree as $leaf) {
$leaf->name=htmlspecialchars($leaf->name);
$leaf->subject=htmlspecialchars($leaf->subject);
$leaf->email=htmlspecialchars($leaf->email);
//get all html out of the subject & email & name before posting:
?>
<tr>
<?php
if ($sbConfig['showNew'] && $my->id !=0 && ! $leaf->moved ){
if (($prevCheck<($leaf->time)) && (sizeof($read_topics) == 0) || !in_array($leaf->thread, $read_topics)) {
//new post
echo '<td width="1%" class="sb_new">';
echo $sbIcons['unreadmessage'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['unreadmessage'].'" border="0" alt="'._GEN_UNREAD.'" title="'._GEN_UNREAD.'"/>' : $sbConfig['newChar'];
echo '</td>';
}else{
//not new posts
echo '<td width="1%" class="sb_notnew">';
echo $sbIcons['readmessage'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['readmessage'].'" border="0" alt="'._GEN_NOUNREAD.'" title="'._GEN_NOUNREAD.'"/>' : $sbConfig['newChar'];
echo '</td>';
}
} else {
echo '<td>&nbsp;</td>';
}?>
<td align="center" width="5"
<?php echo $leaf->id==$id?" class=\"sectiontableentry2\">":">";
if ($leaf->ordering==0)
{
if($leaf->locked==0)
{
echo "&nbsp;";
}
else
{
echo $sbIcons['topiclocked'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['topiclocked'].'" border="0" alt="'._GEN_LOCKED_TOPIC.'" title="'._GEN_LOCKED_TOPIC.'" />' : '<img src="'.$sbs.'/emoticons/lock.gif" width="15" height="15" alt="'._GEN_LOCKED_TOPIC.'" />';
$topicLocked=1;
}
}
else
{
echo $sbIcons['topicsticky'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['topicsticky'].'" border="0" alt="'._GEN_ISSTICKY.'" title="'._GEN_ISSTICKY.'" />' : '<img src="'.$sbs.'/emoticons/pushpin.gif" width="15" height="15" alt="'._GEN_ISSTICKY.'" />';
$topicSticky=1;
}
?>
</td>
<td align="center" width="5" <?php echo $leaf->id==$id?" class=\"sectiontableentry2\"":"";?>><?php echo $leaf->topic_emoticon==0?"<img src=\"$sbs/tree-blank.gif\" width=\"15\" height=\"15\" alt=\"thread link\" />":"<img src=\"".$topic_emoticons[$leaf->topic_emoticon]."\" alt=\"emo\" />";?></td>
<td<?php echo $leaf->id==$id?" class=\"sectiontableentry2\"":"";?>>
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td<?php echo $leaf->id==$id?" class=\"sectiontableentry2\"":"";?>><?php
$array[$leaf->level + 1] = count($messages[$leaf->id]);
$array[$leaf->level]--;
for ($i = 0; $i < $leaf->level; $i++) {
if ($array[$i] > 0) echo($vert);
elseif ($array[$i] == 0) echo($blank);
}
if ($array[$leaf->level] > 0) echo($join);
elseif ($array[$leaf->level] == 0 && $leaf->parent != 0) echo($end);
//else echo($blank);
?></td>
<?php
$newURL="index.php?option=com_simpleboard&amp;Itemid=$Itemid&amp;func=view&amp;"; //init
if ($leaf->moved) {
$database->setQuery("SELECT `message` FROM #__sb_messages_text WHERE `mesid`='".$leaf->id."'");
$newURL.=$database->loadResult();
}
else
$newURL.='id='.$leaf->id.$viewstr.'&amp;catid='.$catid;
$newURL=sefRelToAbs($newURL);
//sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&amp;id='.$leaf->id.$viewstr.'&amp;catid='.$catid);
?>
<td<?php echo $leaf->id==$id?" class=\"sectiontableentry2\"":"";?>><a href="<?php echo $newURL; ?>"><?php echo stripslashes($leaf->subject);?></a></td>
</tr></table>
</td>
<td align="center" <?php echo $leaf->id==$id?' class="sectiontableentry2"':'';?>><small><?php echo $leaf->email!=""&&$my_id>0&&$sbConfig['showemail']=='1'?'<a href="mailto:'.stripslashes($leaf->email).'">'.stripslashes($leaf->name).'</a>':stripslashes($leaf->name);?></small></td>
<td align="center" <?php echo $leaf->id==$id?' class="sectiontableentry2"':'';?>><small><?php echo $leaf->moved ? date(_DATETIME , $leaf->time) :date(_DATETIME , $leaf->time);?></small></td>
</tr>
<?php } ?>
</table>