вот файлик Forum.PHP
IPB 3.3.4
<?php
if(!defined('DATALIFEENGINE')) {
die("Hacking attempt!");
}
require_once (ENGINE_DIR . '/data/conf_la2.php');
require_once (ENGINE_DIR . '/data/conf_la2_control.php');
$cachedir = ENGINE_DIR . '/la2/cache/';
$cachetime = $conf_la2_control['cache_time'];
$cachetime = $cachetime*60;
$url777=$GLOBALS['REQUEST_URI'];
$crc777=md5($url777);
$modif=time()-@filemtime ($cachedir."forum");
if ($modif<$cachetime)
{
include ($cachedir."forum");
$tpl->load_template($tpldir.'/la2/forum.tpl');
$tpl->set ("{la2forum}", $messf);
$tpl->compile('la2forum');
$la2forum = $tpl->result["la2forum"];
}
else
{
$mysql_ipf = $conf_la2['mysql_f_ip'];
$mysql_portf = $conf_la2['mysql_f_port'];
$mysql_ipf = $mysql_ipf.":".$mysql_portf;
$mysql_userf = $conf_la2['mysql_f_user'];
$mysql_passf = $conf_la2['mysql_f_pass'];
$mysql_basef = $conf_la2['mysql_f_base'];
$dbdbf = mysql_connect ($mysql_ipf, $mysql_userf, $mysql_passf);
mysql_select_db ($mysql_basef, $dbdbf);
if ($conf_la2['mysql_f_ver'] == ipb3 or $conf_la2['mysql_f_ver'] == ipb2)
{
$prefix = $conf_la2['mysql_f_prefix'];
$path = $conf_la2['mysql_f_path'];
$posts = $prefix."_posts";
$topics = $prefix."_topics";
$messf .= <<<HERE
<center>
Последние 10 ответов на форуме:
</center>
<table border='0' cellpadding='1' cellspacing='0'>
HERE;
$resultf = mysql_query("SELECT * FROM $posts ORDER BY post_date DESC LIMIT 10", $dbdbf);
$ipo = 0;
while($rowf = mysql_fetch_array($resultf))
{
$ipo++;
$topic_id = $rowf['topic_id'];
$resultf2 = mysql_query("SELECT * FROM $topics WHERE tid='$topic_id'", $dbdbf);
$rowf2 = mysql_fetch_array($resultf2);
$topicname = substr($rowf2['title'], 0, 10);
$topicname = $topicname."...";
if ($conf_la2['mysql_f_ver'] == ipb2)
{
$topicname = "<a href={$path}?showtopic={$rowf2[tid]} target=_blank>{$topicname}</a>";
}
else
{
$topicname = "<a href={$path}?/topic/{$rowf2[tid]}-{$rowf2[title]}/ target=_blank>{$topicname}</a>";
}
$author_name = $rowf['author_name'];
$author_name = substr($author_name, 0, 10);
$date = $rowf['post_date'];
$date = substr($date, 0, 10);
$date = getdate($date);
$datehours = $date['hours'];
$dateminutes = $date['minutes'];
$datemday = $date['mday'];
$datemonth = $date['month'];
$dateyear = $date['year'];
$messf .= <<<HERE
<tr align='center' >
<td><font size='1'>{$ipo}</font></td>
<td><font size='1'>{$topicname}</font></td>
<td><font size='1'>{$author_name}</font></td>
</tr>
<tr align='center'>
<td colspan=3><font size='1'>{$datehours}:{$dateminutes}, {$datemday} {$datemonth}, {$dateyear}</font></td>
</tr>
HERE;
}
$messf .= <<<HERE
</table>
HERE;
}
if ($conf_la2['mysql_f_ver'] == smf2)
{
$prefix = $conf_la2['mysql_f_prefix'];
$path = $conf_la2['mysql_f_path'];
$posts = $prefix."_messages";
$messf .= <<<HERE
<center>
Последние 10 ответов на форуме:
</center>
<table border='0' cellpadding='1' cellspacing='0'>
HERE;
$resultf = mysql_query("SELECT * FROM $posts ORDER BY poster_time DESC LIMIT 10", $dbdbf);
$ipo = 0;
while($rowf = mysql_fetch_array($resultf))
{
$ipo++;
$topic_id = $rowf['id_topic'];
$topic_id = $topic_id.".0";
$topicname = substr($rowf['subject'], 0, 10);
$topicname = $topicname."...";
$topicname = "<a href={$path}?topic={$topic_id} target=_blank>{$topicname}</a>";
$author_name = $rowf['poster_name'];
$author_name = substr($author_name, 0, 10);
$date = $rowf['poster_time'];
$date = substr($date, 0, 10);
$date = getdate($date);
$datehours = $date['hours'];
$dateminutes = $date['minutes'];
$datemday = $date['mday'];
$datemonth = $date['month'];
$dateyear = $date['year'];
$messf .= <<<HERE
<tr align='center' >
<td><font size='1'>{$ipo}</font></td>
<td><font size='1'>{$topicname}</font></td>
<td><font size='1'>{$author_name}</font></td>
</tr>
<tr align='center'>
<td colspan=3><font size='1'>{$datehours}:{$dateminutes}, {$datemday} {$datemonth}, {$dateyear}</font></td>
</tr>
HERE;
}
$messf .= <<<HERE
</table>
HERE;
}
if ($conf_la2['mysql_f_ver'] == vb4)
{
$prefix = $conf_la2['mysql_f_prefix'];
$path = $conf_la2['mysql_f_path'];
$posts = $prefix."_post";
$topics = $prefix."_thread";
$messf .= <<<HERE
<center>
Последние 10 ответов на форуме:
</center>
<table border='0' cellpadding='1' cellspacing='0'>
HERE;
$resultf = mysql_query("SELECT * FROM $posts ORDER BY dateline DESC LIMIT 10", $dbdbf);
$ipo = 0;
while($rowf = mysql_fetch_array($resultf))
{
$ipo++;
$topic_id = $rowf['threadid'];
$resultf2 = mysql_query("SELECT * FROM $topics WHERE threadid='$topic_id'", $dbdbf);
$rowf2 = mysql_fetch_array($resultf2);
$topicname = substr($rowf2['title'], 0, 10);
$topicname = $topicname."...";
$topicname = "<a href={$path}showthread.php?{$topic_id}-{$rowf2['title']} target=_blank>{$topicname}</a>";
$author_name = $rowf['username'];
$author_name = substr($author_name, 0, 10);
$date = $rowf['dateline'];
$date = substr($date, 0, 10);
$date = getdate($date);
$datehours = $date['hours'];
$dateminutes = $date['minutes'];
$datemday = $date['mday'];
$datemonth = $date['month'];
$dateyear = $date['year'];
$messf .= <<<HERE
<tr align='center' >
<td><font size='1'>{$ipo}</font></td>
<td><font size='1'>{$topicname}</font></td>
<td><font size='1'>{$author_name}</font></td>
</tr>
<tr align='center'>
<td colspan=3><font size='1'>{$datehours}:{$dateminutes}, {$datemday} {$datemonth}, {$dateyear}</font></td>
</tr>
HERE;
}
$messf .= <<<HERE
</table>
HERE;
}
if ($conf_la2['mysql_f_ver'] == phpbb3)
{
$prefix = $conf_la2['mysql_f_prefix'];
$path = $conf_la2['mysql_f_path'];
$posts = $prefix."_posts";
$topics = $prefix."_topics";
$users = $prefix."_users";
$messf .= <<<HERE
<center>
Последние 10 ответов на форуме:
</center>
<table border='0' cellpadding='1' cellspacing='0'>
HERE;
$resultf = mysql_query("SELECT * FROM $posts ORDER BY post_time DESC LIMIT 10", $dbdbf);
$ipo = 0;
while($rowf = mysql_fetch_array($resultf))
{
$ipo++;
$topic_id = $rowf['topic_id'];
$resultf2 = mysql_query("SELECT * FROM $topics WHERE topic_id='$topic_id'", $dbdbf);
$rowf2 = mysql_fetch_array($resultf2);
$topicname = substr($rowf2['topic_title'], 0, 10);
$topicname = $topicname."...";
$topicname = "<a href={$path}viewtopic.php?f={$rowf[forum_id]}&t={$rowf[topic_id]} target=_blank>{$topicname}</a>";
$poster_id = $rowf['poster_id'];
$resultf3 = mysql_query("SELECT * FROM $users WHERE user_id='$poster_id'", $dbdbf);
$rowf3 = mysql_fetch_array($resultf3);
$author_name = $rowf3['username'];
$author_name = substr($author_name, 0, 10);
$date = $rowf['post_time'];
$date = substr($date, 0, 10);
$date = getdate($date);
$datehours = $date['hours'];
$dateminutes = $date['minutes'];
$datemday = $date['mday'];
$datemonth = $date['month'];
$dateyear = $date['year'];
$messf .= <<<HERE
<tr align='center' >
<td><font size='1'>{$ipo}</font></td>
<td><font size='1'>{$topicname}</font></td>
<td><font size='1'>{$author_name}</font></td>
</tr>
<tr align='center'>
<td colspan=3><font size='1'>{$datehours}:{$dateminutes}, {$datemday} {$datemonth}, {$dateyear}</font></td>
</tr>
HERE;
}
$messf .= <<<HERE
</table>
HERE;
}
$tpl->load_template($tpldir.'/la2/forum.tpl');
$tpl->set ("{la2forum}", $messf);
$tpl->compile('la2forum');
$la2forum = $tpl->result["la2forum"];
$fp = @fopen ($cachedir."forum", "w");
@fwrite ($fp, "<?PHP \n\n\$messf = <<<HERE\n\n" );
@fwrite ($fp, $messf );
@fwrite ($fp, "\n\nHERE;\n\n?>" );
@fclose ($fp);
}
?>