<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );
// Get the configuration. This will tell Mambo where SMF is, and some integration settings
$database->setQuery("
SELECT `variable`, `value1`
FROM #__smf_config
");
$variables = $database->loadAssocList();
foreach ($variables as $variable){
$variable_name = $variable['variable'];
$$variable_name = $variable['value1'];
}
if (!defined('SMF'))
{
require_once($smf_path . '/SSI.php');
}
global $context, $txt, $scripturl, $mosConfig_dbprefix, $settings, $mosConfig_db, $db_name;
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );
$numposts = $params->get( 'numposts' );
$showboard = $params->get( 'showboard' );
$showdate = $params->get( 'showdate' );
$display = $params->get( 'display' );
$postline = $params->get( 'postline' );
$sublength = $params->get( 'sublength' );
$exclude = $params->get( 'exclude' );
if ($exclude=="") $exclude="0";
mysql_select_db($mosConfig_db);
$sql = "SELECT id FROM ".$mosConfig_dbprefix."menu WHERE link='index.php?option=com_smf'";
$result = mysql_query ($sql);
$row = mysql_fetch_array($result);
$myurl = $mosConfig_live_site."/".basename($_SERVER['PHP_SELF']) . "?option=com_smf&Itemid=" . $row[0]."&";
$scripturl = $myurl;
mysql_select_db($db_name);
$exclude_boards = explode(",", $exclude);
$array = ssi_recentPosts($numposts, $exclude_boards, 'array');
switch ($display)
{
case 0:
echo '<table border="0" class="', $moduleclass_sfx ,'">';
foreach ($array as $post) {
$post['subject'] = strlen(un_htmlspecialchars($post['subject'])) > ($sublength+3) ? htmlspecialchars(substr(un_htmlspecialchars($post['subject']), 0, $sublength) . '...') : $post['subject'];
echo '<tr>';
if ($showboard==1) echo '<td align="right" valign="top" nowrap="nowrap">[', $post['board']['link'], ']</td>';
echo '<td valign="top"><a href="', $post['href'], '">', $post['subject'], '</a> ';
if ($postline==1) echo '<br />';
echo $txt[525], ' ', $post['poster']['link'], ' ', $post['new'] ? ' ' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '</td>';
if ($showdate==1) echo '<td align="right" valign="top" nowrap="nowrap">', $post['time'], '</td>';
echo'</tr>';
}
echo '</table>';
break;
case 1:
echo '<table border="0" class="', $moduleclass_sfx ,'">';
foreach ($array as $post) {
if ($showboard==1) echo '<tr><td align="right" valign="top" nowrap="nowrap">[', $post['board']['link'], ']</td></tr>';
echo '<tr><td valign="top"><a href="', $post['href'], '">', $post['subject'], '</a> ';
if ($postline==1) echo '</td></tr><tr><td>';
echo $txt[525], ' ', $post['poster']['link'], ' ', $post['new'] ? ' ' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '</td></tr>';
if ($showdate==1) echo '<tr><td align="right" nowrap="nowrap">', $post['time'], '</td></tr>';
}
echo '</table>';
break;
case 2:
echo '<ul class="', $moduleclass_sfx ,'">';
foreach ($array as $post) {
if ($showboard==1) echo '<li>[', $post['board']['link'], ']';
echo '<li><a href="', $post['href'], '">', $post['subject'], '</a> ';
if ($postline==1) echo '<li> ';
echo $txt[525], ' ', $post['poster']['link'], ' ', $post['new'] ? ' ' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>';
if ($showdate==1) echo '<li>', $post['time'];
}
echo '</ul>';
break;
}
mysql_select_db($mosConfig_db);
?>