<?php
function p407_FetchPosts($language, $settings, $forumname, $forumpath, $tableprefix)
{
global $DB;
global $userinfo;
global $mainsettings; // needed for date format option
$pluginid = 407; // this plugin id
$postlimit = $settings['Number of Posts to Display'];
$forumids = $settings['Include Forums'];
$showForum = $settings['Show Forum Name'];
$showUser = $settings['Show User Name'];
$showDate = $settings['Show Post Date'];
$maxWords = $settings['Maximum Words'];
$newThreadsOnly = $settings['Display New Threads Only'];
$extraquery = p407_GetExtraQuery($forumids, 'b.ID_BOARD');
if($forumname == 'Simple Machines Forum 1')
{
/***********************
** MAIN POSTS QUERY **
***********************/
if($newThreadsOnly)
{
if(strlen($extraquery) == 0)
$extraquery = "WHERE t.ID_FIRST_MSG = m.ID_MSG";
else
$extraquery .= " AND t.ID_FIRST_MSG = m.ID_MSG";
}
$posts = $DB->query("SELECT m.ID_MSG As post_id, t.ID_TOPIC as topic_id, b.ID_BOARD as forum_id, b.name As forum_name, m.subject As title, m.body As message, COALESCE(mb.memberName, m.posterName) as username, mb.ID_MEMBER as userid, m.posterTime as postdate
FROM " . $tableprefix . "messages m
LEFT JOIN " . $tableprefix . "members mb
ON mb.ID_MEMBER = m.ID_MEMBER
LEFT JOIN " . $tableprefix . "topics t
ON t.ID_TOPIC = m.ID_TOPIC
LEFT JOIN " . $tableprefix . "boards b
ON b.ID_BOARD = t.ID_BOARD
$extraquery
ORDER BY m.posterTime desc
LIMIT $postlimit");
/***********************
** LOAD FORUM DATA **
***********************/
// Right let's fool the SMF BBCode functions into thinking they are running within SMF
define('SMF', 1);
include($forumpath . 'Sources/Subs.php');
// Load the SMF settings into a global array
$smf_settings = $DB->query("SELECT * FROM " . $tableprefix . "settings");
$GLOBALS['modSettings'] = array();
while($setting = $DB->fetch_array($smf_settings))
{
list($key, $value) = $setting;
$GLOBALS['modSettings'][$key] = $value;
}
// Disable Custom Smileys to stop it going into the DB
$GLOBALS['modSettings']['smiley_enable'] = '';
// Setup the smiley set
$smiley = $DB->query_first("SELECT smileySet FROM " . $tableprefix . "members WHERE ID_MEMBER='" . $userinfo['userid'] . "'");
if(strlen($smiley[0]) <= 0)
{
$smiley = $DB->query_first("SELECT value FROM " . $tableprefix . "settings WHERE variable='smiley_sets_default'");
}
$GLOBALS['user_info']['smiley_set'] = $smiley[0];
// Get the date format
$dateformat = $DB->query_first("SELECT timeFormat FROM " . $tableprefix . "members WHERE ID_MEMBER='" . $userinfo['userid'] . "'");
if(strlen($dateformat[0]) <= 0)
{
$dateformat = $DB->query_first("SELECT value FROM " . $tableprefix . "settings WHERE variable='time_format'");
}
// Get the theme
$theme = $DB->query_first("SELECT ID_THEME FROM " . $tableprefix . "members WHERE ID_MEMBER='" . $userinfo['userid'] . "'");
if($theme[0] <= 0)
{
$theme = $DB->query_first("SELECT value FROM " . $tableprefix . "settings WHERE variable='theme_default'");
if($theme[0] <= 0)
{
$theme = $DB->query_first("SELECT value FROM " . $tableprefix . "settings WHERE variable='theme_guests'");
}
}
$themedir = $DB->query_first("SELECT value FROM " . $tableprefix . "themes WHERE variable='theme_dir' AND ID_THEME = " . $theme[0]);
if(!isset($themedir[0]))
{
echo 'Failed to load the theme';
return;
}
// Get the language
require_once($themedir[0] . '/languages/index.turkish.php');
// Make it global
$GLOBALS['txt'] = $txt;
// Read in the CSS
$skincss = file_get_contents($themedir[0] . '/style.css');
$startpos = min(strpos($skincss, '.quote'), strpos($skincss, '.quoteheader'));
$startpos = min($startpos, strpos($skincss, '.code'));
$startpos = min($startpos, strpos($skincss, '.codeheader'));
$lastpos = max(strrpos($skincss, '.quote'), strrpos($skincss, '.quoteheader'));
$lastpos = max($lastpos, strrpos($skincss, '.code'));
$lastpos = max($lastpos, strrpos($skincss, '.codeheader'));
$lastpos = strpos($skincss, '}', $lastpos) + 1;
$skincss = substr($skincss, $startpos, $lastpos - $startpos);
echo '<style type="text/css">' . $skincss . '</style>';
/***********************
** DISPLAY THE POSTS **
***********************/
while($post = $DB->fetch_array($posts))
{
// Parse BBCode/Smileys using the forum code
$post['message'] = p407_TruncateString($post['message'], $maxWords);
$post['message'] = doUBBC($post['message']);
echo '<b>' . $post['title'] . '</b><br/>';
if($showForum) echo $language['in_forum'] . ' <a href="' . $forumpath . 'index.php?board=' . $post['forum_id'] . '.0">' . $post['forum_name'] . '</a><br/>';
if($showDate) echo $language['posted'] . ' ' . strftime($dateformat[0], $post['postdate']) . '<br/>';
if($showUser) echo $language['by'] . ' <a href="' . $forumpath . 'index.php?action=profile;u=' . $post['userid'] . '">' . $post['username'] . '</a><br/>';
echo '<br/>' . $post['message'] . '<br/><br/>';
echo '<a href="' . $forumpath . 'index.php?topic=' . $post['topic_id'] . '.msg' . $post['post_id'] . '#msg' . $post['post_id'] . '">' . $language['read_more'] . '</a><br/><br/>';
}
unset($GLOBALS['modSettings']);
unset($GLOBALS['user_info']);
} // end if SMF forum
}
?> seo kurdum her şey iyi çalışıyor ama...
0
●503
- 15-04-2008, 12:53:44Üyeliği durdurulduarkadaşlar seo kurdum türkçe karakter hatasını düzeltim ama ben smf yi subdreamer'e entegre etmiştim, subdreamerde forum news plugini kurdum ama forumdan gelen haberleri gösteriyor fakat devamını oku diyince 404 hatası çıkıyor ve url de siteismi.com bu hata çıkıyor acaba linkler mi birbirine uymuyor nedir ? yardım ederseniz sevinirim ve forum new plugindeki kodları size göstermek istiyorum belki orada bir ayar yapmak gerekli