Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Lists in BBCode borking comments
pbear
New
(Long post here, so I'm going to break it up into three parts.)
I tried to test making an ordered and unordered list in a comment via BBCode, but something is wrong. I have the BetterBBCode 1.0 and BBInsertBar 0.1.5 extensions installed. I'm running this locally (nothing online atm) as I'm figuring out how Vanilla works. I searched here for BBCode posts, but didn't find this problem.
For unordered and ordered lists, respectively, BBInsertBar gives me:
and:
I added additional items in the list part...:
Only the first got interpreted with a bullet (here, an "o"). The rest showed the raw BBCode:
I tried several things. Closing [/*] tags on each list item, etc. Nothing worked. Then I opened the BBCodeParser.php module and saw no * was listed, but li was.
So I entered it manually:
This borked the layout seriously. I got a string of my avatar pic across one line. Then I immediately tried a second (now ordered) list. Foolish perhaps. This really messed the layout up. As the unordered list but worse.
Then I copied the source code and checked the nesting. The previous discussion ended ok:
The closing ol with id="Comments" and the closing div with id="ContentBody" that normally follow when this was the last message were improperly moved/removed, but after I added an unordered list using [li] instead of [*] for the list item marker.
(two more parts to go, continued...)
I tried to test making an ordered and unordered list in a comment via BBCode, but something is wrong. I have the BetterBBCode 1.0 and BBInsertBar 0.1.5 extensions installed. I'm running this locally (nothing online atm) as I'm figuring out how Vanilla works. I searched here for BBCode posts, but didn't find this problem.
For unordered and ordered lists, respectively, BBInsertBar gives me:
[ulist]
[*]
[/ulist]
and:
[list]
[*]
[/list]
I added additional items in the list part...:
[*]first item
[*]second item
[*]third item
Only the first got interpreted with a bullet (here, an "o"). The rest showed the raw BBCode:
o first item
[*]second item
[*]third item
I tried several things. Closing [/*] tags on each list item, etc. Nothing worked. Then I opened the BBCodeParser.php module and saw no * was listed, but li was.
So I entered it manually:
[ulist]
[li]first item
[li]second item
[li]third item
[/ulist]
This borked the layout seriously. I got a string of my avatar pic across one line. Then I immediately tried a second (now ordered) list. Foolish perhaps. This really messed the layout up. As the unordered list but worse.
Then I copied the source code and checked the nesting. The previous discussion ended ok:
<li> ...
<div class="CommentBody" id="CommentBody_65">(comment text here)</div>
</li>
The closing ol with id="Comments" and the closing div with id="ContentBody" that normally follow when this was the last message were improperly moved/removed, but after I added an unordered list using [li] instead of [*] for the list item marker.
(two more parts to go, continued...)
0
This discussion has been closed.
Comments
In this code block I've added comments indicating what needs to be removed, and at the end in a comment what tags should be added to fix the problem. When the code is adjusted this way, the page displays correctly once again (i.e. not a CSS styling glitch). Skip past the code block for the summary.
Here's the comment section that begins the first unordered list post:
<li id="Comment_66"> <a name="Item_3"></a> <div class="CommentHeader"> <ul> <li> <div class="CommentIcon" style="background-image: url(http://.../avatar.jpg);"> </div> <span>CommentAuthor</span> <a href="http://.../account.php?u=1">pbear</a> </li> <li> <span>CommentTime</span>5 minutes ago </li> </ul> <span> Comment posted from 127.0.0.1 <a href="http://.../post.php?CommentID=66">edit</a> <a id="HideComment66" href="./" onclick="HideComment('/forum/ajax/switch.php'>hide</a> <a onmousedown="quote(this);">quote</a><a href="#Item_3" id="Permalink_3">permalink</a> </span> </div> <div class="CommentBody" id="CommentBody_66"> <ul><br> <li>an unordered list<br></li> <li>that has li instead of *<br></li> <li>does it work?<br></li> </ul> <!-- 3 extra li sets were inserted here --> <li></li> <li></li> <li></li> <!-- these two are ok --> </div> </li> <!-- These two tags were improperly moved/removed/inserted: --> </ol> </div> <!-- next comment containing an ordered list starts like this --> <li id="Comment_67"> <a name="Item_4"></a> <div class="CommentHeader"> <!-- comment author info here... --> <!-- IP edit quote permalink here... --> </div> <div class="CommentBody" id="CommentBody_67"> yes ulist with li works!!!<br><br> <ul><br> <li>and ordered list<br></li> <li>that uses li instead of *<br></li> <li>does this work?<br></li> </ul> <!-- an additional 3 extra li's! were inserted here --> <li></li> <li></li> <li></li> </div> </li> <!-- this div is wrongly inserted --> </div> <li id="Comment_68"> <a name="Item_5"></a> <div class="CommentHeader"> <!-- comment author info here... --> <!-- IP edit quote permalink here... --> </div> <div class="CommentBody" id="CommentBody_68"> <!-- this is the content of a post made after the two above that messed things up --> <strong>(something here)</strong> </div> </li> <!-- this div is wrongly inserted --> </div> <!-- The following two tags must be added to properly finish nesting this block of comments </ol> </div> --> <!-- the final div/section begins properly --> <div class="ContentInfo Middle">
(one more part to go, continued...)
So... to fix, I had to:
- Remove the two blocks of three sets of li tags,
- Remove the ol and div closing tags that were placed after Comment_66,
- Remove the closing div tag at the end of the next two messages,
- Add the closing ol and div tags at the end of the last commment (68) but before the ContentInfo Middle opening div.
There's the possibility that I've got something else going on. Basic Vanilla 1 install (albeit locally via MAMP/OS X) with some extensions going. Any clues?Besides the tag scrambling going on, I was also wondering:
[cite=marktwain] becomes <cite class="marktwain">
or
[cite=kjv] becomes <cite class="kingjamesversion">
... which kind of thing might be useful for more boards focused on certain authors or texts. The different class attributes can then be singled out for styling easily via a custom stylesheet.
(maybe someone could post what that BBCodeParser syntax would look like? )
In this particular bug comment, scroll down a bit to see Seth's note: He's made an updated BBCodeParser file too.
From the BetterBBCode extension:
//List $pattern = array( "!".$oe."\*".$ce."(.*)!i", "!".$oe."list".$ce."(.+)".$oe."/list".$ce."!isU"); $replace = array( $o."li".$c."\\1".$o."/li".$c, $o."ulist".$c."\\1".$o."/ulist".$c); $this->_preparsed = preg_replace($pattern, $replace, $this->_preparsed);
I can't help but feel that that second part ($replace) is supposed to say ol instead of ulist. And that there should be another pattern/replace bit for ulist as it seems to start out for list.
Found something better. Check the comment that refers to lists in the middle of the version 1.9 file available here (cvs.php.net). It seems to be the same problem.
To wit:
/* why is this here? it just seems to break things * (nested lists where closing tags need to be * generated) while (end($tmpOpenTags)) { $tmpTag = $this->_buildTag('['.end($tmpOpenTags).']'); $newTagArray[] = $tmpTag; $openTags[] = $tmpTag['tag']; array_pop($tmpOpenTags); }*/
Bonus: this seems to have integrated (all?) the changes from the file mentioned above (pricepages.org, done by the same guy).
(that's not really good news but I had a list going already).
I can now have nested lists that work, it's a miracle. I've probably opened up my forums to god knows what security vulnerabilities as I haven't got a blind clue what I really did, but I don't really care as their internal anyhow Let me just tidy things up a little bit (and check that I haven't broken other parts) then I'll post the file.
But the main thing is it works, two ways if you're willing to get your hands a little dirty.
I'm pretty sure that the 2nd way is "the right way" to do things if I can solve the paths issue (help!), so
I poked around with it last summer, but only - half - partly - barely understand what's going on. I grabbed the "latest" from the Pear project and hacked away. Perhaps you code monkeys can sift through it with the above solutions you've figured out.
Happy Thanksgiving!