git-svn-id: https://192.168.0.254/svn/Proyectos.MatritumCantat_Web/trunk@2 8e3496fd-7892-4c45-be36-0ff06e9dacc6
159 lines
8.4 KiB
PHP
159 lines
8.4 KiB
PHP
<?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.' );
|
|
|
|
//get previous visit time from cookie; if there's no cookie yet, use database stored value
|
|
if ($settings[prevvisit]==0 && $previousVisit !=0)
|
|
{ $prevCheck= $previousVisit;}else{$prevCheck=$settings[prevvisit];}
|
|
|
|
//Start with determining which forums the user can see
|
|
$ResultSet ="";
|
|
if ($my->id > 0){
|
|
$database->setQuery("SELECT allowed FROM #__sb_sessions WHERE userid='".$my->id."'");
|
|
$ResultSet=$database->loadResult();
|
|
|
|
if ($ResultSet=="na"){
|
|
mosRedirect($mosConfig_live_site.'/index.php?option=com_simpleboard&Itemid='.$_GET['Itemid'].'&func=listcat',_LATEST_REDIRECT);
|
|
return;
|
|
}
|
|
//$allowed_forums = explode (',',$ResultSet);
|
|
}
|
|
|
|
else {
|
|
$database->setQuery("SELECT id FROM #__sb_categories WHERE pub_access='0'");
|
|
$allowed_forums=$database->loadObjectList();
|
|
foreach ($allowed_forums as $af) {
|
|
if ($ResultSet == "" ) {
|
|
$ResultSet = $af->id;
|
|
}
|
|
else {
|
|
$ResultSet = $ResultSet.','.$af->id;
|
|
}
|
|
}
|
|
}
|
|
//start the latest x
|
|
|
|
if ($sel=="0"){
|
|
$querytime=($prevCheck-1800); //move 30 minutes back to compensate for expired sessions
|
|
}else{
|
|
if (""==$sel){$sel=4;} //take 4 hours as default
|
|
//Time translation
|
|
$back_time=$sel*3600; //hours*(mins*secs)
|
|
$querytime=time()-$back_time;
|
|
}
|
|
// get all the threads with posts in the specified timeframe
|
|
$database->setQuery("SELECT a.thread, b.subject FROM #__sb_messages AS a LEFT JOIN #__sb_messages AS b ON a.thread=b.thread WHERE a.time >'$querytime' AND b.parent=0 AND a.catid IN ($ResultSet) AND a.moved != 1 GROUP BY a.thread ORDER BY a.time DESC LIMIT 100");
|
|
$resultSet=$database->loadObjectList();
|
|
$countRS=count($resultSet);
|
|
//check if $sel has a reasonable value and not a Unix timestamp:
|
|
$since=false;
|
|
if ($sel == "0") {$lastvisit=date(_DATETIME , $querytime); $since=true;}
|
|
?>
|
|
<link rel="stylesheet" href="components/com_simpleboard/template/<?php echo $sbConfig['template']; ?>/forum.css" type="text/css" />
|
|
<table border="0" width="100%">
|
|
<?php include ($sbp.'/searchbox.php');?>
|
|
<tr>
|
|
<td align="center">
|
|
<b><font size="2"><?php echo $board_title;?></font></b>
|
|
<?php echo $sbConfig['board_offline'] ? '<br /><font color="red">' ._FORUM_IS_OFFLINE. '</font>' : ' ' ;?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br />
|
|
<div align="center">
|
|
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid);?>">
|
|
<?php echo $sbIcons['home'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['home'].'" border=0 alt="'._HOME.'" />' : _HOME; ?>
|
|
</a>
|
|
<?php echo $sbIcons['help'] ?'':'| ';?><a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=faq');?>">
|
|
<?php echo $sbIcons['help'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['help'].'" border="0" alt="'._GEN_HELP.'" title="'._GEN_HELP.'"/>' : _GEN_HELP; ?>
|
|
</a>
|
|
<?php
|
|
if ( $sbConfig['enableRulesPage'] ) {
|
|
echo $sbIcons['rules'] ?'':'| ';
|
|
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=rules').'">';
|
|
echo $sbIcons['rules'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['RULES'].'" border=0 alt="'._GEN_RULES.'" title="'._GEN_RULES.'"/>' : _GEN_RULES;
|
|
echo '</a>';
|
|
}?>
|
|
</div>
|
|
<br />
|
|
|
|
<p align="center"><span class="contentheading"><?php if (!$since) {echo _SHOW_LAST_POSTS." $sel";} else {echo _SHOW_LAST_SINCE;} ?> <?php echo $lastvisit;?> <?php echo _SHOW_HOURS; ?> (<?php echo _SHOW_POSTS; ?><?php echo $countRS;?>)</span><br />
|
|
<?php echo _DESCRIPTION_POSTS; ?><br />
|
|
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=4'); ?>" ><?php echo _SHOW_4_HOURS; ?></a>
|
|
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=8'); ?>" ><?php echo _SHOW_8_HOURS; ?></a>
|
|
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=12'); ?>" ><?php echo _SHOW_12_HOURS; ?></a>
|
|
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=24'); ?>" ><?php echo _SHOW_24_HOURS; ?></a>
|
|
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=48'); ?>" ><?php echo _SHOW_48_HOURS; ?></a>
|
|
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=168'); ?>"><?php echo _SHOW_WEEK; ?></a>
|
|
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=latest&do=show&sel=0'); ?>"><?php echo _SHOW_LASTVISIT; ?></a>
|
|
</p>
|
|
<table border="0" cellspacing="0" cellpadding="3" width="100%" class="contentpane" style="text-align: left;">
|
|
<tr>
|
|
<td class="sectiontableheader" width="200"><?php echo _LATEST_THREADFORUM; ?></td>
|
|
<td class="sectiontableheader"><?php echo _LATEST_NUMBER; ?></td>
|
|
<td class="sectiontableheader"><?php echo _LATEST_AUTHOR; ?></td>
|
|
<td class="sectiontableheader"><?php echo _POSTED_AT; ?></td>
|
|
</tr><?php
|
|
if (0<$countRS) {
|
|
$tabclass = array("sectiontableentry1", "sectiontableentry2");
|
|
$k=0;//for alternating rows
|
|
foreach($resultSet as $rs) {
|
|
//get the latest post time for this thread
|
|
$database->setQuery("SELECT max(time) FROM #__sb_messages where thread=$rs->thread");
|
|
$latestPostTime=$database->loadResult();
|
|
//get the latest post itself
|
|
$result="";
|
|
$database->setQuery("SELECT a.id,a.name,a.catid,b.name as catname from #__sb_messages as a LEFT JOIN #__sb_categories as b on a.catid=b.id where a.time=$latestPostTime");
|
|
$database->loadObject($result);
|
|
$latestPostId=$result->id;
|
|
$latestPostName=$result->name;
|
|
$latestPostCatid=$result->catid;
|
|
$catname=$result->catname;
|
|
$database->setQuery("SELECT count(*) from #__sb_messages where time>'$querytime' and thread=$rs->thread");
|
|
$numberOfPosts=$database->loadResult();
|
|
$k= 1- $k;
|
|
echo "<tr>";
|
|
echo '<td class="'.$tabclass[$k].'" width="200"><a href="'. sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=view&catid='.$latestPostCatid.'&id='.$rs->thread).'#'.$latestPostId .'">'.htmlspecialchars(stripslashes($rs->subject)).'</a><br />'._GEN_FORUM.' : '.$catname.'</td>';
|
|
echo '<td class="'.$tabclass[$k].'">'.$numberOfPosts.'</td>';
|
|
echo "<td class=\"$tabclass[$k]\">".htmlspecialchars($latestPostName)."</td>";
|
|
echo "<td class=\"$tabclass[$k]\">".date(_DATETIME,$latestPostTime)."</td>";
|
|
echo "</tr>";
|
|
}
|
|
}
|
|
else {
|
|
echo "<tr><td colspan=\"3\" class=\"contentpane\"> "._NO_TIMEFRAME_POSTS." </td></tr>";
|
|
}
|
|
echo "</table>";
|
|
?>
|