Seite 1 von 1

Problem mit Umfrage im ezPortal

Verfasst: 29.01.2004 13:14
von AmigaLink
Hallo,

ich habe ein Problem mit der Umfrage-Box im ezPortal.
Und zwar können einige User (unabhängig davon ob user, Mod oder admin) nicht an der Umfrage im Portal teilnehmen und bekommen die Meldung "Keinen Beitragsmodus gewählt"! :o
Wenn sie aber in dem Forum in dem die Umfrage erstellt wurde abstimmen, geht alles ohne Probleme!!! :roll:
Es ist kein zusammenhang erkenntlich (Browser, Betriebssystem, ISP, Userstatus, ...), an dem das liegen könnte. :-?
Im Smartor Forum habe wurde dieses Problem auch schonmal von einem User angesprochen, der allerdings keine Antwort darauf erhalten hat. :(

Meine Portal.php sieht so aus:

Code: Alles auswählen

<?php
/***************************************************************************
 *                                portal.php
 *                            -------------------
 *   begin                : Tuesday, August 13, 2002
 *   copyright            : (C) 2002 Smartor
 *   email                : smartor_xp@hotmail.com
 *
 *   $Id: portal.php,v 2.1.7 2003/01/30, 17:05:58 Smartor 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.
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   Some code in this file I borrowed from the original index.php, Welcome
 *   Avatar MOD and others...
 *
 ***************************************************************************/

//
// Set configuration for ezPortal
//

// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
// $CFG['poll_forum'] = '8';

// 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'] = '';

//
// 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);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

// 
// Find which forums are visible for this user 
//  NUR EINFÜGEN WENN EVENT ADDING AKTIVIERT UND ALLE FOREN GEZEIGT WERDEN!
//$is_auth_ary = array(); 
//$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data); 

//
// 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'] . "&nbsp;(" . $row['total'] . ")";
	}
}

//
// 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')
);

//
// 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
//

	// ChatBox Mod
	require_once($phpbb_root_path . 'chatbox_front.php');


$template->assign_vars(array(
	'WELCOME_TEXT' => $CFG['welcome_text'],
	'HTML_AREA' => $CFG['html_area'],
	'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'],

		// 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'],


	// Recent Topics
	'L_RECENT_TOPICS' => $lang['Recent_topics'],

	// Search
	'L_SEARCH_AT' => $lang['Search_at'],
	'L_ADVANCED_SEARCH' => $lang['Advanced_search'],

	// 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
//

//\\ 
//\\ Start - Portal Poll Mod
//\\


// 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 = 150;

//  Get the poll forum from EZportal config above
$poll_forum_id = $CFG['poll_forum'];

$fetchpoll = phpbb_fetch_poll($poll_forum_id); 

if (!empty($fetchpoll)) 
{ 
$sql = "SELECT vote_id 
FROM " . VOTE_USERS_TABLE . " 
WHERE vote_id = " . $fetchpoll['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 : FALSE; 

if ( !$user_voted ) 
{ 
if ( $userdata['session_logged_in'] ) 
{ 
$vote_button = "<center><input type='submit' class='mainoption' name='submit' value='Stimme absenden'></center><input type='hidden' name='topic_id' value='" . $fetchpoll['topic_id'] . "'><input type='hidden' name='mode' value='Stimme absenden'>"; 
} 
else 
{ 
$vote_button = "<center><b>Bitte einloggen um an der Umfrage Teilnehmen zu können.</b></center>"; 
} 

$template->assign_vars(array( 
'S_POLL_QUESTION' => $fetchpoll['vote_text'], 
'S_POLL_ACTION' => append_sid('posting.'.$phpEx.'?'.POST_TOPIC_URL.'='.$fetchpoll['topic_id']), 
'L_SUBMIT_VOTE' => $lang['Submit_vote'], 
'SUBMIT_BUTTON' => $vote_button 
)); 

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 
{ 
$votes_total = 0; 
for($i = 0; $i < count($fetchpoll['options']); $i++) 
$votes_total += $fetchpoll['options'][$i]['vote_result']; 

$template->assign_vars(array( 
'S_POLL_QUESTION' => $fetchpoll['vote_text'], 
'VOTE_RESULTS' => '<center>Stimmen insgesamt: ' . $votes_total . '</center>' 
)); 

for ($i = 0; $i < count($fetchpoll['options']); $i++) 
{ 
$vote_percent = ( $votes_total > 0 ) ? $fetchpoll['options'][$i]['vote_result'] / $votes_total : 0; 
$vote_graphic_length = round($vote_percent * $length); 

$vote_graphic = 0; 
$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_results_row", array( 
'POLL_OPTION_CAPTION' => $fetchpoll['options'][$i]['vote_option_text'], 
'POLL_OPTION_RESULT' => $fetchpoll['options'][$i]['vote_result'], 
'POLL_OPTION_PERCENT' => sprintf("%.1d%%", ($vote_percent * 100)), 
'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length 
)); 
} 

} 
} 
else 
{ 
$template->assign_vars(array( 
'S_POLL_QUESTION' => $lang['No_poll'], 
'SUBMIT_BUTTON' => "<center><input type='submit' class='mainoption' name='submit' value='Stimme absenden' disabled='disabled'></center><input type='hidden' name='topic_id' value='" . $fetchpoll['topic_id'] . "'><input type='hidden' name='mode' value='Stimme absenden'>" 
)); 
} 

