Old posts syntax highlighting issues

We know you have an opinion on how things should be run around here. These are suggestions for the forums, and the website.This forum is not a place to ask for suggestions to your own coding (or otherwise) problems.

Moderator: General Moderators

User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Old posts syntax highlighting issues

Post by VladSun »

viewtopic.php?f=2&t=114380&p=599351

I have an SQL code in my post - now it's absolutely unreadable :(

The same applies to viewtopic.php?f=50&t=113253 - even PHP blocks are a mess.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Old posts syntax highlighting issues

Post by Benjamin »

Yeah phpBB actually saves these posts in the database with the html added and line feeds removed. I'm not aware of any method to migrate these to the new format. I resaved all the posts in the second thread. This removed the html but did not restore the line feeds.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Old posts syntax highlighting issues

Post by VladSun »

Hm, when I try to edit my old posts they are still "well-formated" - i.e. it's a plain text surrounded with [ php ] BBtags ... Does phpBB do some "reverse" formatting? I'm not very familiar with phpB, but it seems very hard yo me to do a "reverse formatting" from an HTML to a plain BBcode/plain text. Even if it's done this way, can't you use it to "reformat" to the new version?
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Old posts syntax highlighting issues

Post by Benjamin »

Yes, it actually does that. Either by removing the HTML or somehow parsing it. I haven't had time to dig around in the code in order to figure out how it all works. Even the

Code: Select all

tags are assigned their own unique ID's, which seems pointless to me.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Old posts syntax highlighting issues

Post by VladSun »

VladSun wrote:Hm, when I try to edit my old posts they are still "well-formated" - i.e. it's a plain text surrounded with [ php ] BBtags
Blah, they are not so well-formatted - the new lines are missing.
There are 10 types of people in this world, those who understand binary and those who don't
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Old posts syntax highlighting issues

Post by josh »

The new formatting is great and all, but I don't see why adding a new format has to break the old one, regardless of what phpbb does internally. Just allow the html....

100,000s of thousands of posts are now essentially destroyed....

I don't know what the purpose of coming on this site is if our posts are going to be destroyed by future enhancements.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Old posts syntax highlighting issues

Post by Benjamin »

I agree. I didn't write the code. Unfortunately, we had to upgrade the forums. Perhaps you can research a fix?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Old posts syntax highlighting issues

Post by Benjamin »

Tell you what, I'll take another look at the old records as compared to the new records and report my findings. Perhaps we can write a script to reformat them.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Old posts syntax highlighting issues

Post by AbraCadaver »

It seems to be how the code tags were entered. See here, mine look fine and weiry's look bad: viewtopic.php?f=1&t=109717

The only way I've ever included code is with the

Code: Select all

 tags, [code=php ], [code=sql ], etc...  Were there other ways to do code blocks?

[syntax=php]echo "Testing old [ code=php ] way"; [/syntax]
Last edited by AbraCadaver on Tue Mar 30, 2010 1:52 pm, edited 1 time in total.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Old posts syntax highlighting issues

Post by Benjamin »

Yes. His use php bb tags, while yours used code=php tags.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Old posts syntax highlighting issues

Post by Weirdan »

AbraCadaver wrote:Were there other ways to do code blocks?

Code: Select all

, [sql]
minorDemocritus
Forum Commoner
Posts: 96
Joined: Thu Apr 01, 2010 7:28 pm
Location: Chicagoland, IL, USA

Re: Old posts syntax highlighting issues

Post by minorDemocritus »

I noticed that when I use the [ syntax=php ] form for code blocks, it doesn't give line numbers. Is there any way to add that in, or am I doing it wrong?

I was trying to get the (apparently) old [ code=php ] form to work, but it ate all my code. :banghead: I think the parser doesn't like something in my large code block over in the Coding Critique section... [ syntax=php ] works, but without line numbers, and if i replace [ syntax=php ] bbcode with [ code=php ], previewing eats all my code. Any suggestions?
minorDemocritus
Forum Commoner
Posts: 96
Joined: Thu Apr 01, 2010 7:28 pm
Location: Chicagoland, IL, USA

Re: Old posts syntax highlighting issues

Post by minorDemocritus »

I think the most problematic instance of this is in the Tutorials, as well as the stickies and guidelines. Some of the tutorials seem VERY helpful, but alas, the code blocks are broken!

I'd like to help out with this issue. Should I just report very helpful posts that are stricken with the problem, or is the something more I can do?

I noticed that if you quote one of these problem posts, the editor doesn't keep the HTML mess, it just shows what (I assume) the original contents of the code block is, inside the bbcode tags. So, it should be pretty simple to replace:

Code: Select all

[syntax=php]or
[/syntax]
...with the corrected bbcode tags.

I hesitate to start work on coding a routine for that, since I'm not that familiar with the interworkings of phpBB. I'll get started on learning it, so hopefully I can help out more.

EDIT: OK, wow. I realized that most of the stuff I'm saying was covered days ago, in this very thread. I've got to stop feeling helpful at 4 in the morning. Please forgive, I promise I mean well.
Last edited by minorDemocritus on Thu Apr 08, 2010 3:41 am, edited 1 time in total.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Old posts syntax highlighting issues

Post by josh »

minorDemocritus wrote:I think the most problematic instance of this is in the Tutorials, as well as the stickies and guidelines. Some of the tutorials seem VERY helpful, but alas, the code blocks are broken!
Exactly, For every post that someone made sticky there were 1,000 other that individual people had bookmarked, taken time to write as "notes to themselves", etc.. All gone. :nono:
I noticed that if you quote one of these problem posts, the editor doesn't keep the HTML mess, it just shows what (I assume) the original contents of the code block is, inside the bbcode tags. So, it should be pretty simple to replace:
Exactly. 1 line of code to run old posts thru html_entity_decode http://www.php.net/manual/en/function.h ... decode.php (or bypass whatever is escaping it in the first place).

There is no reason NOT to do this. If you're worried about someone hacking the site thru editing of their old posts you can use HTML purifier or equivalent.

In my opinion this change should be reverted. I'd rather go back to what we had then loose 100s of thousands of posts. As a forum of programmers, we should have tested & thought about the possible consequences before making an abrupt change to a new syntax highlighter that broke backwards compatibility.

Like I said, I am appreciative of the attempted good deed, but whoever made the call to move forward on a new editor, should step up to the plate/man up and fix this or revert it out.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Old posts syntax highlighting issues

Post by Benjamin »

Great theory, however the line feeds are not in the database.
Post Reply