Die erste Seite auf phpbb.com ist der aktuelle Mod mit allem was zu ändern ist.
Übersetzen mußt du eigentlich nur die Lang_Dateien die in Englisch sind, also Unterforum/Unterforen oder Subforen/Subforum, wie du es angezeigt haben möchtest.
Code: Alles auswählen
##############################################################
## MOD Title: Attached forums or pseudo sub-forums MOD
## MOD Author: harishankar < v_harishankar@yahoo.co.in > (Harishankar) http://literaryforums.org (improved and optimized by niekas)
## MOD Description: This mod allows you to "attach" specific forums to another so that they are not displayed on the main index page but inside another forum. This emulates the sub-forums features but does not really create true sub-forum functionality.
##
## MOD Version: 1.0.2 (beta)
##
## Installation Level: (Easy)
## Installation Time: 10 Minutes
## Files To Edit: admin/admin_forums.php
## templates/subSilver/admin/forum_edit_body.tpl
## index.php
## templates/subSilver/index_body.tpl
## viewforum.php
## templates/subSilver/viewforum_body.tpl
## language/lang_english/lang_main.php
## language/lang_english/lang_admin.php
## includes/functions.php
##
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## Test this MOD in a testing/isolated enviroment. Although
## no obvious bugs have been found yet, this MOD *should*
## work in a live environment as well
##
##############################################################
## MOD History:
## 2005-04-26 - Version 1.0.4
## -Check new posts on children forums when viewing parent forum
##
## 2005-04-24 - Version 1.0.3
## -display latest topic subject on index and subforums
## -combine parent forum and subforums post and topic count on index
## -display subforum last post if subforum has newer post than a parent forum
##
## 2005-03-25 - Version 1.0.2
## -Improved index generation - removed database querries inside the loop
## -Added indicator for new subforum posts on index
## -No database querries on viewforum.php if forum has no subforums
## -Added last post link on subforums on viewforum.php
##
## 2004-12-11 - Version 1.0.1
## - Alpha release :)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]-------------------------------------------------
#
# If your phpbb table prefix is different, then change it to
# reflect the correct one.
#
ALTER TABLE phpbb_forums ADD attached_forum_id MEDIUMINT(8) DEFAULT '-1' NOT NULL;
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forums.php
#
#-----[ FIND ]------------------------------------------------
#
$forumstatus = $row['forum_status'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Added by Harishankar's Attached Forums MOD
$forum_attached_id = $row['attached_forum_id'];
// End add
#
#-----[ FIND ]------------------------------------------------
#
'S_PRUNE_ENABLED' => $prune_enabled,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Added by Harishankar's Attached Forums MOD
'S_ATTACHED_FORUM_ID' => $forum_attached_id,
// End add
#
#-----[ FIND ]------------------------------------------------
#
'L_CATEGORY' => $lang['Category'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Added by Harishankar's Attached Forums MOD
'L_ATTACHED_FORUM' => $lang['Attached_Field_Title'] ,
'L_ATTACHED_DESC' => $lang['Attached_Description'],
// End add
#
#-----[ FIND ]------------------------------------------------
#
$sql = "INSERT INTO " . FORUMS_TABLE .
#
#-----[ IN-LINE FIND ]----------------------------------------
#
cat_id,
#
#-----[ IN-LINE AFTER, ADD ]-----------------------------------
#
attached_forum_id,
#
#-----[ IN-LINE FIND ]-----------------------------------------
#
intval($HTTP_POST_VARS[POST_CAT_URL]) .
#
#-----[ IN-LINE AFTER, ADD ]-----------------------------------
#
", " . intval($HTTP_POST_VARS['attached_forum_id']) .
#
#-----[ FIND ]------------------------------------------------
#
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" .
#
#-----[ IN-LINE FIND ]----------------------------------------
#
cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) .
#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
", attached_forum_id = " . intval($HTTP_POST_VARS['attached_forum_id']) .
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/forum_edit_body.tpl
#-----[ FIND ]------------------------------------------------
<tr>
<td class="row1">{L_CATEGORY}</td>
<td class="row2"><select name="c">{S_CAT_LIST}</select></td>
</tr>
#-----[ AFTER, ADD ]------------------------------------------
<tr>
<td class="row1">{L_ATTACHED_FORUM}</td>
<td class="row2"><input type="text" name="attached_forum_id" value="{S_ATTACHED_FORUM_ID}" class="post" /><br />{L_ATTACHED_DESC}</td>
</tr>
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
$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";
#
#-----[ REPLACE WITH ]----------------------------------------
#
$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title
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_last_post_id = f.forum_last_post_id)
GROUP BY f.forum_id ORDER BY f.cat_id, f.forum_order";
#
#-----[ FIND ]------------------------------------------------
#
{
$forum_data[] = $row;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$attach=$forum_data;
#
#-----[ FIND ]------------------------------------------------
#
$forum_id = $forum_data[$j]['forum_id'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$attached_id = $forum_data[$j]['attached_forum_id'];
if ( $is_auth_ary[$forum_id]['auth_view'] && $attached_id == -1 )
{
$url_row2='';
$list_of_attached='';
$a=0;
foreach ($attach as $key => $value) {
$sub_forum_id= $value['forum_id'];
if ($value['attached_forum_id']==$forum_id && $is_auth_ary[$sub_forum_id]['auth_view'])
{
//combining topic and post count for forum and subforums
$forum_data[$j]['forum_posts']=$forum_data[$j]['forum_posts']+$value['forum_posts'];
$forum_data[$j]['forum_topics']=$forum_data[$j]['forum_topics']+$value['forum_topics'];
//END combining topic and post count
//Last post link - check if any of subforums have newest posts and link to them instead
if ($value['post_time']>$forum_data[$j]['post_time'])
{
$forum_data[$j]['user_id'] = $value['user_id'];
$forum_data[$j]['post_username'] = $value['post_username'];
$forum_data[$j]['forum_last_post_id'] = $value['forum_last_post_id'];
$forum_data[$j]['post_time'] = $value['post_time'];
$forum_data[$j]['username'] = $value['username'];
$forum_data[$j]['topic_title'] = $value['topic_title'];
}
// END last post check
$unread_topics = false;
if ( $userdata['session_logged_in'] )
{
if (check_unread($value['forum_id']))
{
$url_row2 = ' <img src="' . $images['icon_minipost_new'] . '" border="0" alt="' . $lang['New_posts'] . '" title="' . $lang['New_posts'] . '" />';
}
else
{
$url_row2 = ' <img src="' . $images['icon_minipost'] . '" border="0" alt="' . $lang['No_new_posts'] . '" title="' . $lang['No_new_posts'] . '" />';
}
}
else
{
$url_row2 = ' <img src="' . $images['icon_minipost'] . '" border="0" alt="' . $lang['No_new_posts'] . '" title="' . $lang['No_new_posts'] . '" />';
}
$url_row2 .= '<a href="' . append_sid ('viewforum.php?f=' . $value['forum_id'] ) . '">' . $value['forum_name'] . '</a>' ;
$list_of_attached = $list_of_attached . $url_row2 ;
$a++;
}
}
if ($a == 1)
{
$list_of_attached = '<span class="genmed">'. $lang['Attached_forum'] . ':'.$list_of_attached.'</span>';
}
else if ($a > 1)
{
$list_of_attached = '<span class="genmed">'. $lang['Attached_forums'] . ':'.$list_of_attached.'</span>';
}
else
{
$list_of_attached = '';
}
#
#-----[ FIND ]------------------------------------------------
#
if ( $forum_data[$j]['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = $last_post_time . '<br />';
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
$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>';
}
else
{
$last_post = $lang['No_Posts'];
}
#
#-----[ REPLACE WITH ]----------------------------------------
#
if ( $forum_data[$j]['forum_last_post_id'] )
{
if (strlen($forum_data[$j]['topic_title'])>=35)
{
$forum_data[$j]['topic_title']=substr($forum_data[$j]['topic_title'],0,35). "...";
}
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$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'] . '">'.$forum_data[$j]['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
$last_post .= '<br /> by ';
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
$last_post .= ' '.$last_post_time;
}
else
{
$last_post = $lang['No_Posts'];
}
#
#-----[ FIND ]------------------------------------------------
#
if ( !empty($new_topic_data[$forum_id]) )
{
$forum_last_post_time = 0;
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
{
if ( empty($tracking_topics[$check_topic_id]) )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
else
{
if ( $tracking_topics[$check_topic_id] < $check_post_time )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
}
}
if ( !empty($tracking_forums[$forum_id]) )
{
if ( $tracking_forums[$forum_id] > $forum_last_post_time )
{
$unread_topics = false;
}
}
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
{
$unread_topics = false;
}
}
}
#
#-----[ REPLACE WITH ]----------------------------------------
#
$unread_topics=check_unread($forum_id);
#
#-----[ FIND ]------------------------------------------------
#
'LAST_POST' => $last_post,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'ATTACHED_FORUMS_LIST' => $list_of_attached,
#-----[ FIND ]------------------------------------------------
#
} // for ... categories
#
#-----[ AFTER, ADD ]------------------------------------------
#
}
#
#-----[ OPEN ]------------------------------------------------
#
/includes/functions.php
#
#-----[ FIND ]------------------------------------------------
#
function get_db_stat($mode)
{
#
#-----[ BEFORE, ADD ]------------------------------------------
#
function check_unread($forum_id)
{
global $new_topic_data, $tracking_topics, $tracking_forums, $HTTP_COOKIE_VARS, $board_config;
if ( !empty($new_topic_data[$forum_id]) )
{
$forum_last_post_time = 0;
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
{
if ( empty($tracking_topics[$check_topic_id]) )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
else
{
if ( $tracking_topics[$check_topic_id] < $check_post_time )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
}
}
if ( !empty($tracking_forums[$forum_id]) )
{
if ( $tracking_forums[$forum_id] > $forum_last_post_time )
{
$unread_topics = false;
}
}
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
{
$unread_topics = false;
}
}
}
return $unread_topics;
}
#
#-----[ OPEN ]------------------------------------------------
#
/templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
<span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<br />{catrow.forumrow.ATTACHED_FORUMS_LIST}
#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
#
#-----[ REPLACE WITH ]----------------------------------------
#
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id OR attached_forum_id =$forum_id
ORDER BY attached_forum_id ASC";
#
#-----[ FIND ]------------------------------------------------
#
if ( !($forum_row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
$attachments='';
if ($db->sql_numrows ($result) > 1)
{
$attachments=TRUE;
}
#
#-----[ FIND ]------------------------------------------------
#
//
// Okay, lets dump out the page ...
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ($attachments)
{
//
// Obtain a list of topic ids which contain
// posts made since user last visited
//
if ( $userdata['session_logged_in'] )
{
$sql = "SELECT t.forum_id, t.topic_id, p.post_time
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
WHERE p.post_id = t.topic_last_post_id
AND p.post_time > " . $userdata['user_lastvisit'] . "
AND t.topic_moved_id = 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
}
$new_topic_data = array();
while( $topic_data = $db->sql_fetchrow($result) )
{
$new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
}
}
$sql2 = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_id, t.topic_title
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_last_post_id = f.forum_last_post_id)
WHERE attached_forum_id = " . $forum_id . "
GROUP by f.forum_id ORDER BY f.forum_order";
$result2 = $db->sql_query ($sql2);
if (!$result2 )
{
message_die ('Could not gather attached forum info', __LINE__, __FILE__, $sql2);
}
if ($db->sql_numrows ($result2) != 0)
{
while( $row = $db->sql_fetchrow($result2) )
{
$forum_data[] = $row;
}
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
$x=0;
foreach ($forum_data as $row2 => $value)
{
if ($is_auth_ary[$value['forum_id']]['auth_view'])
{
$x++;
if ($x==1)
{
$template->assign_block_vars ('switch_attached_list',
array( 'L_ATTACHED_FORUM' => $lang['Attached_forums'],
'L_ATTACHED_TOPICS' => $lang['Topics'],
'L_ATTACHED_POSTS' => $lang['Posts'],
'L_LAST_POST'=>$lang['Last_Post']
)
);
}
$attach_forum_name = '<a href="' . append_sid('viewforum.php?f=' . $value['forum_id']) . '">' . $value['forum_name'] . '</a>' ;
$attach_forum_desc = '<br />' . $value['forum_desc'];
$attach_forum_topics = $value['forum_topics'];
$attach_forum_posts = $value['forum_posts'];
$last_post_id = $value['forum_last_post_id'];
if ( $value['forum_status'] == FORUM_LOCKED )
{
$folder_image = $images['forum_locked'];
$folder_alt = $lang['Forum_locked'];
}
else
{
$unread_topics = false;
if ( $userdata['session_logged_in'] )
{
$unread_topics=check_unread($value['forum_id']);
}
$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
}
if ( $value['forum_last_post_id'] )
{
if (strlen($value['topic_title'])>=35)
{
$value['topic_title']=substr($value['topic_title'],0,35). "...";
}
$last_post_time = create_date($board_config['default_dateformat'], $value['post_time'], $board_config['board_timezone']);
$last_post = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $value['forum_last_post_id']) . '#' . $value['forum_last_post_id'] . '">'.$value['topic_title'].' <img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
$last_post .= '<br /> by ';
$last_post .= ( $value['user_id'] == ANONYMOUS ) ? ( ($value['post_username'] != '' ) ? $value['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $value['user_id']) . '">' . $value['username'] . '</a> ';
$last_post .= ' '.$last_post_time;
}
else
{
$last_post = $lang['No_Posts'];
}
$template->assign_block_vars ('switch_attached_list.switch_attached_present',
array
(
'FORUM_FOLDER_IMG' => $folder_image,
'L_FORUM_FOLDER_ALT' => $folder_alt,
'FORUM_NAME' => " $attach_forum_name",
'FORUM_DESC' => $attach_forum_desc,
'TOPICS' => $attach_forum_topics,
'POSTS' => $attach_forum_posts,
'LAST_POST_ID' => $last_post,
));
}
}
}
$db->sql_freeresult ($result2);
}
#
#-----[ OPEN ]------------------------------------------------
#
/templates/subSilver/viewforum_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
<table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- BEGIN switch_attached_list -->
<br />
<table width="100%" border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="15" nowrap="nowrap"> {switch_attached_list.L_ATTACHED_FORUM} </th>
<th width="50" class="thTop" nowrap="nowrap"> {switch_attached_list.L_ATTACHED_TOPICS} </th>
<th width="50" class="thTop" nowrap="nowrap"> {switch_attached_list.L_ATTACHED_POSTS} </th>
<th width="50" class="thTop" nowrap="nowrap"> {switch_attached_list.L_LAST_POST} </th>
</tr>
<!-- BEGIN switch_attached_present -->
<tr>
<td class="row1" align="center" valign="middle" height="38"><img src="{switch_attached_list.switch_attached_present.FORUM_FOLDER_IMG}" width="46" height="25" alt="{switch_attached_list.switch_attached_present.L_FORUM_FOLDER_ALT}" title="{switch_attached_list.switch_attached_present.L_FORUM_FOLDER_ALT}" /></td>
<td class="row1" width="75%"><span class="forumlink">{switch_attached_list.switch_attached_present.FORUM_NAME}</span><span class="genmed">{switch_attached_list.switch_attached_present.FORUM_DESC}</span></td>
<td class="row2" align="center" valign="middle"><span class="gensmall">{switch_attached_list.switch_attached_present.TOPICS}</span></td>
<td class="row2" align="center" valign="middle"><span class="gensmall">{switch_attached_list.switch_attached_present.POSTS}</span></td>
<td class="row2" align="center" nowrap="nowrap" valign="middle"><span class="gensmall">{switch_attached_list.switch_attached_present.LAST_POST_ID}</span></td>
</tr>
<!-- END switch_attached_present -->
</table>
<br />
<!-- END switch_attached_list -->
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Added by Harishankar's Attached Forums MOD
$lang['Attached_Field_Title'] = 'Attached to forum';
$lang['Attached_Description'] = "This field has been added by Harishankar's attached forums mod. If you wish this forum to be a pseudo sub-forum or attached to another forum, then enter the id of the forum you wish to attach it to. For regular (normal) forums, leave this value as -1";
// End Add
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Added by Harishankar's Attached Forums MOD
$lang['Attached_forum'] = 'Attached Forum';
$lang['Attached_forums'] = 'Attached Forums';
// End Add
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM