infatti una volta caricato tutto e refreshato ricevo questo errore:
Codice: Seleziona tutto
Errore Generale
SQL ERROR [ mysql4 ]
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 0 AND tt.topic_moved_id = 0 AND tt.forum_id = ft.forum_id ORDER BY' at line 5 [1064]
SQL
SELECT tt.topic_id, tt.forum_id, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_last_post_time, ft.forum_id, ft.forum_name FROM avphpbb_topics tt, avphpbb_forums ft WHERE tt.topic_type IN(2,3,4,5,7,8,9,10,11,12,13,14,15,16,18,19,21,22,23,24,25,26,27,28,39,40,44,42,43,46,48,51,52,53,55,56,57,58,59,60,61,62) AND tt.topic_type IN = 0 AND tt.topic_moved_id = 0 AND tt.forum_id = ft.forum_id ORDER BY tt.topic_last_post_time DESC LIMIT 0,20
BACKTRACE
FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()
FILE: [ROOT]/includes/db/dbal.php
LINE: 757
CALL: trigger_error()
FILE: [ROOT]/includes/db/mysql.php
LINE: 193
CALL: dbal->sql_error()
FILE: [ROOT]/mod_topten_topics.php
LINE: 100
CALL: dbal_mysql->sql_query()
FILE: [ROOT]/index.php
LINE: 253
CALL: include('[ROOT]/mod_topten_topics.php')
Codice: Seleziona tutto
<?php
// MOD Topten Topics : Topics più recenti, Topics più visti e Posts più recenti
// created by Micogian (Bingo)
if (!defined('IN_PHPBB'))
{
exit;
}
// configurazione: numero dei recods da visualizzare nella Lista
$list_rec = 20 ; // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
if ($user->data['user_id'] == '1' )
{
$forum_list = "2,3,4,5,7,8,9,12,13,14,15,16,18,19,22,40,42,43,46,48,59";
}else{
$forum_list = "2,3,4,5,7,8,9,10,11,12,13,14,15,16,18,19,21,22,23,24,25,26,27,28,39,40,44,42,43,46,48,51,52,53,55,56,57,58,59,60,61,62";
}
$list_view = 10 ; // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics
//---------- 10 Topics più Recenti start -----------//
$sql1 = "SELECT tt.topic_id, tt.forum_id, tt.topic_title, tt.topic_time, tt.topic_moved_id, tt.topic_first_poster_name,
ft.forum_id, ft.forum_name
FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
WHERE tt.forum_id IN(". $forum_list .")
AND tt.topic_type = 0
AND tt.topic_moved_id = 0
AND tt.forum_id = ft.forum_id
ORDER BY tt.topic_time DESC LIMIT 0,$list_rec";
$result1 = $db->sql_query($sql1);
$n1 = 0;
while ($row1 = $db->sql_fetchrow($result1))
{
if ($auth->acl_get('f_read', $row1['forum_id']) == 1)
{
if ($n1 < $list_view)
{
if (strlen($row1['topic_title']) > 28)
{
$topic_title1 = substr($row1['topic_title'],0,27) . "...";
}else{
$topic_title1 = $row1['topic_title'];
}
$last_topic_link[$n1] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row1['forum_id'] . "&t=" . $row1['topic_id']);
$last_topic_title[$n1] = $row1['topic_title'];
$last_topic_title_short[$n1] = $topic_title1;
$last_topic_forum[$n1] = $row1['forum_name'];
$last_topic_author[$n1] = $row1['topic_first_poster_name'];
$last_topic_data[$n1] = $user->format_date($row1['topic_time'], "|d M|");
++$n1 ;
}else{
break ;
}
}
}
//---------- 10 Topics più Recenti end -----------//
//---------- 10 Topics più Visti start -----------//
$sql2 = "SELECT tt.topic_id, tt.forum_id, tt.topic_title, tt.topic_first_poster_name, tt.topic_views,
ft.forum_id, ft.forum_name
FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
WHERE tt.forum_id IN(" . $forum_list . ")
AND tt.forum_id = ft.forum_id
ORDER BY tt.topic_views DESC LIMIT 0,$list_rec";
$result2 = $db->sql_query($sql2);
$n2 = 0 ;
while ($row2 = $db->sql_fetchrow($result2))
{
if ($auth->acl_get('f_read', $row2['forum_id']) == 1)
{
if ($n2 < $list_view)
{
if (strlen($row2['topic_title']) > 28)
{
$topic_title2 = substr($row2['topic_title'],0,27) . "...";
}else{
$topic_title2 = $row2['topic_title'];
}
$view_topic_link[$n2] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row2['forum_id'] . "&t=" . $row2['topic_id']);
$view_topic_title[$n2] = $row2['topic_title'];
$view_topic_title_short[$n2] = $topic_title2;
$view_topic_forum[$n2] = $row2['forum_name'];
$view_topic_author[$n2] = $row2['topic_first_poster_name'];
$view_topic_views[$n2] = $row2['topic_views'];
++$n2 ;
}else{
break ;
}
}
}
//---------- 10 Topics più visti end -----------//
//---------- 10 Ultimi posts start -----------//
$sql4 = "SELECT tt.topic_id, tt.forum_id, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_last_post_time,
ft.forum_id, ft.forum_name
FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
WHERE tt.topic_type IN(" . $forum_list . ")
AND tt.topic_type IN = 0
AND tt.topic_moved_id = 0
AND tt.forum_id = ft.forum_id
ORDER BY tt.topic_last_post_time DESC LIMIT 0,$list_rec";
$result4 = $db->sql_query($sql4);
$n4 = 0;
while ($row4 = $db->sql_fetchrow($result4))
{
if ($auth->acl_get('f_read', $row4['forum_id']) == 1)
{
if ($n4 < $list_view)
{
$post_subject = str_replace("Re: ", "", $row4['topic_last_post_subject']) ;
if (strlen($post_subject) > 28)
{
$post_title = substr($post_subject,0,25) . "...";
}else{
$post_title = $post_subject ;
}
$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "#p" . $row4['topic_last_post_id']);
//$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "p#" . $row4['topic_last_post_id']);
$last_post_title[$n4] = $row4['topic_last_post_subject'];
$last_post_title_short[$n4] = $post_title;
$last_post_forum[$n4] = $row4['forum_name'];
$last_post_author[$n4] = $row4['topic_last_poster_name'];
++$n4 ;
}else{
break ;
}
}
}
//---------- 10 Ultimi posts end -----------//
// Crea l'array "topten_list" che contiene le Variabili per il Template
for ($x = 0; $x < $list_view; ++$x)
{
$template->assign_block_vars('topten_list',array(
'LAST_TOPIC_LINK' => $last_topic_link[$x],
'LAST_TOPIC_TITLE' => $last_topic_title[$x],
'LAST_TOPIC_TITLE_SHORT' => $last_topic_title_short[$x],
'LAST_TOPIC_FORUM' => $last_topic_forum[$x],
'LAST_TOPIC_AUTHOR' => $last_topic_author[$x],
'LAST_TOPIC_DATA' => $last_topic_data[$x],
'VIEW_TOPIC_LINK' => $view_topic_link[$x],
'VIEW_TOPIC_TITLE' => $view_topic_title[$x],
'VIEW_TOPIC_TITLE_SHORT' => $view_topic_title_short[$x],
'VIEW_TOPIC_FORUM' => $view_topic_forum[$x],
'VIEW_TOPIC_AUTHOR' => $view_topic_author[$x],
'VIEW_TOPIC_VIEWS' => $view_topic_views[$x],
'LAST_POST_LINK' => $last_post_link[$x],
'LAST_POST_TITLE' => $last_post_title[$x],
'LAST_POST_TITLE_SHORT' => $last_post_title_short[$x],
'LAST_POST_FORUM' => $last_post_forum[$x],
'LAST_POST_AUTHOR' => $last_post_author[$x]
));
}
?>