Codice: Seleziona tutto
<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
display_forums('', $config['load_moderators']);
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
$total_users = $config['num_users'];
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_colour, group_type
FROM ' . GROUPS_TABLE . '
WHERE group_legend = 1
ORDER BY group_name ASC';
}
else
{
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);
$legend = array();
while ($row = $db->sql_fetchrow($result))
{
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
{
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
}
else
{
$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
}
}
$db->sql_freeresult($result);
$legend = implode(', ', $legend);
// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
{
$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
// Display birthdays of 29th february on 28th february in non-leap-years
$leap_year_birthdays = '';
if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L'))
{
$leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
}
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
WHERE (b.ban_id IS NULL
OR b.ban_exclude = 1)
AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays)
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_list .= ' (' . max(0, $now['year'] - $age) . ')';
}
}
$db->sql_freeresult($result);
}
// Start DM Music Charts
if (!function_exists('check_charts_voted'))
{
include($phpbb_root_path . 'includes/functions_dm_music_charts.' . $phpEx);
}
if ($auth->acl_gets('u_dm_mc_view') && $user->data['user_id'] != ANONYMOUS)
{
$user->add_lang('mods/dm_music_charts');
check_charts_voted();
}
// End DM Music Charts
if (!class_exists('phpbb_mods_who_was_here'))
{
include($phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx);
phpbb_mods_who_was_here::update_session();
}
phpbb_mods_who_was_here::display();
// BEGIN Welcome Mod
//--Welcome_Mod--get the hour number-->
$date = $user->format_date(time(), 'H');
if ($user->data['is_registered'])
{
$u_user_name = get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']);
}
else
{
$u_user_name = $user->lang['WELCOME_GUEST'];
}
switch (true)
{
case ($date < 1):
// if the hour is 11am-12am (18-23)
$s_welcome = sprintf($user->lang['GOOD_NIGHT'], $u_user_name);;
break;
case ($date < 4):
// if the hour is 1-3 am
$s_welcome = sprintf($user->lang['UP_LATE'], $u_user_name);
break;
case ($date < 8):
// if the hour is 4-7 am
$s_welcome = sprintf($user->lang['UP_EARLY'], $u_user_name);
break;
case ($date < 12):
// if the hour is 8-11 am
$s_welcome = sprintf($user->lang['GOOD_MORNING'], $u_user_name);
break;
case ($date < 18):
// if the hour is 12-5pm
$s_welcome = sprintf($user->lang['GOOD_AFTERNOON'], $u_user_name);
break;
case ($date < 24):
// if the hour is 6pm-11pm
$s_welcome = sprintf($user->lang['GOOD_EVENING'], $u_user_name);;
break;
}
// how long a member for
$member_for = '';
if ($user->data['is_registered'] && !$user->data['is_bot'])
{
$member_length = time() - $user->data['user_regdate'];
$years = $months = $days = 0;
$member_for = '';
if ($member_length)
{
if ($member_length >= 31536000)
{
$years = floor($member_length / 31536000);
$member_length = $member_length - ($years * 31536000);
$member_for .= $years > 1 ? ($years . ' ' . $user->lang['WELCOME_YEARS'] . ', ') : ($years . ' ' . $user->lang['WELCOME_YEAR'] . ', ');
}
$months = floor($member_length / 2628000);
if ($months)
{
$months = $months > 1 ? ($months . ' ' . $user->lang['WELCOME_MONTHS'] . ', ') : ($months . ' ' . $user->lang['WELCOME_MONTHS'] . ', ');
$member_length = $member_length - ($months * 2628000);
$member_for .= $months;
}
$days = floor($member_length / 86400);
if ($days)
{
$days = $days > 1 ? ($days . ' ' . $user->lang['WELCOME_DAYS']) : ($days . ' ' . $user->lang['WELCOME_DAY']);
$member_for .= $days;
}
}
}
//END Welcome Mod
// INIZIO - Topic più Visto
$sql = "SELECT topic_id, forum_id, topic_title, topic_views FROM " . TOPICS_TABLE . " ORDER BY topic_views DESC LIMIT 0,5";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if ($auth->acl_get('f_read', $row['forum_id']) == 1) {
$template->assign_block_vars('topicvisto', array(
'LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id']),
'TITOLO' => $row['topic_title'],
'VIEWS' => $row['topic_views'])
);
}
}
$db->sql_freeresult($result);
// FINE
// INIZIO - Ultimi Topic -- by Sir Xiradorn
$sql_lasttopic = "SELECT topic_id, forum_id, topic_title, topic_time, topic_moved_id FROM ".TOPICS_TABLE."
WHERE topic_moved_id = 0
ORDER BY topic_time
DESC LIMIT 0,15";
$risultato_lasttopic = $db->sql_query($sql_lasttopic);
$ltcount = 0;
while ($row_lasttopic = $db->sql_fetchrow($risultato_lasttopic))
{
$time_lasttopic = $user->format_date($row_lasttopic['topic_time']);
if ($ltcount < 5) {
if ($auth->acl_get('f_read', $row_lasttopic['forum_id']) == 1) {
$template->assign_block_vars('lasttopic', array(
'LASTTOPIC_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row_lasttopic['forum_id'] . "&t=" . $row_lasttopic['topic_id']),
'LASTTOPIC_TITOLO' => $row_lasttopic['topic_title'],
'LASTTOPIC_TIME' => $time_lasttopic,
));
}
$ltcount = $ltcount + 1;
}
}
$db->sql_freeresult($risultato_lasttopic);
// FINE
// INIZIO - Top Posters -- by Sir Xiradorn
$sql_topposter = "SELECT user_id, username, user_posts, user_colour FROM ".USERS_TABLE." WHERE group_id != 6 AND group_id != 1 ORDER BY user_posts DESC LIMIT 0,10";
$risultato_topposter = $db->sql_query($sql_topposter);
while ($row_topposter = $db->sql_fetchrow($risultato_topposter))
{
$template->assign_block_vars('topposter', array(
'TOPPOSTER' => get_username_string('full', $row_topposter['user_id'], $row_topposter['username'], $row_topposter['user_colour']),
'TOPPOSTER_NUM' => $row_topposter['user_posts'],
));
}
$db->sql_freeresult($risultato_topposter);
// FINE
// INIZIO - Last Sign Members List -- by Sir Xiradorn
$sql_lastusersign = "SELECT user_id, username, user_regdate, user_colour FROM ".USERS_TABLE." ORDER BY user_regdate DESC LIMIT 0,10";
$risultato_lastusersign = $db->sql_query($sql_lastusersign);
while ($row_lastusersign = $db->sql_fetchrow($risultato_lastusersign))
{
$template->assign_block_vars('lastusersign', array(
'LASTUSERSING' => get_username_string('full', $row_lastusersign['user_id'], $row_lastusersign['username'], $row_lastusersign['user_colour']),
));
}
$db->sql_freeresult($risultato_lastusersign);
// FINE
// INIZIO - Ultimi Topic Utente -- by Sir Xiradorn
$sql_lastusertopic = 'SELECT topic_id, forum_id, topic_title, topic_time, topic_moved_id FROM '.TOPICS_TABLE.'
WHERE topic_moved_id = 0 AND topic_poster = '.$user->data['user_id'].'
ORDER BY topic_time
DESC LIMIT 0,50';
$risultato_lastusertopic = $db->sql_query($sql_lastusertopic);
$ltucount = 0;
while ($row_lastusertopic = $db->sql_fetchrow($risultato_lastusertopic))
{
$time_lastusertopic = $user->format_date($row_lastusertopic['topic_time']);
if ($ltucount < 5) {
if ($auth->acl_get('f_read', $row_lastusertopic['forum_id']) == 1) {
$template->assign_block_vars('lastusertopic', array(
'LASTUSERTOPIC_LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row_lastusertopic['forum_id'] . "&t=" . $row_lastusertopic['topic_id']),
'LASTUSERTOPIC_TITOLO' => $row_lastusertopic['topic_title'],
'LASTUSERTOPIC_TIME' => $time_lastusertopic,
));
}
$ltucount = $ltucount + 1;
}
}
$db->sql_freeresult($risultato_lastusertopic);
// FINE
//Begin: National_Flag
if (!empty($config['allow_flags']))
{
if (!function_exists('top_flags'))
{
include($phpbb_root_path . 'includes/functions_flag.' . $phpEx);
}
top_flags();
}
//End: National_Flag
// Assign index specific vars
$template->assign_vars(array(
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
// BEGIN Welcome Mod
'S_WELCOME' => $s_welcome,
'S_JOINED_DATE' => $user->lang['JOINED'] . ': ' . $user->format_date($user->data['user_regdate']),
'USER_AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),
'MEMBER_FOR' => (!empty($member_for)) ? $user->lang['MEMBER_FOR'] . ' ' . $member_for : '',
// END Welcome Mod
'LEGEND' => $legend,
'BIRTHDAY_LIST' => $birthday_list,
'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'),
'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'),
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'),
'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'),
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);
// Start DM Video
if ( isset($config['dm_video_version']) )
{
$user->setup('mods/dm_video');
$sql = 'SELECT COUNT(video_id) AS number_videos
FROM ' . DM_VIDEO_TABLE . '
WHERE video_approval = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sql2 = 'SELECT *
FROM ' . DM_VIDEO_TABLE . '
WHERE video_approval = 1
ORDER BY video_counter DESC LIMIT 5';
$result2 = $db->sql_query($sql2);
while ( $row2 = $db->sql_fetchrow($result2) )
{
if (!$auth->acl_get('u_dm_video_view'))
{
$title = $row2['video_title'];
}
else
{
$title = '<a href="' . $row2['video_title'] . '" title="' . $user->lang['DMV_CLICK_SEE'] . '"><strong>' . $row2['video_title'] . '</strong></a>';
}
$template->assign_block_vars('videoline', array(
'VIDEO_COUNTER' => sprintf($user->lang['DMV_VIDEO_COUNTER'], $row2['video_counter']),
'TITEL' => $title,
));
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_VIDEO_EXIST' => true,
'NUMBER_VIDEOS' => sprintf($user->lang['DMV_TOTAL_VIDEOS'], $row['number_videos']),
));
}
// End DM Video
// Output page
page_header($user->lang['INDEX']);
$template->set_filenames(array(
'body' => 'index_body.html')
);
page_footer();
?>