NEUES ADDON: (ja, Rechte werden mit berücksichtigt)
4. Last Topic post on Index
Ich weiß, dass es dazu bereits einen Mod gibt, aber meine Version verursacht keine zusätzliche Datenbankabfrage und zusätzlich wird ein Post direkt auf die richtige Seite des Topics verlinkt (Topiclink).
öffne includes/auth.php und suche nach:
Code: Alles auswählen
case AUTH_READ:
$a_sql = 'a.auth_read';
$auth_fields = array('auth_read');
break;
füge danach ein:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- add
case AUTH_VIEW_READ:
$a_sql = 'a.auth_view, a.auth_read';
$auth_fields = array('auth_view', 'auth_read');
break;
//-- fin mod : seo urls v2 -----------------------------------------------------
öffne includes/constants.php und suche nach:
füge danach ein:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- add
define('AUTH_VIEW_READ', 21);
//-- fin mod : seo urls v2 -----------------------------------------------------
öffne index.php und suche nach:
Code: Alles auswählen
default:
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
FROM (( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
ORDER BY f.cat_id, f.forum_order";
break;
ersetze gegen:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- delete
/*
default:
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
FROM (( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
ORDER BY f.cat_id, f.forum_order";
break;
*/
//-- add
default:
$sql = "SELECT f.*, p.topic_id, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_replies
FROM ((( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_id = p.topic_id )
ORDER BY f.cat_id, f.forum_order";
break;
//-- fin mod : seo urls v2 -----------------------------------------------------
suche nach:
Code: Alles auswählen
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
ersetze gegen:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- delete
/*
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
*/
//-- add
$is_auth_ary = auth(AUTH_VIEW_READ, AUTH_LIST_ALL, $userdata, $forum_data);
//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//-- fin mod : seo urls v2 -----------------------------------------------------
suche nach:
Code: Alles auswählen
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
füge davor ein:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- add
$total_pages_topic = ($forum_data[$j]['topic_replies'] + 1) / $board_config['posts_per_page'] <= 1 ? '' : '&start=' . floor($forum_data[$j]['topic_replies'] / $board_config['posts_per_page']) * intval($board_config['posts_per_page']);
if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_read'] )
{
//
// Censor topic title
//
if ( count($orig_word) )
{
$forum_data[$j]['topic_title'] = preg_replace($orig_word, $replacement_word, $forum_data[$j]['topic_title']);
}
//
// Shorten the topic title
//
if ( strlen($forum_data[$j]['topic_title']) > 25 )
{
$last_topic_title = substr($forum_data[$j]['topic_title'], 0, 22) . '...';
}
else
{
$last_topic_title = $forum_data[$j]['topic_title'];
}
$last_post_title = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $forum_data[$j]['topic_id'] . $total_pages_topic, '', $forum_data[$j]['topic_title']) . '#' . $forum_data[$j]['forum_last_post_id'] . '">' . $last_topic_title . '</a>';
}
else
{
$last_post_title = '';
$forum_data[$j]['topic_title'] = '';
}
//-- fin mod : seo urls v2 -----------------------------------------------------
suche nach:
ersetze gegen:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- delete
/*
$last_post = $last_post_time . '<br />';
*/
//-- add
$last_post = $last_post_title . '<br />' . $last_post_time . '<br />';
//-- fin mod : seo urls v2 -----------------------------------------------------
suche nach:
Code: Alles auswählen
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
ersetze gegen:
Code: Alles auswählen
//-- mod : seo urls v2 ---------------------------------------------------------
//-- delete
/*
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
*/
//-- add
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $forum_data[$j]['topic_id'] . $total_pages_topic, '', $forum_data[$j]['topic_title']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
//-- fin mod : seo urls v2 -----------------------------------------------------