PDA

View Full Version : Upgrade bug - HTML tags in exhibition "Free textual info" stripped (MANUAL FIX HERE)


DavidW
4th of October 2006 (Wed), 12:33
As per the subject, the upgrade process from 1.5RC4 to 2.0 stripped the HTML tags from the Free textual info fields of my exhibitions.

This is only a nuisance bug - all I had to do was open the old backup in a text editor, search for the appropriate database fields, then copy and paste them to the Exhibition Editor. However, it may be worth fixing at some point.



David

MMCM
4th of October 2006 (Wed), 17:25
I have the same problem with this "feature".
I do use a lot of links and <img> tags in my gallery descriptions and news and <br> to separate lines.
All of them gone :-(

I'm testing on a copy of the web site, so it would be fine if there was an "updated" updater that does not exhibit this behaviour.

Additionally I use a lot of &#nnn; to display international characters (in gallery titles & descriptions). The are mostly displayed as it should be, but on the left side of the index page the actually appear as "&#nnn;"

For the original EE 1.5 RC4 gallery see: http://www.photo-photo.at/

best regards
Martin

P.S. I'm really excited that EE 2.0 is out!!!

Pekka
4th of October 2006 (Wed), 17:31
To remove description tag removal remove or comment out lines 4059-4104 from upgrade.php:


while ($row = mysql_fetch_array($query_get_exhibitions)) {

$id = $row["ee_exhibition_id"];

mysql_data_seek($get_languages,0);

while ($row = mysql_fetch_array($get_languages)) {
$language = $row["ee_language_var"];
$query_get_exhibition_description_sql = "
SELECT
ee_exhibition_{$language}.ee_exhibition_descriptio n
FROM
ee_exhibition_{$language}
WHERE
ee_exhibition_{$language}.ee_exhibition_id = '{$id}'
AND (ee_exhibition_{$language}.ee_exhibition_descripti on LIKE '%<%' OR ee_exhibition_{$language}.ee_exhibition_descriptio n LIKE '%>%')
LIMIT 1

";
$query_get_exhibition_description = @mysql_query($query_get_exhibition_description_sql );
$has_tags = @mysql_num_rows($query_get_exhibition_description) ;
if ($has_tags === 1) {
$olddescription = stripslashes(mysql_result($query_get_exhibition_de scription,0));
$newdescription = str_replace("<br>"," ",$olddescription);
$newdescription = str_replace("<br />"," ",$newdescription);
$newdescription = str_replace("<BR />"," ",$newdescription);
$newdescription = str_replace("<BR />"," ",$newdescription);
$newdescription = addslashes(strip_tags($newdescription));

$query_update_data_sql = "
UPDATE
ee_exhibition_{$language}
SET
ee_exhibition_{$language}.ee_exhibition_descriptio n = '{$newdescription}'
WHERE
ee_exhibition_{$language}.ee_exhibition_id = '{$id}'
LIMIT 1
";
$query_update_data = @mysql_query($query_update_data_sql);
print "<br>tags stripped from exhibition {$id} description";
flush();
}
print "\n\n\n";
mysql_free_result($query_get_exhibition_descriptio n);
}
}

Reason for this messy removal code was this: I have tested upgrade with lots of galleries and many people add bad html into descriptions, unclosed tags etc. It will break a) XHTML validation and b) layouts get messy with html errors - and EE gets the blame "why the templates look so bad". It should have been an optional feature in upgrade but time was limited as always. If I would have good validation code and fixer I would have been happy to use that instead :)