//\\ 
//\\ End - Portal Poll Mod
//\\ 


// Start Top Posters hack 
$sql = "SELECT post_id FROM " . POSTS_TABLE . " ORDER BY post_id DESC LIMIT 1"; 
$result = $db->sql_query($sql); 
$row = $db->sql_fetchrow($result); 
$total_post_perc = $row['post_id']; 
$perc_mult = 3; 
$perc_mult_set = 0; 
$rank = 0; 
$sql = "SELECT user_id, username, user_posts FROM " . USERS_TABLE ." WHERE user_id <> -1 ORDER BY user_posts DESC LIMIT 10"; 
$result = $db->sql_query($sql); 
while( $row = $db->sql_fetchrow($result)) { 
   $rank++; 
   if (!($rank % 2)) $class = 'row2'; else $class= 'row1'; 
   $percentage = round(100 * $row['user_posts'] / get_db_stat('postcount'),0); 
   $bar_perc = round($percentage * $perc_mult,0); 
   $template->assign_block_vars("users", array( 
      'RANK' => $rank, 
      'CLASS' => $class, 
      'USERNAME' => $row['username'], 
      'PERCENTAGE' => $percentage, 
      'URL' => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $row['user_id'], 
      'BAR' => $bar_perc, 
      'POSTS' => $row['user_posts']) 
   ); 
} 
// End Top Posters hack 

////
// Anfang Zugriffsstat
//

$count=0;
$time = time();
$ip = getenv(REMOTE_ADDR);
$text=$time."#".$ip."\n";
$filename="counter.csv";
$zeile = file($filename);
$datum=date("d.m.y");
$setdate=0;
$uhrzeit=date("H:i:s");
//Hier kann die Aufenthaltszeit für eine gültige Zählung und die Reloadsperre eingetragen werden (in sec)
$countgueltig=600;
$reload=600;

//Prüfung ob IP vorhanden
foreach($zeile as $sperre)
{
$arraysp = explode("#",$sperre);

if($ip==rtrim($arraysp[1]) & $arraysp[0] > $time -$reload){$vorhanden=1;}
}
//Tages- und Gesamtwert ermitteln
foreach($zeile as $wert)
{
$array = explode("#",$wert);
if($array[0]=='datum'& rtrim($array[1])!=$datum){$setdate=1;}
if($vorhanden==1){
if($array[0]=='heute' & $setdate==0){$heute=rtrim($array[1]);}
if($array[0]=='heute' & $setdate==1){$heute=1;$gestern=rtrim($array[1]);}
if($array[0]=='gesamt'){$gesamt=rtrim($array[1]);}
if($array[0]=='gestern'& $setdate==0){$gestern=rtrim($array[1]);}

}
if($vorhanden!=1)
{

if($array[0]=='heute'& $setdate==0){$heute=rtrim($array[1])+1;}
if($array[0]=='heute'& $setdate==1){$heute=1;$gestern=rtrim($array[1]);}
if($array[0]=='gestern'& $setdate==0){$gestern=rtrim($array[1]);}
if($array[0]=='gesamt'){$gesamt=rtrim($array[1])+1;}
}
}

//Tages- und Gesamtwert schreiben
$fpwrite = fopen($filename , "w");
fwrite ($fpwrite, "datum"."#".$datum."\n"."heute"."#".$heute."\n"."gestern"."#".$gestern."\n"."gesamt"."#".$gesamt."\n".$text, 750);
fclose($fpwrite);



//Useronline schreiben
$fpanhaengen = fopen($filename , "a");
foreach($zeile as $useronline)
{
$arrayuseronline = explode("#",$useronline);

if($arrayuseronline[0] > $time -$countgueltig & $ip!=rtrim($arrayuseronline[1]))
{

fwrite ($fpanhaengen,$useronline, 750);

}
}
fclose($fpanhaengen);
//wieviele user online(für Anzeige)?
$zeile1 = file($filename);


//Ausgabe


for($x=0;$x<count($zeile1);$x++){$count=$count+1;}

$template->assign_vars(array(
	'Z_DATUM' => $datum,
	'Z_UHR' => $uhrzeit,
	'Z_USERONLINE' => $count=$count-4,
      'Z_GESAMT' => $gesamt,
	'Z_HEUTE' => $heute,
	'Z_GESTERN' => $gestern)
);


// Schon Gewusst? 
// 
srand((double)microtime()*1000000); 
$tipps = file("schon_gewust.txt");
$template->assign_var('ZUFALLSTEXT', $tipps[rand(0, count($tipps)-1)]); 
//

//
// Eigene Variablen
////

$template->assign_vars(array(
	'MENUE_DOT' => '<img src="images/dot.png" WIDTH=6 HEIGHT=5 align="middle">')
);
// MOD MINI CAL BEGIN
include($phpbb_root_path . 'mods/netclectic/mini_cal/mini_cal.'.$phpEx); 
// MOD MINI CAL END
//
// Generate the page
//
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
Hat jemand eine Idee???

Gruß ... Amiga

Verfasst: 29.01.2004 20:35
von oxpus
Ersetze

Code: Alles auswählen

<input type='hidden' name='mode' value='Stimme absenden'> (kommt zweimal vor!)
mit

Code: Alles auswählen

><input type='hidden' name='mode' value='vote'>"
Sollte so klappen. Den Modus "Stimme abgeben" kennt die posting.php schliesslich nicht, daher auch die Fehlermeldung.