Jestem zmuszony napisać tutaj , ponieważ na supporcie joomli nie doczekam się odpowiedzi...
Zainstalowałem Na joomli ostatnie tematy z IPB. Nie działają polskie znaki.
wygląd to tak
Kodowanie w bazie utf8_general_ci .
Kod php modułu :
[long]
<?php
// IPB Latest Topic module, version 1.6
// Author: Dmitry Chernov, www.provitiligo.com
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base().'modules/mod_ipb_latest/styles/common.css'); // Add stylesheet to the header of the docuemnt.
$topics = $params->get('topics'); // Get number of latest topics to display.
$symbols = $params->get('symbols'); // Get number of tipic title characters to show.
$dateformat = $params->get('dateformat'); // Get date format.
$above = $params->get('above'); // Get data to display ABOVE topics block.
$below = $params->get('below'); // Get data to display BELOW topics block.
$forum_location = $params->get('forum'); // Get forum location.
$exclude = $params->get('exclude'); // Get list of excluded forums.
$first_post_length = $params->get('first_post_length'); // Get FIRST post length.
$last_post_length = $params->get('last_post_length'); // Get LAST post length.
$allow_tags = $params->get('allow_tags'); // Get allowable tags.
$option = array(); // Open array with forum database parameters.
$option['driver'] = $params->get('driver'); // Set database driver.
$option['host'] = $params->get('host'); // Set database server.
$option['user'] = $params->get('user'); // Set database user.
$option['password'] = $params->get('password'); // Set database password.
$option['database'] = $params->get('database'); // Set database name.
$option['prefix'] = $params->get('prefix'); // Set database prefix.
$output = "";
$db = & JDatabase::getInstance($option); // Connect to forum database with given parameters.
if (JError::isError($db))
{
jexit("Database Error: ".$db->toString());
}
if ($db->getErrorNum() > 0)
{
JError::raiseError(500, "JDatabase::getInstance: Could not connect to database <br />");
}
$topics_query = "SELECT * FROM ".$option['prefix']."topics WHERE forum_id NOT IN (".$exclude.") ORDER BY last_post DESC LIMIT 0,".$topics; // Select X latest topics from corresponding table.
$db->setQuery($topics_query);
$topics_row = $db->loadAssocList();
$time_query = "SELECT * FROM ".$option['prefix']."conf_settings WHERE conf_key='time_offset'"; // Query conf_settings table for time values.
$db->setQuery($time_query);
$server_time = $db->loadAssocList();
if (isset($server_time))
{
$time_query = "SELECT * FROM ".$option['prefix']."core_sys_conf_settings WHERE conf_key='time_offset'"; // Config query for latest version of IPB.
$db->setQuery($time_query);
$server_time = $db->loadAssocList();
}
if ($above != "")
{
$output .= "<div class='aboveText'>".$above."</div>"; // Load data above posts block.
}
for ($i=0;$i<$topics;$i++) // Parse table rows from 0 to X.
{
$proper_time = $topics_row[$i]['last_post'] + $server_time[0]['conf_value']*60*60; // Adjust time according to IPB settings.
$post_date = gmdate($dateformat, $proper_time); // Get latest post date.
$author_name = html_entity_decode($topics_row[$i]['last_poster_name'],ENT_QUOTES); // Get last poster name.
// $author_name = mb_convert_encoding(html_entity_decode($topics_row[$i]['last_poster_name'],ENT_QUOTES), 'CP1252', 'UTF-8'); // Uncomment this line and comment the ABOVE one if you having problems with encoding.
$topic_title = html_entity_decode($topics_row[$i]['title'],ENT_QUOTES); // Get recent topic title.
// $topic_title = mb_convert_encoding(html_entity_decode($topics_row[$i]['title'],ENT_QUOTES), 'CP1252', 'UTF-8'); // Uncomment this line and comment the ABOVE one if you having problems with encoding.
$fname_query = "SELECT * FROM ".$option['prefix']."forums WHERE id=".$topics_row[$i]['forum_id'];
$db->setQuery($fname_query);
$fname_row = $db->loadAssocList();
$forum_name = html_entity_decode($fname_row[0]['name'],ENT_QUOTES); // Get forum name.
// $forum_name = mb_convert_encoding(html_entity_decode($fname_row['name'],ENT_QUOTES), 'CP1252', 'UTF-8'); // Uncomment this line and comment the ABOVE one if you having problems with encoding.
$fpost_query = "SELECT * FROM ".$option['prefix']."posts WHERE topic_id=".$topics_row[$i]['tid']." ORDER BY post_date ASC LIMIT 0,1";
$db->setQuery($fpost_query);
$fpost_row = $db->loadAssocList();
$firstpost = html_entity_decode($fpost_row[0]['post'],ENT_QUOTES); // Get first post of the topic.
// $firstpost = mb_convert_encoding(html_entity_decode($fpost_row[0]['post'],ENT_QUOTES), 'CP1252', 'UTF-8'); // Uncomment this line and comment the ABOVE one if you having problems with encoding.
$lpost_query = "SELECT * FROM ".$option['prefix']."posts WHERE topic_id=".$topics_row[$i]['tid']." ORDER BY post_date DESC LIMIT 0,1";
$db->setQuery($lpost_query);
$lpost_row = $db->loadAssocList();
$lastpost = html_entity_decode($lpost_row[0]['post'],ENT_QUOTES); // Get last post of the topic.
// $lastpost = mb_convert_encoding(html_entity_decode($lpost_row[0]['post'],ENT_QUOTES), 'CP1252', 'UTF-8'); // Uncomment this line and comment the ABOVE one if you having problems with encoding.
if (($symbols != "") && (mb_strlen($topic_title) > $symbols))
{
$topic_title = mb_substr($topic_title, 0, $symbols, 'UTF-8')."..."; // Cut topic title to the length given in settings.
}
if (($symbols != "") && (mb_strlen($topics_row[$i]['last_poster_name']) > $symbols-4))
{
$author_name = mb_substr($author_name, 0, $symbols-4, 'UTF-8')."..."; // Cut username to the length given in settings.
}
if (($symbols != "") && (mb_strlen($fname_row[0]['name']) > $symbols-4))
{
$forum_name = mb_substr($forum_name, 0, $symbols-4, 'UTF-8')."..."; // Cut forum name to the length given in settings.
}
$output .= "<div class='topicLink'><a href='".$forum_location."/index.php?showtopic=".$topics_row[$i]['tid']."&view=getlastpost' class='topicLink' title='".JText::_('GO TO LAST POST')."'>".$topic_title."</a></div>";
if ($params->get('display_name') == 0)
{
$output .= "<div class='authorLink'>".JText::_('AUTHOR LABEL').": <a href='".$forum_location."/index.php?showuser=".$topics_row[$i]['last_poster_id']."' title='".JText::_('GO TO AUTHOR')."'>".$author_name."</a></div>"; // Add last poster name to resulting output.
}
if ($params->get('display_date') == 0)
{
$output .= "<div class='postDate'>".JText::_('DATE LABEL').": ".$post_date."</div>"; // Add last post date to resulting output.
}
if ($params->get('display_forum') == 0)
{
$output .= "<div class='forumLink'>".JText::_('FORUM LABEL').": <a href='".$forum_location."/index.php?showforum=".$topics_row[$i]['forum_id']."' title='".JText::_('GO TO FORUM')."'>".$forum_name."</a></div>"; // Add last post forum name to resulting output.
}
if ($params->get('display_first_post') == 0)
{
$output .= "<div class='firstPost'>".strip_tags(mb_substr(preg_replace('|[[\/\!]*?[^\[\]]*?]|si', '', $firstpost),0,$first_post_length),$allow_tags)." <a href='".$forum_location."/index.php?showtopic=".$topics_row[$i]['tid']."' class='topicLink' title='".JText::_('GO TO TOPIC')."'>...</a></div>"; // Add topic's FIRST post text to resulting output.
}
if ($params->get('display_last_post') == 0)
{
$output .= "<div class='lastPost'>".strip_tags(mb_substr(preg_replace('|[[\/\!]*?[^\[\]]*?]|si', '', $lastpost),0,$last_post_length),$allow_tags)." <a href='".$forum_location."/index.php?showtopic=".$topics_row[$i]['tid']."&view=getlastpost' class='topicLink' title='".JText::_('GO TO LAST POST')."'>...</a></div>"; // Add topic's LAST post text to resulting output.
}
}
if ($below != "")
{
$output .= "<div class='belowText'>".$below."</div>"; // Load data below posts block.
}
echo $output; // Display result.
?>
[/long]