View Online Locatie problemen!
Geplaatst: 29 apr 2004, 14:29
Hallo iedereen,
Ik heb weer een raar probleempje met mn EzPortal.
Als mensen via mn redirect naar mn portal gaan dan staat in mn viewonline.php dat ze in fotoalbum zitten. Gaan ze naar mn portal via de gehele url dan staat de user forum locatie wel juist!
Na wat meer onderzoek blijkt dat de user locatie bij het laden van de pagina wel goed is, maar zogauw hij klaar is met laden, wordt hij verandert. Oftewel, ergens aan het eind gaat er iets fout:
portal.php:
Wie heeft ook dit soort problemen, of weet wat er aan de hand is.
Bijvoorbaat dank!
Ik heb weer een raar probleempje met mn EzPortal.
Als mensen via mn redirect naar mn portal gaan dan staat in mn viewonline.php dat ze in fotoalbum zitten. Gaan ze naar mn portal via de gehele url dan staat de user forum locatie wel juist!
Na wat meer onderzoek blijkt dat de user locatie bij het laden van de pagina wel goed is, maar zogauw hij klaar is met laden, wordt hij verandert. Oftewel, ergens aan het eind gaat er iets fout:
portal.php:
Code: Selecteer alles
<?php
/***************************************************************************
* portal.php
* -------------------
* begin : Dinsdag, 13 Augustus, 2002
* copyright : (C) 2003 Smartor
* email : smartor_xp@hotmail.com
* vertaling : Admiral Rob
* e-mail : admiralrob@phpbb-nl.com
*
* $Id: portal.php,v 2.1.0 2002/9/27, 23:07:35 Smartor Exp $
*
***************************************************************************/
/***************************************************************************
*
* Dit programma is gratis software; je kunt het verdelenen/of aanpassen
* onder de regels van de GNU General Public License zoals gemaakt door
* de Free Software Foundation; of versie 2 van de lecentie of
* (bij uw optie) elke latere versie.
*
***************************************************************************/
/***************************************************************************
*
* Dezelfde code die ik geleend had van de originele index.phpindex.php, Welkom
* Avatar mod en andere...
*
***************************************************************************/
//
// Stel configuratie voor ezPortal in
//
// Welkom tekst: pas op dat we in een .php bestand zijn, dus gebruik \' in plaats van ' en gebruik \\ in plaats van \ (HTML aan)
$CFG['welcome_text'] = '<b>Error: De welkomsttekst kon niet uit de database worden geladen';
// Hoeveelheid nieuws op portal
$CFG['number_of_news'] = '5';
// Lengte van nieuws
$CFG['news_length'] = '200';
// Nieuws bron forum ID: scheid met comma voor meerdere forums, bijv. '1,2,5'
$CFG['news_forum'] = '1,20';
// Poll bron forum ID: scheid met comma voor meerdere forums, bijv. '3,8,14'
$CFG['poll_forum'] = '14';
// Aantal recente OnderwerpenN (geen forum ID)
$CFG['number_recent_topics'] = '10';
// Bijzondere foprums voor Recente Onderwerpen, bijv. '2,4,10' (bericht: mijn recente onderwerpen script heeft zijn eigen permissie checking, zodat je deze variabel leeg kunt laten)
$CFG['exceptional_forums'] = '';
// Genegeerde Picture Categorieën
$CFG['exceptional_pic_cat'] = '5';
//
// BEEINDIG configuratie
// --------------------------------------------------------
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);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PORTAL);
init_userprefs($userdata);
//
// Beeindig session management
//
//
// Begin Navigatie
//
require($phpbb_root_path . 'menu.'.$phpEx);
//
// Eindig Navigatie
//
//
// Start Personeel Check
//
$sql = "SELECT group_id FROM " . USER_GROUP_TABLE . " WHERE user_id = ". $userdata['user_id'];
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information in portal_board", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
{
$group_id[] = $row["group_id"];
}
}
if (in_array(21, $group_id)) {
$personeel = true;
}
else { $personeel = false;}
$webmaillink = ( $personeel ) ? 'Voor het Personeel:<br>- <a title="Lees je Modern mail online" href="http://webmail.eatserver.nl" target="_blank">Modern Mail</a><br />' : '';
//
// Eind Personeel Check
//
$cal_config = array();
$sql = "SELECT * FROM ".$table_prefix."cal_config";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't query calendar config table", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
{
$cal_config[$row['config_name']] = $row['config_value'];
}
}
//
// Welkom tekst MOD door Simon Dann
//
$sql = "SELECT *
FROM " . CONFIG_TABLE;
if(!$result = $db->sql_query($sql))
{
message_die(CRITICAL_ERROR, "Could not query config information in portal_board", "", __LINE__, __FILE__, $sql);
}
else
{
while( $row = $db->sql_fetchrow($result) )
{
if ($row['config_name'] == 'portal_welcome_text')
{
$CFG['welcome_text'] = $row['config_value'];
}
//else{
// $CFG['welcome_text'] = '<b>Error: De welkomstekst kon niet uit de database worden geladen';
//}
}
}
//
// Einde van welkomstekst MOD
//
// Start add - Last visit MOD
$time_now=time();
$time1Hour=$time_now-3600;
$minutes = date('is', $time_now);
$hour_now = $time_now - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
$dato=create_date('H', $time_now,$board_config['board_timezone']);
$timetoday = $hour_now - (3600*$dato);
$sql = 'SELECT session_ip, MAX(session_time) as session_time FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399).' GROUP BY session_ip';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql);
while( $guest_list = $db->sql_fetchrow($result))
{
if ($guest_list['session_time'] >$time1Hour) $users_lasthour++;
}
$guests_today = $db->sql_numrows($result);
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
while( $todayrow = $db->sql_fetchrow($result))
{
$style_color = "";
if ($todayrow['user_lastlogon']>=$time1Hour)
{
$users_lasthour++;
}
switch ($todayrow['user_level'])
{
case ADMIN :
$todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
break;
case MOD :
$todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
break;
}
$users_today_list.=( $todayrow['user_allow_viewonline'])?' <a title="' . create_date($board_config['default_dateformat'], $todayrow['user_lastlogon'], $board_config['board_timezone']) . '" href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'>' . $todayrow['username'] . '</a>,' : (($userdata[user_level]==ADMIN) ? ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>,' : '');
if (!$todayrow['user_allow_viewonline']) $logged_hidden_today++;
else $logged_visible_today++;
}
if ($users_today_list)
{
$users_today_list[ strlen( $users_today_list)-1] = ' ';
} else
{
$users_today_list = $lang['None'];
}
$total_users_today = $db->sql_numrows($result)+$guests_today;
$users_today_list = $lang['Registered_users'].' ' . $users_today_list;
$l_today_user_s = ($total_users_today) ? ( ( $total_users_today == 1 )? $lang['User_today_total'] : $lang['Users_today_total'] ) : $lang['Users_today_zero_total'];
$l_today_r_user_s = ($logged_visible_today) ? ( ( $logged_visible_today == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total'] ) : $lang['Reg_users_zero_total'];
$l_today_h_user_s = ($logged_hidden_today) ? (($logged_hidden_today == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total'] ) : $lang['Hidden_users_zero_total'];
$l_today_g_user_s = ($guests_today) ? (($guests_today == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
$l_today_users = sprintf($l_today_user_s, $total_users_today);
$l_today_users .= sprintf($l_today_r_user_s, $logged_visible_today);
$l_today_users .= sprintf($l_today_h_user_s, $logged_hidden_today);
$l_today_users .= sprintf($l_today_g_user_s, $guests_today);
// End add - Last visit MOD
//
// Als je deze statistieken niet op index.php gebruikt, kun je overwegen ze te verwijderen
//
$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'];
}
//
// Haal nieuwste plaatje
//
$except_pic_cat_id = $CFG['exceptional_pic_cat'];
$sql = "SELECT pic_id, pic_title, pic_username, pic_time FROM phpbb_album WHERE pic_cat_id NOT IN (" . $except_pic_cat_id . ") ORDER BY pic_time DESC LIMIT 0,1";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}
$picrow = $db->sql_fetchrow($result);
//
// BEEINDIG - Haal nieuwste plaatje
//
//
// Recente onderwerpen
//
$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'])
)
);
}
//
// BEEINDIG - Recente onderwerpen
//
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'] . ")";
}
}
//
// Dirkjan
//
$imgnr = date("z");
$imgurl = "<img src='http://members.lycos.nl/dirkjan/dirkjan" . $imgnr . ".jpg' border='0'>";
//
// Einde Dirkjan
//
// Verjaardag mod, Laat gebruikers met een verjaardag zien
$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)
{
//gebruikers die vandaag hun verjaardag hebben
$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 title="' . realdate('j F',$birthdayrow[$i]['user_birthday']) . '" 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)
{
// gebruikers die hun verjaardag hebben binnen de komende dagen
$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 title="' . realdate('j F',$birthdayrow[$i]['user_birthday']) . '" 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 pagina output
//
define('SHOW_ONLINE', true);
$page_title = $lang['Home'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'portal_body.tpl')
);
//
// Avatar op 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;
}
}
// Zoek naar anonieme gebruikers
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'];
}
//
// BEEINDIG: Avatar op index mod
//
// ChatBox Mod
require_once($phpbb_root_path . 'chatbox_front.php');
$template->assign_vars(array(
'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'],
'WEBMAIL' => $webmaillink,
// Foto album
'L_NEWEST_PIC' => $lang['Newest_pic'],
'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']),
'PIC_TITLE' => $picrow['pic_title'],
'PIC_POSTER' => $picrow['pic_username'],
'U_PIC_LINK' => append_sid('album.' . $phpEx . '?id=' . $picrow['pic_id']),
'PIC_TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']),
// Recente Onderwerpen
'L_RECENT_TOPICS' => $lang['Recent_topics'],
// Zoek
'L_SEARCH_AT' => $lang['Search_at'],
'L_ADVANCED_SEARCH' => $lang['Advanced_search'],
// ChatBox Mod
'TOTAL_CHATTERS_ONLINE' => sprintf($lang['How_Many_Chatters'], $howmanychat),
'CHATTERS_LIST' => sprintf($lang['Who_Are_Chatting' ], $chatters),
'L_CLICK_TO_JOIN_CHAT' => $lang['Click_to_join_chat'],
'S_JOIN_CHAT' => append_sid("chatbox_mod/chatbox.$phpEx"),
'CHATBOX_NAME' => $userdata['user_id'] . '_ChatBox', // To make easier to test on my PC
'L_LOGIN_TO_JOIN_CHAT' => $lang['Login_to_join_chat'],
// Start add - Last visit MOD
'USERS_TODAY_LIST' => $users_today_list,
'L_USERS_LASTHOUR' =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],
'L_USERS_TODAY' =>$l_today_users,
// End add - Last visit MOD
// verjaardag 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'],
'FOK_REVIEWS' => implode("",file("http://www.cafe-modern.nl/forum/rssfeeds/fokreviews.php")),
'FOK_NIEUWS' => implode("",file("http://www.cafe-modern.nl/forum/rssfeeds/fok.php")),
'DIRKJAN' => $imgurl,
// Welkom avatar
'L_NAME_WELCOME' => $lang['Welcome'],
'U_NAME_LINK' => $name_link,
'AVATAR_IMG' => $avatar_img)
);
//
// Haal berichten van mededeling forum op
//
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'])
)
);
}
//
// BEEINDIG: Haal mededelingen op
//
//
//kalender
//
//
// Events
//
if ($userdata['session_logged_in'])
{
if ($cal_config['number_events'] <> 0)
{
$day = create_date("j", time(), $userdata['user_timezone']);
$month = create_date("m", time(), $userdata['user_timezone']);
$year = create_date("Y", time(), $userdata['user_timezone']);
$sql = "SELECT * FROM ".$table_prefix."calendar WHERE valid = 'yes'
AND eventspan >= '$year-$month-$day 00:00:00'
ORDER BY stamp
LIMIT 0, " . $cal_config['number_events'];
$check = 0;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Event data', '', __LINE__, __FILE__, $sql);
}
else
{
while ($row = $db->sql_fetchrow($result))
{
$check++;
$subject = stripslashes($row['subject']);
if ( strlen($subject) > $cal_config['subject_length']) {
if ((substr($subject,-3,1) == '(') && (substr($subject,-1,1) == ')')) {
// store the number of permits and tack them on the end of the shortened subject
$subjectnum = substr($subject,-2,1);
$subject = substr($subject, 0, -3);
}
$subject = substr($subject, 0, $cal_config['subject_length']);
$subject .= '..';
}
$start_date = substr($row['stamp'],8,2).".".substr($row['stamp'],5,2).".".substr($row['stamp'],0,4);
$end_date = substr($row['eventspan'],8,2).".".substr($row['eventspan'],5,2).".".substr($row['eventspan'],0,4);
$month =
$template->assign_block_vars('event', array(
'SUBJECT' => '<a href="'. $phpbb_root_path .'calendar.'.$phpEx.'?id='. $row['id'] .'&mode=display&day='. substr($row['stamp'],8,2). '&month='.substr($row['stamp'],5,2).'&year='.substr($row['stamp'],0,4).'">'. $subject .'</a>',
'SPAN' => $start_date . " - " . $end_date,
'AUTHOR' => '<a href="'. $phpbb_root_path .'profile.'.$phpEx.'?mode=viewprofile&'. POST_USERS_URL .'='. $row['user_id'] .'">('. stripslashes($row['username']) .')</a>'));
}
if ( $check == 0 )
{
$template->assign_block_vars('event', array(
'SUBJECT' => $lang["No_events"]));
}
}
}
if ($cal_config['number_events'] <> 0)
{
$template->assign_block_vars('event_list', array(
'EVENTS' => $lang["Events"]));
}
}
//
//einde kalender
//
//\\
//\\ Start - vgan's Portal Poll Mod V. 2.0
//\\
// Set the vote graphic length to 100
// Note: If the bars look too long at %100, (only 1 vote) set this value lower.
// Likewise, if it looks too short to you, increase it here.
$length = 100;
// Get the poll forum from EZportal config above
$poll_forum = $CFG['poll_forum'];
{
$template->assign_block_vars('PORTAL_POLL', array());
$sql = 'SELECT
t.*, vd.*
FROM
' . TOPICS_TABLE . ' AS t,
' . VOTE_DESC_TABLE . ' AS vd
WHERE
t.forum_id = ' . $poll_forum . ' AND
t.topic_status <> 1 AND
t.topic_status <> 2 AND
t.topic_vote = 1 AND
t.topic_id = vd.topic_id
ORDER BY
t.topic_time DESC
LIMIT
0,1';
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain poll information.", "", __LINE__, __FILE__, $sql);
}
if(!$total_posts = $db->sql_numrows($result))
{
message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
}
$pollrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$topic_id = $pollrow[0]['topic_id'] ;
$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id
ORDER BY vr.vote_option_id ASC";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
}
if( $vote_options = $db->sql_numrows($result) )
{
$vote_info = $db->sql_fetchrowset($result);
$vote_id = $vote_info[0]['vote_id'];
$vote_title = $vote_info[0]['vote_text'];
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id = $vote_id
AND vote_user_id = " . $userdata['user_id'];
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain user vote data for this topic", "", __LINE__, __FILE__, $sql);
}
$user_voted = ( $db->sql_numrows($result) ) ? TRUE : 0;
if( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
{
$view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == "viewresult" ) ? TRUE : 0;
}
else
{
$view_result = 0;
}
$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;
if( $user_voted || $view_result || $poll_expired || $forum_row['topic_status'] == TOPIC_LOCKED )
{
$template->set_filenames(array(
"pollbox" => "portal_poll_result.tpl")
);
$vote_results_sum = 0;
for($i = 0; $i < $vote_options; $i++)
{
$vote_results_sum += $vote_info[$i]['vote_result'];
}
$vote_graphic = 0;
$vote_graphic_max = count($images['voting_graphic']);
for($i = 0; $i < $vote_options; $i++)
{
$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
$portal_vote_graphic_length = round($vote_percent * $length);
$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;
if( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'],
"POLL_OPTION_RESULT" => $vote_info[$i]['vote_result'],
"POLL_OPTION_PERCENT" => sprintf("%.1d%%", ($vote_percent * 100)),
"POLL_OPTION_IMG" => $vote_graphic_img,
"POLL_OPTION_IMG_WIDTH" => $portal_vote_graphic_length/1)
);
}
$template->assign_vars(array(
"L_TOTAL_VOTES" => $lang['Total_votes'],
"TOTAL_VOTES" => $vote_results_sum,
"L_VIEW_RESULTS" => $lang['View_results'],
"U_VIEW_RESULTS" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
);
}
else
{
$template->set_filenames(array(
"pollbox" => "portal_poll_ballot.tpl")
);
for($i = 0; $i < $vote_options; $i++)
{
if( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
"POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'],
"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_text'])
);
}
$template->assign_vars(array(
"LOGIN_TO_VOTE" => '<b><a href="' . append_sid("login.$phpEx?redirect=portal.$phpEx") . '">' . $lang['Login_to_vote'] . '</a><b>')
);
$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">';
}
if( count($orig_word) )
{
$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
}
$template->assign_vars(array(
"POLL_QUESTION" => $vote_title,
"L_SUBMIT_VOTE" => $lang['Submit_vote'],
"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
"S_POLL_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
);
$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
}
}
//\\
//\\ End - vgan's Portal Poll Mod V. 2.0
//\\
//
// Maak de pagina
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>Bijvoorbaat dank!