[cBB Blockgets 1.0.3] Bug with title="" inside Recent topics


User avatar
Mathieu M.
 
Posts: 45
Joined: Mon Oct 15, 2012 11:55 am
 Mon Oct 29, 2012 10:09 pm • via Web
Hello,

I found a bug with Recent topics block. If my item has a title="" attribute which contains one or more apostrophes ( " ), it breaks xhtml validation and "cut" the title="".

For example, we can have something like title="I felt "stupid" yesterday". Well, I think we should have title="I felt 'stupid' yesterday".

Am I enough clear in my poor explaination ?
Last edited by Mathieu M. on Tue Nov 27, 2012 11:21 am, edited 2 times in total.
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Tue Oct 30, 2012 1:29 pm • via Web
My apologies but my English is very bad and I don't understand.

I revise the template of news block and I don't find any "title" tag with custom text inside.
I think that a screenshot help me to understand.
User avatar
Mathieu M.
 
Posts: 45
Joined: Mon Oct 15, 2012 11:55 am
 Tue Oct 30, 2012 1:58 pm • via Web
Look at this scrrenshot :

Image

My first <a> tag called "Paris-Bercy-Benneteau: "Même des handballeurs n..." has a title attribute (the entire topic subject) with an apostrophe ( " ). But if you look at the tooltip (and in the code source too), you see "Paris-Bercy-Benneteau: "".

The apostrophe in title attribute breaks everything... It's why I suggested to replace apostrophe ( " ) by a simple apostrophe ( ' )

Am I more clear in my explainations ?


Thanks !
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Tue Oct 30, 2012 2:25 pm • via Web
Ok Ok.
But the problem is in recent topics block and not in news block. For this I don't find the error.
What browser do you use? In Google Chrome the title shows correctly with " because the block put &quot; and not "

To solve the problem:
1. Open /blockgets/block/recent_topics_block.php
2. Find:
Code: Select all
'FULL_TITLE'            => $row['topic_title'],

3. Replace with:
Code: Select all
'FULL_TITLE'            => str_replace('&quot;', "'", $row['topic_title']),


Thanks for the report.
User avatar
Mathieu M.
 
Posts: 45
Joined: Mon Oct 15, 2012 11:55 am
 Tue Oct 30, 2012 6:31 pm • via Web
Admin wrote:But the problem is in recent topics block and not in news block. For this I don't find the error.


Oops sorry, my mistake

Admin wrote:What browser do you use? In Google Chrome the title shows correctly with " because the block put &quot; and not "


I use Firefox 16, but the problem is the same with Google Chrome for me.

Admin wrote:3. Replace with:

Code: Select all
    'FULL_TITLE'            => str_replace('&quot;', "'", $row['topic_title']),


Well, it works only if I replace with :

Code: Select all
    'FULL_TITLE'            => str_replace('"', "'", $row['topic_title']),


Admin wrote:Thanks for the report.


Thanks for all your hard work
User avatar
Mathieu M.
 
Posts: 45
Joined: Mon Oct 15, 2012 11:55 am
 Tue Nov 27, 2012 11:22 am • via Web
Hello,

This bug hasn't be resolved in cBB Blockgets 1.0.3

Open : recent_topic_blocks.php

Find :
Code: Select all
'FULL_TITLE'            => str_replace(array('&quot;', '"'), "'", $row['topic_title']),

Replace with :
Code: Select all
'FULL_TITLE'            => str_replace(array('"', '&quot;'), "'", $row['topic_title']),


There's the same problem in topic_index_block.php :

Find :
Code: Select all
'FULL_TITLE'            => str_replace('&quot;', "'", $row['topic_title']),

Replace with :
Code: Select all
'FULL_TITLE'            => str_replace('"', "&quot;", $row['topic_title']),
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Tue Nov 27, 2012 12:05 pm • via Web
I dont understand this.
In the first, you change " and &quot; to '
But, in the second, you replace " to &quot; and not to '

PD: array('&quot;', '"'), "'" and array('"', '&quot;'), "'" is the same. In the two cases all &quot; and " are converted to '
User avatar
Mathieu M.
 
Posts: 45
Joined: Mon Oct 15, 2012 11:55 am
 Tue Nov 27, 2012 12:21 pm • via Web
Oops sorry, it's my mistake (I used "copy/paste" a bit too fast...)

In the both case, I have to replace with :

Code: Select all
'FULL_TITLE'            => str_replace('"', "&quot;", $row['topic_title']),


In this way, the double apostrophe (") is converted to its HTML entity. If we don't do it, it breaks XHTML validation and breaks the title attribute.
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Tue Nov 27, 2012 12:37 pm • via Web
In my case, use str_replace('"', "&quot;", $row['topic_title']), or use directly $row['topic_title'] produces the same effect.
In the browser appears as &quot; in the two cases. In the database, " is saved as &quot; always.
What is your database? (mysql, mysqli, mssql...)
User avatar
Mathieu M.
 
Posts: 45
Joined: Mon Oct 15, 2012 11:55 am
 Tue Nov 27, 2012 1:32 pm • via Web
I've mysqli DB
Perhaps it's a Firefox issue, but in my case, " isn't convert to &quot; with current 1.0.3.

PS: My problem with js and css header files is solved with a clean and fresh installation on my website.
Next

Who is online

Users browsing this forum: No registered users and 0 guests