mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 04:40:44 +02:00
Bugtracker #3819 - process/strip bbcodes in poll titles
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/bbcode_handler.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/bbcode_handler.php,v $
|
||||||
| $Revision: 1.6 $
|
| $Revision: 1.7 $
|
||||||
| $Date: 2007-02-26 20:23:39 $
|
| $Date: 2007-03-03 19:40:53 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -62,7 +62,9 @@ class e_bbcode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function parseBBCodes($value, $p_ID, $force_lower = 'default')
|
// If $bb_strip is TRUE, all bbcodes are stripped. If FALSE, none are stripped.
|
||||||
|
// If a comma separated (lower case) list is passed, only the listed codes are stripped (and the rest are processed)
|
||||||
|
function parseBBCodes($value, $p_ID, $force_lower = 'default', $bb_strip = FALSE)
|
||||||
{
|
{
|
||||||
global $postID;
|
global $postID;
|
||||||
$postID = $p_ID;
|
$postID = $p_ID;
|
||||||
@@ -74,6 +76,12 @@ class e_bbcode
|
|||||||
$result = ''; // Accumulates fully processed text
|
$result = ''; // Accumulates fully processed text
|
||||||
$stacktext = ''; // Accumulates text which might be subject to one or more bbcodes
|
$stacktext = ''; // Accumulates text which might be subject to one or more bbcodes
|
||||||
$nopro = FALSE; // Blocks processing within [code]...[/code] tags
|
$nopro = FALSE; // Blocks processing within [code]...[/code] tags
|
||||||
|
|
||||||
|
$strip_array = array();
|
||||||
|
if (!is_bool($bb_strip))
|
||||||
|
{
|
||||||
|
$strip_array = explode(',',$bb_strip);
|
||||||
|
}
|
||||||
$pattern = '#^\[(/?)([A-Za-z]+)(\d*)([=:]?)(.*?)]$#i'; // Pattern to split up bbcodes
|
$pattern = '#^\[(/?)([A-Za-z]+)(\d*)([=:]?)(.*?)]$#i'; // Pattern to split up bbcodes
|
||||||
// $matches[0] - same as the input text
|
// $matches[0] - same as the input text
|
||||||
// $matches[1] - '/' for a closing tag. Otherwise empty string
|
// $matches[1] - '/' for a closing tag. Otherwise empty string
|
||||||
@@ -99,6 +107,13 @@ class e_bbcode
|
|||||||
if ($nopro && ($bbword == 'code') && ($matches[1] == '/')) $nopro = FALSE; // End of code block
|
if ($nopro && ($bbword == 'code') && ($matches[1] == '/')) $nopro = FALSE; // End of code block
|
||||||
if (($bbword) && ($bbword == trim($bbword)) && !$nopro)
|
if (($bbword) && ($bbword == trim($bbword)) && !$nopro)
|
||||||
{ // Got a code to process here
|
{ // Got a code to process here
|
||||||
|
if (($bb_strip === TRUE) || in_array($bbword,$strip_array))
|
||||||
|
{
|
||||||
|
$is_proc = TRUE; // Just discard this bbcode
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if ($matches[1] == '/')
|
if ($matches[1] == '/')
|
||||||
{ // Closing code to process
|
{ // Closing code to process
|
||||||
$found = FALSE;
|
$found = FALSE;
|
||||||
@@ -175,6 +190,8 @@ class e_bbcode
|
|||||||
$is_proc = TRUE;
|
$is_proc = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Next lines could be deleted - but gives better rejection of 'stray' opening brackets
|
// Next lines could be deleted - but gives better rejection of 'stray' opening brackets
|
||||||
if ((!$is_proc) && (($temp = strrpos($cont,"[")) !== 0))
|
if ((!$is_proc) && (($temp = strrpos($cont,"[")) !== 0))
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/oldpolls.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/oldpolls.php,v $
|
||||||
| $Revision: 1.2 $
|
| $Revision: 1.3 $
|
||||||
| $Date: 2007-02-16 20:48:37 $
|
| $Date: 2007-03-03 19:41:00 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -58,8 +58,8 @@ if(e_QUERY)
|
|||||||
$text = "<table style='".USER_WIDTH."'>
|
$text = "<table style='".USER_WIDTH."'>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan='2' class='mediumtext' style='text-align:center'>
|
<td colspan='2' class='mediumtext' style='text-align:center'>
|
||||||
<b>".$tp -> toHTML($poll_title)."</b>
|
<b>".$tp -> toHTML($poll_title,TRUE,'TITLE')."</b>
|
||||||
<div class='smalltext'>".POLLAN_35." <a href='".e_BASE."user.php?id.$user_id'>".$user_name."</a>.<br /> ".POLLAN_37." ".$start_datestamp." ".POLLAN_38." ".$end_datestamp.".<br />".POLLAN_26.": $voteTotal</div>
|
<div class='smalltext'>".POLLAN_35." <a href='".e_BASE."user.php?id.{$user_id}'>".$user_name."</a>.<br /> ".POLLAN_37." ".$start_datestamp." ".POLLAN_38." ".$end_datestamp.".<br />".POLLAN_26.": {$voteTotal}</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
@@ -137,10 +137,12 @@ foreach($oldpollArray as $oldpoll)
|
|||||||
$from = $gen->convert_date($poll_datestamp, "short");
|
$from = $gen->convert_date($poll_datestamp, "short");
|
||||||
$to = $gen->convert_date($poll_end_datestamp, "short");
|
$to = $gen->convert_date($poll_end_datestamp, "short");
|
||||||
|
|
||||||
|
$poll_title = $tp->e_bb->parseBBCodes($poll_title, 0,TRUE,TRUE); // Strip bbcodes
|
||||||
|
|
||||||
$text .= "<tr>
|
$text .= "<tr>
|
||||||
<td class='forumheader3' style='width: 55%;'><a href='".e_SELF."?$poll_id'>$poll_title</a></td>
|
<td class='forumheader3' style='width: 55%;'><a href='".e_SELF."?{$poll_id}'>{$poll_title}</a></td>
|
||||||
<td class='forumheader3' style='width: 15%;'><a href='".e_BASE."user.php?id.$poll_admin_id'>$user_name</a></td>
|
<td class='forumheader3' style='width: 15%;'><a href='".e_BASE."user.php?id.{$poll_admin_id}'>{$user_name}</a></td>
|
||||||
<td class='forumheader3' style='width: 30%;'>$from ".POLLAN_38." $to</td>
|
<td class='forumheader3' style='width: 30%;'>{$from} ".POLLAN_38." {$to}</td>
|
||||||
</tr>\n";
|
</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user