Code: Select all
SQL ERROR [ mysql4 ]
Table 'spiderdata.phpbb_top_topics_order' doesn't exist [1146]
SQL
INSERT INTO phpbb_top_topics_order (tt_order, tt_title, tt_sql, tt_display, tt_additional, tt_goto) VALUES (1, 'TOP_TOPIC_TOPICS', 'sql_topics', 1, '', 0)
BACKTRACE
FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()
FILE: top_topics_mod_install.php
LINE: 120
CALL: dbal_mysql->sql_query()
I would like, it would be like this:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxx
Someone could help?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
Code: Select all
<?php
if ( !defined( 'IN_PHPBB'))
{
exit;
}
function cuttext($value, $length)
{
if(is_array($value)) list($string, $match_to) = $value;
else { $string = $value; $match_to = $value{0}; }
$match_start = stristr($string, $match_to);
$match_compute = strlen($string) - strlen($match_start);
if (strlen($string) > $length)
{
if ($match_compute < ($length - strlen($match_to)))
{
$pre_string = substr($string, 0, $length);
$pos_end = strrpos($pre_string, " ");
if($pos_end === false) $string = $pre_string."...";
else $string = substr($pre_string, 0, $pos_end)."...";
}
else if ($match_compute > (strlen($string) - ($length - strlen($match_to))))
{
$pre_string = substr($string, (strlen($string) - ($length - strlen($match_to))));
$pos_start = strpos($pre_string, " ");
$string = "...".substr($pre_string, $pos_start);
if($pos_start === false) $string = "...".$pre_string;
else $string = "...".substr($pre_string, $pos_start);
}
else
{
$pre_string = substr($string, ($match_compute - round(($length / 3))), $length);
$pos_start = strpos($pre_string, " "); $pos_end = strrpos($pre_string, " ");
$string = "...".substr($pre_string, $pos_start, $pos_end)."...";
if($pos_start === false && $pos_end === false) $string = "...".$pre_string."...";
else $string = "...".substr($pre_string, $pos_start, $pos_end)."...";
}
$match_start = stristr($string, $match_to);
$match_compute = strlen($string) - strlen($match_start);
}
return $string;
}
$forum_id_field = '{initial_field}';
$sql_main = "SELECT t.*, MAX(p.post_id) AS last_post
FROM " . POSTS_TABLE . " AS p, " . TOPICS_TABLE . " AS t
WHERE {available_forums_in_set}
AND p.topic_id = t.topic_id AND p.forum_id = t.forum_id
GROUP BY p.topic_id";
$sql_tt_avails = array(
'sql_topics' => array(
'sql' => "{$sql_main}
ORDER BY t.topic_time DESC",
'field' => 't.forum_id',
),
'sql_replies' => array(
'sql' => "{$sql_main}
ORDER BY t.topic_replies DESC, t.topic_time DESC",
'field' => 't.forum_id',
),
'sql_views' => array(
'sql' => "{$sql_main}
ORDER BY t.topic_views DESC, t.topic_time DESC",
'field' => 't.forum_id',
),
'sql_posts' => array(
'sql' => "{$sql_main}
ORDER BY p.post_time DESC",
'field' => 't.forum_id',
),
);
$goto_ary = array(
0 => 'first',
1 => 'unread',
2 => 'last'
);
if ( defined( 'IN_ADMIN'))
{
return;
}
$top_topics_count = (int) $config['tt_count'];
$tt_logged = (( isset( $config['tt_logged']) && $config['tt_logged'] == 1 && $user->data['is_registered'] == 1)||$config['tt_logged']==0) ? true: false;
$visible_users_forums = $auth->acl_getf( 'f_read');
$available_forums_in_set = $db->sql_in_set( $forum_id_field, array_keys( $visible_users_forums), false, true);
$user->add_lang( 'mods/top_topics');
$rowset_order = array();
if ( $cache->_exists( '_top_topics'))
{
$rowset_order = $cache->get( '_top_topics');
}
if ( count( $rowset_order) == 0 )
{
$sql = "SELECT * FROM " . TT_ORDER_TABLE . " WHERE tt_display = 1 ORDER BY tt_order ASC";
$rs_order = $db->sql_query( $sql);
$rowset_order = $db->sql_fetchrowset( $rs_order);
$db->sql_freeresult( $rs_order);
$cache->put( '_top_topics', $rowset_order);
}
$rowset_order_count = count( $rowset_order);
$style_width = ceil( 100/$rowset_order_count) . '%';
$template->assign_vars( array(
'TT_ALIGMENT' => ( isset( $config['tt_aligment']))? $config['tt_aligment'] : 'top',
'S_TT_LOGGED_USERS' => $tt_logged,
'TT_WIDTH' => ( isset($config['tt_width']) && $config['tt_width'] != '' ) ? $config['tt_width'] . "px" : '',
'STYLE_WIDTH' => $style_width,
'STYLE_WIDTH_LAST' => (99 - ( ($rowset_order_count -1) * $style_width )) . '%',
));
$max_rows = 0;
for( $i_order = 0; $i_order < $rowset_order_count; $i_order++)
{
$row_order = $rowset_order[$i_order];
$sql = str_replace( '{available_forums_in_set}', $available_forums_in_set, $sql_tt_avails[$row_order['tt_sql']]['sql']);
$sql = str_replace( $forum_id_field, $sql_tt_avails[$row_order['tt_sql']]['field'], $sql);
//print $sql . ' <br />';
$rs = $db->sql_query_limit( $sql, $top_topics_count);
$rowset_order[$i_order]['rowset'] = $db->sql_fetchrowset( $rs);
$rowset_order[$i_order]['count'] = count( $rowset_order[$i_order]['rowset']);
$max_rows = ( $max_rows < $rowset_order[$i_order]['count'])? $rowset_order[$i_order]['count'] : $max_rows;
}
for( $i_order = 0; $i_order < $rowset_order_count; $i_order++)
{
$title = isset( $user->lang[$rowset_order[$i_order]['tt_title']]) ? $user->lang[$rowset_order[$i_order]['tt_title']]: "{ " . $rowset_order[$i_order]['tt_title'] . " }";
$tt_additional = $rowset_order[$i_order]['tt_additional'];
$counter =0;
$template->assign_block_vars( 'category', array(
'S_FIRST' => ( $i_order == 0 ) ? true: false,
'S_LAST' => ( $i_order == $rowset_order_count -1 ) ? true: false,
'L_TITLE' => $title,
));
switch( $rowset_order[$i_order]['tt_goto'])
{
case 0:
$add_link = '';
break;
case 1:
$add_link = '&view=unread#unread';
break;
case 2:
$add_link = '&p={last_post}#p{last_post}';
break;
}
for( $i = 0; $i < $max_rows; $i++)
{
$row = $rowset_order[$i_order]['rowset'][$i];
$template->assign_block_vars( 'category.row', array(
'TITLE' => $row['topic_title'] == '' ? ' ' : $row['topic_title'],
'U_LINK' => append_sid( 'viewtopic.' . $phpEx, 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . str_replace( '{last_post}', $row['last_post'], $add_link)),
'ADDITIONAL' => ($tt_additional != '' ) ? $row[$tt_additional]: '',
'BG_ROW' => ( ($counter++) %2 == 0) ? 'bg1' : 'bg2',
));
}
}
?>