|
From: Paul S. O. <ps...@us...> - 2002-02-12 22:49:21
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv22950
Modified Files:
viewtopic.php
Log Message:
oops, removed preg_quote but left \* in place ... bug #516545
Index: viewtopic.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewtopic.php,v
retrieving revision 1.177
retrieving revision 1.178
diff -C2 -r1.177 -r1.178
*** viewtopic.php 12 Feb 2002 17:04:11 -0000 1.177
--- viewtopic.php 12 Feb 2002 22:49:18 -0000 1.178
***************
*** 458,462 ****
if( trim($words[$i]) != "" )
{
! $highlight_match[] = "#\b(\/?)(" . str_replace("\*", ".*?", $words[$i]) . ")(?!(.*?".">.*?<)|(.*?\">)|((1)?".">))\b#i";
$highlight_replace[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\2</b></span>';
}
--- 458,462 ----
if( trim($words[$i]) != "" )
{
! $highlight_match[] = "#\b(\/?)(" . str_replace("*", ".*?", $words[$i]) . ")(?!(.*?".">.*?<)|(.*?\">)|((1)?".">))\b#i";
$highlight_replace[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\2</b></span>';
}
***************
*** 669,694 ****
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']) )
--- 669,706 ----
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( $row = $db->sql_fetchrow($result) )
{
! $poll_id = $row['vote_id'];
! $poll_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $row['vote_text']) : $row['vote_text'];
! $poll_length = $row['vote_length'];
! $poll_start = $row['vote_start'];
!
! $option_id = array();
! $option_text = array();
! $option_result = array();
! do
! {
! $option_id[] = $row['vote_option_id'];
! $option_text[] = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $row['vote_option_text']) : $row['vote_option_text'];
! $option_result[] = $row['vote_result'];
! }
! while ( $row = $db->sql_fetchrow($result) );
$sql = "SELECT vote_id
FROM " . VOTE_USERS_TABLE . "
! WHERE vote_id = $poll_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 = ( $row = $db->sql_fetchrow($result) ) ? true : 0;
if( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
***************
*** 701,715 ****
}
! $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 || !$is_auth['auth_vote'] || $forum_row['topic_status'] == TOPIC_LOCKED )
{
-
- $template->set_filenames(array(
- "pollbox" => "viewtopic_poll_result.tpl")
- );
-
$vote_results_sum = 0;
-
for($i = 0; $i < $vote_options; $i++)
{
--- 713,721 ----
}
! $poll_expired = ( $poll_length ) ? ( ( $poll_start + $poll_length < time() ) ? TRUE : 0 ) : 0;
if( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_row['topic_status'] == TOPIC_LOCKED )
{
$vote_results_sum = 0;
for($i = 0; $i < $vote_options; $i++)
{
***************
*** 717,744 ****
}
$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;
! $vote_graphic_length = round($vote_percent * $board_config['vote_graphic_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" => $vote_graphic_length)
);
}
--- 723,747 ----
}
+ $template->set_filenames(array(
+ "pollbox" => "viewtopic_poll_result.tpl")
+ );
+
$vote_graphic = 0;
$vote_graphic_max = count($images['voting_graphic']);
! for($i = 0; $i < count($option_id); $i++)
{
! $vote_percent = ( $vote_results_sum > 0 ) ? $option_result[$i] / $vote_results_sum : 0;
$template->assign_block_vars("poll_option", array(
! "POLL_OPTION_CAPTION" => $option_text[$i],
! "POLL_OPTION_RESULT" => $option_result[$i],
! "POLL_OPTION_PERCENT" => sprintf("%.1d%%", ( $vote_percent * 100 )),
! "POLL_OPTION_IMG" => $images['voting_graphic'][$vote_graphic],
! "POLL_OPTION_IMG_WIDTH" => round($vote_percent * $board_config['vote_graphic_length']))
);
+
+ $vote_graphic = ( $vote_graphic < $vote_graphic_max - 1 ) ? $vote_graphic + 1 : 0;
}
***************
*** 755,768 ****
);
! 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'])
);
}
--- 758,766 ----
);
! for($i = 0; $i < count($option_id); $i++)
{
$template->assign_block_vars("poll_option", array(
! "POLL_OPTION_ID" => $option_id[$i],
! "POLL_OPTION_CAPTION" => $option_text[$i])
);
}
***************
*** 778,788 ****
}
- if( count($orig_word) )
- {
- $vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
- }
-
$template->assign_vars(array(
! "POLL_QUESTION" => $vote_title,
"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
--- 776,781 ----
}
$template->assign_vars(array(
! "POLL_QUESTION" => $poll_title,
"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
***************
*** 791,795 ****
$template->assign_var_from_handle("POLL_DISPLAY", "pollbox");
-
}
}
--- 784,787 ----
|