SLAED CMS Integration [message #33238] |
Mon, 21 August 2006 06:11 |
HUNTERxp
Messages: 1 Registered: August 2006 Location: Russia, Perm
Karma:
|
Junior Member |
|
|
<?php
/*************************
FUD-Forum-Block for SLAED CMS
************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
********************************************
Author: Diamond & hu'NT'er.nCode a.k.a HUNTERxp
Contacts: mr(dot)diamx(at)gmail(dot)com & hunterxp(at)mail(dot)ru
Date: 2006-08-20 ( 20 Aug 2006)
**********************************************/
if (!defined('BLOCK_FILE')) {
Header("Location: ../index.php");
exit;
}
//Префикс таблиц FUD-форума (обычно fud26)
$prefix = fud26;
//Сколько тем выводить
$num = 10;
//Имя папки с картинками текущего скина
$img_path = 1;
//Формат времени
$time = 'd.m H:i';
//ВЫВОД ПОСЛЕДНИХ ТЕМ ФОРУМА
global $db;
$content .= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#333333\"><tr>";
$content .= "<th width=\"60%\" height=\"26\" align=\"center\"><font color=\"#FF9900\"><b>Заголовок темы</b></font></th>";
$content .= "<th width=\"10%\" height=\"26\" align=\"center\"><font color=\"#FF9900\"><b>Автор</b></font></th>";
$content .= "<th width=\"5%\" height=\"26\" align=\"center\"><img src=\"images/replies.gif\" border=\"0\" alt=\"Ответов\"></th>";
$content .= "<th width=\"5%\" height=\"26\" align=\"center\"><img src=\"images/views.gif\" border=\"0\" alt=\"Просмотров\"></th>";
$content .= "<th width=\"20%\" height=\"26\" align=\"center\" colspan=\"2\"><font color=\"#FF9900\"><b>Последний ответ</b></font></th></tr>";
$result = $db->sql_query("SELECT ".$prefix."_msg.id, login, replies, views, post_stamp, thread_id, poster_id, attach_cnt, root_msg_id FROM ".$prefix."_msg, ".$prefix."_users, ".$prefix."_thread WHERE (".$prefix."_msg.id = ".$prefix."_thread.last_post_id) AND (poster_id = ".$prefix."_users.id) AND (thread_id=".$prefix."_thread.id) ORDER BY ".$prefix."_msg.id DESC LIMIT $num");
while(list($id, $login, $replies, $views, $post_stamp, $thread_id, $poster_id, $attach_cnt, $root_msg_id) = $db->sql_fetchrow($result)) {
$last_date = date($time,$post_stamp);
$root_msg = $db->sql_query ("SELECT icon, subject, poster_id FROM ".$prefix."_msg WHERE id=".$root_msg_id."");
list($icon, $subject, $starter_id) = $db->sql_fetchrow($root_msg);
$iconimg = ($icon <> NULL ) ? "<img src=\"forum/images/message_icons/$icon\" border=\"0\">" : "";
$starter = $db->sql_query ("SELECT login FROM ".$prefix."_users WHERE id=".$starter_id."");
list($author) = $db->sql_fetchrow($starter);
$attach = ($attach_cnt > 0) ? "<img src=\"images/attach.gif\" border=\"0\" alt=\"В сообщении есть прикрепленные файлы\">" : "";
$content .= "<tr>";
$content .= "<td bgcolor=\"#333333\">";
$content .= "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"#333333\"><tr>";
$content .= "<td align=\"center\" width=\"5%\" valign=\"middle\">$iconimg</td>";
$content .= "<td width=\"95%\"><a href=\"forum/index.php?t=msg&th=$thread_id#msg_$id\">$subject</a></td>";
$content .= "<td align=\"center\" valign=\"middle\">$attach</td>";
$content .= "</tr></table></td>";
$content .= "<td bgcolor=\"#333333\" align=\"center\"><a href=\"forum/index.php?t=usrinfo&id=$starter_id\">$author</a></td>";
$content .= "<td bgcolor=\"#333333\" align=\"center\">$replies</td>";
$content .= "<td bgcolor=\"#333333\" align=\"center\">$views</td>";
$content .= "<td bgcolor=\"#333333\" align=\"center\">$last_date</td>";
$content .= "<td bgcolor=\"#333333\" align=\"center\"><a href=\"forum/index.php?t=usrinfo&id=$poster_id\">$login</a></td>";
$content .= "</tr>";
}
$content .= "</table>";
?>
You can try to replace $content .= on the echo for using this script in other CMS or just PHP-code
The one who nothing does is not mistaken
|
|
|