Code: Alles auswählen
<?php
/***************************************************************************
* actualstats.php
* -------------------
* begin : Mai 28, 2003
* copyright : AWSW @ www.awsw.de
* email : awsw@awsw.de
*
* $Id: actualstats.php,v 1.99.2.1 2002/05/28 18:00:00 psotfx Exp $
***************************************************************************/
/***************************************************************************
*
* 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.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt ! - Diese Datei kann nicht direkt aufgerufen werden !");
}
//
// Load the appropriate Rules file
//
if( isset($HTTP_GET_VARS['mode']) )
{
switch( $HTTP_GET_VARS['mode'] )
{
case 'bbcode':
$lang_file = 'lang_bbcode';
$l_title = $lang['BBCode_guide'];
break;
default:
$lang_file = 'lang_actualstats';
$l_title = $lang['actualstats'];
break;
}
}
else
{
$lang_file = 'lang_actualstats';
$l_title = $lang['actualstats'];
}
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx);
//
// AKTUELLE FORENSTATISTIK START
//
###### start last_reg_users_#####
$sql = "SELECT user_id, username, user_regdate
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY user_regdate DESC
LIMIT 5";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$user_id=$row['user_id'];
$template->assign_block_vars("last_registrations", array(
'USERNAME' => $row['username'],
'REG_DATE' => create_date($board_config['default_dateformat'], $row['user_regdate'], $board_config['board_timezone']),
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
);
}
##### end last_reg_users_#######
###### start most posts_#####
$sql = "SELECT user_id, username, user_posts
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY user_posts DESC
LIMIT 5";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$user_id=$row['user_id'];
$template->assign_block_vars("most_posts", array(
'USERNAME' => $row['username'],
'POSTS' => $row['user_posts'],
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
);
}
##### end most posts_#######
##### start beste topics #####
$sql = "SELECT topic_id,topic_title,topic_replies
FROM " . TOPICS_TABLE . " t
LEFT JOIN " . FORUMS_TABLE . " f
ON t.forum_id=f.forum_id
WHERE f.auth_view < 2
ORDER BY topic_replies DESC
LIMIT 5";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
$topic_id=$row['topic_id'];
$template->assign_block_vars("best_topics", array(
'TOPIC_TITLE' => $row['topic_title'],
'REPLIES' => $row['topic_replies'],
'VIEWTOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
);
}
##### end best topics #####
##### start last_topics ##### (z123-428)
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_row['forum_name'],
'MODERATORS' => $forum_moderators,
'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],
'FOLDER_IMG' => $images['folder'],
'FOLDER_NEW_IMG' => $images['folder_new'],
'FOLDER_HOT_IMG' => $images['folder_hot'],
'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'],
'FOLDER_LOCKED_IMG' => $images['folder_locked'],
'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'],
'FOLDER_STICKY_IMG' => $images['folder_sticky'],
'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'],
'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'],
'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'],
'actualstats1' => $lang['actualstats1'],
'actualstats2' => $lang['actualstats2'],
'actualstats3' => $lang['actualstats3'],
'actualstats4' => $lang['actualstats4'],
'actualstats5' => $lang['actualstats5'],
'actualstats6' => $lang['actualstats6'],
'actualstats7' => $lang['actualstats7'],
'actualstats8' => $lang['actualstats8'],
'actualstats9' => $lang['actualstats9'],
'actualstats10' => $lang['actualstats10'],
'actualstats11' => $lang['actualstats11'],
'actualstats12' => $lang['actualstats12'],
'actualstats13' => $lang['actualstats13'],
'actualstats14' => $lang['actualstats14'],
'actualstats15' => $lang['actualstats15'],
'actualstats16' => $lang['actualstats16'],
'actualstats17' => $lang['actualstats17'],
'L_PM' => $lang['Private_Message'],
'L_TOPICS' => $lang['Topics'],
'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'],
'L_POSTS' => $lang['Posts'],
'L_LASTPOST' => $lang['Last_Post'],
'L_MODERATOR' => $l_moderators,
'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],
'L_NO_NEW_POSTS' => $lang['No_new_posts'],
'L_NEW_POSTS' => $lang['New_posts'],
'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'],
'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'],
'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'],
'L_NEW_POSTS_HOT' => $lang['New_posts_hot'],
'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
'L_STICKY' => $lang['Post_Sticky'],
'L_POSTED' => $lang['Posted'],
'L_JOINED' => $lang['Joined'],
'L_AUTHOR' => $lang['Author'],
'U_NAME_LINK' => $name_link,
'S_AUTH_LIST' => $s_auth_can)
);
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
LEFT JOIN " . FORUMS_TABLE . " f
ON t.forum_id=f.forum_id
WHERE t.topic_poster = u.user_id
AND p.post_id = t.topic_first_post_id
AND p2.post_id = t.topic_last_post_id
AND u2.user_id = p2.poster_id
AND f.auth_view < 2
ORDER BY t.topic_last_post_id DESC
LIMIT 25";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
$total_topics = 0;
while( $row = $db->sql_fetchrow($result) )
{
$topic_rowset[] = $row;
$total_topics++;
}
$db->sql_freeresult($result);
//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//
// Post URL generation for templating vars
//
$template->assign_vars(array(
'L_DISPLAY_TOPICS' => $lang['Display_topics'],
'U_POST_NEW_TOPIC' => append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"),
'S_SELECT_TOPIC_DAYS' => $select_topic_days,
'S_POST_DAYS_ACTION' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start"))
);
for($i = 0; $i < $total_topics; $i++)
{
$topic_id = $topic_rowset[$i]['topic_id'];
$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
$topic_extra = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_extra']) : $topic_rowset[$i]['topic_extra'];
$replies = $topic_rowset[$i]['topic_replies'];
$topic_type = $topic_rowset[$i]['topic_type'];
if( $topic_type == POST_ANNOUNCE )
{
$topic_type = $lang['Topic_Announcement'] . ' ';
}
else if( $topic_type == POST_GLOBAL_ANNOUNCE )
{
$topic_type = $lang['Topic_global_announcement'] . ' ';
}
else if( $topic_type == POST_STICKY )
{
$topic_type = $lang['Topic_Sticky'] . ' ';
}
else
{
$topic_type = '';
}
if( $topic_rowset[$i]['topic_vote'] )
{
$topic_type .= $lang['Topic_Poll'] . ' ';
}
if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
{
$topic_type = $lang['Topic_Moved'] . ' ';
$topic_id = $topic_rowset[$i]['topic_moved_id'];
$folder_image = $images['folder'];
$folder_alt = $lang['Topic_Moved'];
$newest_post_img = '';
}
else
{
if( $topic_rowset[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE )
{
$folder = $images['folder_global_announce'];
$folder_new = $images['folder_global_announce_new'];
}
else
if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
{
$folder = $images['folder_announce'];
$folder_new = $images['folder_announce_new'];
}
else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
{
$folder = $images['folder_sticky'];
$folder_new = $images['folder_sticky_new'];
}
else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED )
{
$folder = $images['folder_locked'];
$folder_new = $images['folder_locked_new'];
}
else
{
if($replies >= $board_config['hot_threshold'])
{
$folder = $images['folder_hot'];
$folder_new = $images['folder_hot_new'];
}
else
{
$folder = $images['folder'];
$folder_new = $images['folder_new'];
}
}
$newest_post_img = '';
if( $userdata['session_logged_in'] )
{
if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] )
{
if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
$unread_topics = true;
if( !empty($tracking_topics[$topic_id]) )
{
if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
{
$unread_topics = false;
}
}
if( !empty($tracking_forums[$forum_id]) )
{
if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['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'] >= $topic_rowset[$i]['post_time'] )
{
$unread_topics = false;
}
}
if( $unread_topics )
{
$folder_image = $folder_new;
$folder_alt = $lang['New_posts'];
$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
}
else
{
$folder_image = $folder;
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_post_img = '';
}
}
else
{
$folder_image = $folder_new;
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
}
}
else
{
$folder_image = $folder;
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_post_img = '';
}
}
else
{
$folder_image = $folder;
$folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
$newest_post_img = '';
}
}
if( ( $replies + 1 ) > $board_config['posts_per_page'] )
{
$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
$times = 1;
for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
{
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>';
if( $times == 1 && $total_pages > 4 )
{
$goto_page .= ' ... ';
$times = $total_pages - 3;
$j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
}
else if ( $times < $total_pages )
{
$goto_page .= ', ';
}
$times++;
}
$goto_page .= ' ] ';
}
else
{
$goto_page = '';
}
$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
$topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] );
$topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
$first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']);
$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);
$last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';
$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
$views = $topic_rowset[$i]['topic_views'];
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('topicrow', array(
'ROW_COLOR' => $row_color,
'ROW_CLASS' => $row_class,
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
'TOPIC_FOLDER_IMG' => $folder_image,
'TOPIC_AUTHOR' => $topic_author,
'GOTO_PAGE' => $goto_page,
'REPLIES' => $replies,
'NEWEST_POST_IMG' => $newest_post_img,
'TOPIC_TITLE' => $topic_title,
'TOPIC_EXTRA' => ( !empty($topic_rowset[$i]['topic_extra']) ) ? '<br />'.$topic_extra : '',
'TOPIC_TYPE' => $topic_type,
'VIEWS' => $views,
'FIRST_POST_TIME' => $first_post_time,
'LAST_POST_TIME' => $last_post_time,
'LAST_POST_AUTHOR' => $last_post_author,
'LAST_POST_IMG' => $last_post_url,
'L_TOPIC_FOLDER_ALT' => $folder_alt,
'U_VIEW_TOPIC' => $view_topic_url)
);
}
$template->assign_vars(array(
'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
'L_GOTO_PAGE' => $lang['Goto_page'])
);
##### end last topics #####
//##################### WEBMASTER #####################
$sql = "SELECT * FROM " . USERS_TABLE . " WHERE user_level !='0' ORDER BY user_level";
if ( !($results = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Datenbank-Connect-Problem', '', __LINE__, __FILE__, $sql);
}
while($m = $db->sql_fetchrow($results))
{
if ( $m['user_level'] == ADMIN ) {
$level = '<b style="color:#' . $theme['fontcolor3'] . '">Administrator</b>';
}
else if ( $m['user_level'] == JUNIOR_ADMIN )
{
$level = '<b style="color:#' . $theme['fontcolor5'] . '">Junior Admin</b>';
}
else if ( $m['user_level'] == SPONSOR )
{
$level = '<b style="color:#' . $theme['fontcolor7'] . '">Sponsor</b>';
}
else if ( $m['user_level'] == VIP )
{
$level = '<b style="color:#' . $theme['fontcolor8'] . '">VIP</b>';
}
else if ( $m['user_level'] == MOD )
{
$level = '<b style="color:#' . $theme['fontcolor2'] . '">Moderator</b>';
}
else
if ( $m['user_email'] )
{
$mail = '<a href="mailto:' . $m['user_email'] . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
}
else
{
$mail = '';
}
$u_name = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$m[user_id]");
$name = $m[username];
$template->assign_block_vars('staff', array(
'NAME' => $name,
'PM' => '<a href="privmsg.'.$phpEx.'?mode=post&u='. $m['user_id'] .'"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>',
'POSTER_ONLINE' => (($m['user_session_time'] >= ( time() - 300 )) && ($m['user_allow_viewonline'])) ? '<span style="color:green;">Online</span>' : '<span style="color:red;">Offline</span>',
'U_NAME' => $u_name,
'LEVEL' => $level)
);
}
//##################### WEBMASTER #####################
//
// AKTUELLE FORENSTATISTIK ENDE
//
$template->set_filenames(array(
'actualstats_output' => '../actualstats_body.tpl')
);
//
// Generate the page
//
$template->assign_var_from_handle('ACTUALSTATS_OUTPUT', 'actualstats_output');
?>Die letzten 10 Themen im Bereich humor
themen.....
Die letzten 10 Themen im Bereich horror
themen...
.
.
.
.
kann man das irgentwie machen? danke schonmal im vorraus...
auch ja die template sieht so aus...:
Code: Alles auswählen
<table width="100%" border="0" cellpadding="1" cellspacing="1" class="forumline">
<tr>
<th colspan="2" align="center" height="25" class="toprow" nowrap="nowrap"> {actualstats9} </th>
<th align="center" class="toprow" nowrap="nowrap"> {actualstats11} </th>
<th align="center" class="toprow" nowrap="nowrap"> {actualstats12} </th>
</tr>
<!-- BEGIN topicrow -->
<tr>
<td class="row2" width="35" align="center" valign="middle" nowrap="nowrap"> <img src="{topicrow.TOPIC_FOLDER_IMG}" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /> </td>
<td class="row2" width="100%" align="center"><span class="topictitle">{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle" style="font-size:18px">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall">{topicrow.TOPIC_EXTRA}<br />{topicrow.GOTO_PAGE}</span></td>
<td class="row2" align="center" valign="middle"><span class="genmed">{topicrow.VIEWS}</span></td>
<td class="row2" align="center" valign="middle" nowrap="nowrap"><span class="genmed">{topicrow.LAST_POST_IMG} {topicrow.LAST_POST_AUTHOR}<br /><hr width="60">{topicrow.LAST_POST_TIME}</span></td>
</tr>
<!-- END topicrow -->
</table>
<br/>