southbox
Geplaatst: 09 apr 2006, 11:49
Ik zoek zo zelfde southbox als Wizzzzzzz heeft op het praathuis. Volgens mij was die van de XSmod maar ik kan hem niet meer vinden
Code: Selecteer alles
[code]
Code: Selecteer alles
// Search
Code: Selecteer alles
//
// Set configuration for ezPortal
//
// Welcome Text: note that we are in PHP file, so use \' instead of ' and use \\ instead of \ (HTML enabled)
// $CFG['welcome_text'] = 'Welcome to <b>My Community</b><br /><br />Thanks for using ezPortal,<br /><br />Have a good time! ^_^';
// Number of news on portal
// $CFG['number_of_news'] = '5';
// Length of news
// $CFG['news_length'] = '200';
// News Forum ID: separate by comma for multi-forums, eg. '1,2,5'
// $CFG['news_forum'] = '1';
// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
// Number of Recent Topics (not Forum ID)
// $CFG['number_recent_topics'] = '10';
// Exceptional Forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
// $CFG['exceptional_forums'] = '';
// $CFG['poll_forum'] = '1';
//
// END configuration
// --------------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'fetchposts.'.$phpEx);
include_once($phpbb_root_path . 'includes/functions_arcade_yourscore.'.$phpEx);
// Change Style
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$best_player_portal = best_player();
$total_scores = your_scores($userdata['user_id']);
//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if( $total_posts == 0 )
{
$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
$l_total_post_s = $lang['Posted_article_total'];
}
else
{
$l_total_post_s = $lang['Posted_articles_total'];
}
if( $total_users == 0 )
{
$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
$l_total_user_s = $lang['Registered_user_total'];
}
else
{
$l_total_user_s = $lang['Registered_users_total'];
}
// Read Portal Configuration from DB
define('PORTAL_TABLE', $table_prefix.'portal');
$CFG = array();
$sql = "SELECT * FROM " . PORTAL_TABLE;
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$CFG[$row['portal_name']] = $row['portal_value'];
}
//
// Recent Topics
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $CFG['exceptional_forums'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $CFG['exceptional_forums'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
$recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
$template->assign_block_vars('recent_topic_row', array(
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
'L_TITLE' => $recent_topic_row[$i]['topic_title'],
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
'S_POSTER' => $recent_topic_row[$i]['username'],
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
)
);
}
//
// END - Recent Topics
//
if( $userdata['session_logged_in'] )
{
$sql = "SELECT COUNT(post_id) as total
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit'];
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
$lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")";
}
}
// Birthday Mod, Show users with birthday
$sql = "SELECT user_id, username, user_birthday,user_level FROM " . USERS_TABLE. " WHERE user_birthday!=999999 ORDER BY username";
if($result = $db->sql_query($sql))
{
$birthdayrow = $db->sql_fetchrowset($result);
if (!empty($birthdayrow))
{
$year=create_date('Y', time(), $board_config['board_timezone']);
$date_today = create_date('Ymd', time(), $board_config['board_timezone']);
$date_forward = create_date('Ymd', time()+($board_config['birthday_check_day']*86400), $board_config['board_timezone']);
for($i = 0; $i < count($birthdayrow); $i++)
{
$user_birthday=realdate("md",$birthdayrow[$i]['user_birthday']);
$user_birthday2=(($year.$user_birthday<$date_today)? $year+1:$year).$user_birthday;
if ($user_birthday2==$date_today)
{
//user have birthday today
$user_age=$year- realdate ('Y',$birthdayrow[$i]['user_birthday']);
$style_color = ($birthdayrow[$i]['user_level'] == ADMIN )?'style="color:#' . $theme['fontcolor3'] . '"':(( $birthdayrow[$i]['user_level'] == MOD )?'style="color:#' . $theme['fontcolor2'] . '"':'');
$birthday_today_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
}
else if ($user_birthday2>$date_today && $user_birthday2<=$date_forward)
{
// user are having birthday within the next days
$user_age=($year.$user_birthday<$date_today)?$year- realdate('Y',$birthdayrow[$i]['user_birthday']) + 1 : $year- realdate('Y',$birthdayrow[$i]['user_birthday']);
$style_color = ($birthdayrow[$i]['user_level'] == ADMIN )?'style="color:#' . $theme['fontcolor3'] . '"':(( $birthdayrow[$i]['user_level'] == MOD )?'style="color:#' . $theme['fontcolor2'] . '"':'');
$birthday_week_list .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $birthdayrow[$i]['user_id']) . '"' . $style_color .'><b>' . $birthdayrow[$i]['username'] . ' ('.$user_age.')</b></a>';
}
}
}
}
$db->sql_freeresult($result);
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
//
// BEGIN Random Game
//
{
$sql = "SELECT * FROM phpbb_ina_games ORDER BY RAND() LIMIT 1";
}
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query game information', '', __LINE__, __FILE__, $sql);
}
while($random_game = $db->sql_fetchrow($result))
{
$width = $random_game['win_width'];
$height = $random_game['win_height'];
$image_path = $random_game['image_path'];
if ( $image_path == '' )
{
$image_path = './' . $random_game['game_path'] . $random_game['game_name'] . '.gif';
}
$image = "<img src=\"" . $image_path . "\" alt=\"" . $random_game['game_name'] . "\" border=\"0\">";
$show_random_game = "<a href=\"javascript:Gk_PopTart('activity.php?mode=game&id=" . $random_game['game_id'] . "$SID', 'New_Window', '$width', '$height', 'no')\" onClick=\"blur()\">" . $image . "</a><br><span class=\"gensmall\">" . $random_game['game_desc'] . "</span>";
}
//
// END Random Game
//
//
// Avatar On Index MOD
//
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
// Check For Anonymous User
if ($userdata['user_id'] != '-1')
{
$name_link = '<a href="' . append_sid("profile.$phpEx?mode=editprofile&" . $userdata['user_id']) . '">' . $userdata['username'] . '</a>';
}
else
{
$name_link = $lang['Guest'];
}
//
// END: Avatar On Index MOD
//
// Change Style
$fpage_style = $userdata['user_style'];
if(isset($HTTP_POST_VARS['fpage_theme']))
{
$fpage_theme = intval($HTTP_POST_VARS['fpage_theme']);
$fpuser_id = $userdata['user_id'];
$fp_sql = "UPDATE " . USERS_TABLE . " SET user_style = '$fpage_theme' WHERE user_id = $fpuser_id";
if ( !($fp_result = $db->sql_query($fp_sql)) )
{
message_die(GENERAL_ERROR, 'Could not update users table ' . "$user_id $fpage_theme", '', __LINE__, __FILE__, $sql);
}
else
{
$fp_message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $fp_message);
}
}
$template->assign_vars(array(
'RANDOM_GAME' => $show_random_game,
'WELCOME_TEXT' => $CFG['welcome_text'],
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
'L_FORUM' => $lang['Forum'],
'L_BOARD_NAVIGATION' => $lang['Board_navigation'],
'L_STATISTICS' => $lang['Statistics'],
'L_ANNOUNCEMENT' => $lang['Post_Announcement'],
'L_POSTED' => $lang['Posted'],
'L_COMMENTS' => $lang['Comments'],
'L_VIEW_COMMENTS' => $lang['View_comments'],
'L_POST_COMMENT' => $lang['Post_your_comment'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'],
'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
'L_REGISTER_NEW_ACCOUNT' => sprintf($lang['Register_new_account'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'),
'L_REMEMBER_ME' => $lang['Remember_me'],
'L_VIEW_COMPLETE_LIST' => $lang['View_complete_list'],
'L_POLL' => $lang['Poll'],
'L_VOTE_BUTTON' => $lang['Vote'],
'WINNER' => sprintf("<br /><span class='gensmall'>Highscore <IMG src='images/trophy.gif'> you have:<br><b>%d</b> <a href='activity.php?mode=game_stats&id=4'>1st places.</a><br /><b>%d</b> <a href='activity.php?mode=game_stats&id=5'>2nd places.</a><br /><b>%d</b> <a href='activity.php?mode=game_stats&id=6'>3rd places.</a><br />", $total_scores[1] ,$total_scores[2] ,$total_scores[3]),
'BEST_PLAYER' => $best_player_portal,
// Recent Topics
'L_RECENT_TOPICS' => $lang['Recent_topics'],
// Search
'L_SEARCH_AT' => $lang['Search_at'],
'L_ADVANCED_SEARCH' => $lang['Advanced_search'],
// Change Style
'TEMPLATE_SELECT' => style_select($board_config['default_style'], 'template'),
'L_SELECT_STYLE' => $lang['Change_style'],
'L_CHANGE_NOW' => $lang['Go'],
'FPAGE_STYLE' => style_select($fpage_style, 'fpage_theme'),
// Birthday Mod
'L_WHOSBIRTHDAY_WEEK' => sprintf((($birthday_week_list)? $lang ['Birthday_week'].$birthday_week_list:$lang ['Nobirthday_week']),$board_config['birthday_check_day']),
'L_WHOSBIRTHDAY_TODAY' =>($birthday_today_list&&$board_config['birthday_check_day'])? $lang ['Birthday_today'].$birthday_today_list:$lang ['Nobirthday_today'],
'L_BIRTHDAY' => $lang['Birthday'],
// Welcome Avatar
'L_NAME_WELCOME' => $lang['Welcome'],
'U_NAME_LINK' => $name_link,
'AVATAR_IMG' => $avatar_img)
);
//
// Fetch Posts from Announcements Forum
//
if(!isset($HTTP_GET_VARS['article']))
{
$template->assign_block_vars('welcome_text', array());
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], $CFG['news_length']);
for ($i = 0; $i < count($fetchposts); $i++)
{
if( $fetchposts[$i]['striped'] == 1 )
{
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $lang['Read_Full'];
}
else
{
$open_bracket = '';
$close_bracket = '';
$read_full = '';
}
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id']),
'U_READ_FULL' => append_sid('portal.' . $phpEx . '?article=' . $i),
'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket)
);
}
}
else
{
$fetchposts = phpbb_fetch_posts($CFG['news_forum'], $CFG['number_of_news'], 0);
$i = intval($HTTP_GET_VARS['article']);
$template->assign_block_vars('fetchpost_row', array(
'TITLE' => $fetchposts[$i]['topic_title'],
'POSTER' => $fetchposts[$i]['username'],
'TIME' => $fetchposts[$i]['topic_time'],
'TEXT' => $fetchposts[$i]['post_text'],
'REPLIES' => $fetchposts[$i]['topic_replies'],
'U_VIEW_COMMENTS' => append_sid('viewtopic.' . $phpEx . '?t=' . $fetchposts[$i]['topic_id']),
'U_POST_COMMENT' => append_sid('posting.' . $phpEx . '?mode=reply&t=' . $fetchposts[$i]['topic_id'])
)
);
}
//
// END: Fetch Announcements
//
//
// Fetch Poll
//
$fetchpoll = phpbb_fetch_poll($CFG['poll_forum']);
if (!empty($fetchpoll))
{
$template->assign_vars(array(
'S_POLL_QUESTION' => $fetchpoll['vote_text'],
'S_POLL_ACTION' => append_sid('posting.'.$phpEx.'?'.POST_TOPIC_URL.'='.$fetchpoll['topic_id']),
'S_TOPIC_ID' => $fetchpoll['topic_id'],
'L_SUBMIT_VOTE' => $lang['Submit_vote'],
'L_LOGIN_TO_VOTE' => $lang['Login_to_vote']
)
);
for ($i = 0; $i < count($fetchpoll['options']); $i++)
{
$template->assign_block_vars('poll_option_row', array(
'OPTION_ID' => $fetchpoll['options'][$i]['vote_option_id'],
'OPTION_TEXT' => $fetchpoll['options'][$i]['vote_option_text'],
'VOTE_RESULT' => $fetchpoll['options'][$i]['vote_result'],
)
);
}
}
else
{
$template->assign_vars(array(
'S_POLL_QUESTION' => $lang['No_poll'],
'DISABLED' => 'disabled="disabled"'
)
);
}
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>