Tak chodzi dokładnie o ten mod, dopisałem php jak zaleciłeś i
Kod:
Notice: Undefined variable: mosConfig_user in /home/kolektyw/aoc/www/modules/mod_latest_topics_ext.php on line 48
Notice: Undefined variable: component in /home/kolektyw/aoc/www/modules/mod_latest_topics_ext.php on line 69
( tutaj wyświetlają sie tematy z forum )
Notice: Undefined variable: mosConfig_db in /home/kolektyw/aoc/www/modules/mod_latest_topics_ext.php on line 121
Kod PHP:
<?php
// $Id: mod_latest_posts.php,v 1.0 2003/09/15 08:02:54 avandongen Exp $
//
// Copyright (C) 2004 TIM_online
// All rights reserved.
//
// 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$titlelenght = ($params->get( 'titlelenght' )) ? $params->get( 'titlelenght' ) : 15;
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );
$forum_access = ($params->get( 'forum_access' )) ? $params->get( 'forum_access' ) : 0;
$number = ($params->get( 'number' )) ? $params->get( 'number' ) : 10;
$linktarget = ($params->get( 'linktarget' )) ? $params->get( 'linktarget' ) : '_self';
$display_time = ($params->get( 'display_time' )) ? $params->get( 'display_time' ) : 0;
$title_time_separator = ($params->get( 'title_time_separator' )) ? $params->get( 'title_time_separator' ) : " @ ";
$time_format = ($params->get( 'time_format' )) ? $params->get( 'time_format' ) : "%d-%m-%Y %H:%M";
$display_user = ($params->get( 'display_user' )) ? $params->get( 'display_user' ) : 0;
$time_user_separator = ($params->get( 'time_user_separator' )) ? $params->get( 'time_user_separator' ) : " by ";
$dbhost = ($params->get( 'dbhost' )) ? $params->get( 'dbhost' ) : "localhost";
$dbuser = ($params->get( 'dbuser' )) ? $params->get( 'dbuser' ) : "";
$dbpass = ($params->get( 'dbpass' )) ? $params->get( 'dbpass' ) : "";
$dbname = ($params->get( 'dbname' )) ? $params->get( 'dbname' ) : "";
$phpbb_prefix = ($params->get( 'phpbb_prefix' )) ? $params->get( 'phpbb_prefix' ) : "phpbb_";
$phpbb_url = ($params->get( 'phpbb_url' )) ? $params->get( 'phpbb_url' ) : "";
if(($mosConfig_user == $dbuser) && ($mosConfig_password == $dbpass)){
$db = &$database;
//same username and password, no extra connection needed...
if($mosConfig_db != $dbname){
//switch db
mysql_select_db($dbname);
}
}
else {
//connect to phpbb database
$db = new database($dbhost, $dbuser, $dbpass, $dbname, $phpbb_prefix);
}
mod_latest_topics_ext.php
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="<?php echo $moduleclass_sfx; ?>content" align="center">
<tr>
<td>
<!-- begin topic content -->
<?php
$link = ($component == 1) ? '' : '2';
$query="SELECT topic_title, topic_id, t.topic_time, t.topic_poster, t.topic_last_post_id AS topic_poster_id, u.username AS topic_poster
FROM " .$phpbb_prefix . "topics t
LEFT JOIN " .$phpbb_prefix . "forums f ON f.forum_id = t.forum_id
LEFT JOIN " .$phpbb_prefix . "users u ON t.topic_poster = u.user_id
WHERE f.auth_read <= $forum_access AND t.topic_views != 0
ORDER BY t.topic_last_post_id DESC LIMIT 0, $number";
$db->setQuery($query);
echo $db->getErrorMsg();
$rows = $db->loadObjectList();
//check if there is result
if(count($rows) > 0){
for($i=0,$n=count($rows);$i<$n;$i++){
$row = &$rows[$i];
$topic_title = $row->topic_title;
if(strlen($topic_title) > $titlelenght){
$topic_title = substr($topic_title, 0, ($titlelenght - 2)) . "...";
}
$topic_id = $row->topic_id;
echo '<font class="cross">+</font> ';
echo '<a target="'.$linktarget.'" href="'.$phpbb_url . 'viewtopic.php?t=' . $row->topic_id . '" title="'.$row->topic_title.'">'.$topic_title."</a>";
if($display_time == 1){
if(!empty($title_time_separator)){
echo " " . $title_time_separator;
}
echo " " . strftime($time_format, $row->topic_time);
}
if($display_user == 1){
if(!empty($time_user_separator)){
echo " " . $time_user_separator;
}
echo ' <a target="'.$linktarget.'" href="'.$phpbb_url . 'profile?mode=viewprofile&u=' . $row->poster_id . '" title="'.$row->poster.'">'.$row->poster."</a>";
}
echo "<br />\n";
}
}
else {
echo '<font class="cross">+</font> <a target="'.$linktarget.'" href="'.$phpbb_url . 'index.php">No topics found</a><br>';
}
?>
</tr>
</table>
<?php
//restore database
mysql_select_db($mosConfig_db);
?>