PhotoPost Community

PhotoPost Community (http://www.photopost.com/forum/)
-   Bugs - vBulletin 3.6x (http://www.photopost.com/forum/bugs-vbulletin-3-6x/)
-   -   Image and category name,description fix [added 2.2] (http://www.photopost.com/forum/bugs-vbulletin-3-6x/130970-image-category-name-description-fix-added-2-2-a.html)

Zachariah March 16th, 2007 07:32 PM

Image and category name,description fix [added 2.2]
 
There was a problem reported on a Chinese website of not recording or displaying the correct characters on categories and images.

category
- title
- description

image
- title
- description

Below fixed the problem.

forums\admincp\vba_gallery_admin.php

Find:
Code:

Content visible to verified customers only.
Replace:
Code:

Content visible to verified customers only.
gallery\ecard.php

Find:
Code:

Content visible to verified customers only.
Replace:
title = '" . addslashes($image['title']) . "'

Find:
Code:

Content visible to verified customers only.
Delete

Find:
Code:

Content visible to verified customers only.
Above Add:
Code:

Content visible to verified customers only.
gallery\upload.php

Find:
Code:

Content visible to verified customers only.
Replace:
Code:

Content visible to verified customers only.
Find:
Code:

Content visible to verified customers only.
Replace:
Code:

Content visible to verified customers only.

Luciano March 17th, 2007 08:44 AM

Thx for the fix..
as a matter of fact i ran into a similar problem when passing chinese characters via javascript (ajax) to a php script. Example: saving title not via the form but via ajax.

The problem resides in the fact that you have to be in utf8 for chinese characters to display. and javascript doesnt urlencode those characters the same way as php decodes them. even though vbullentin has a very nice function to strip the html on unicode characters, the & problem is still there.

So if you really want that htmlspecialchars function, you can use the vbulletin one for unicode charachters (functions.php must be loaded):

Code:

Content visible to verified customers only.
Thats how I tested it.. and it seemed to work...

Also for urldecoding chinese characters you can use:
Code:

Content visible to verified customers only.
found also in the functions.php

Some thoughts:
I found (by trying) 2 ways of correctly inserting chinese image title into the database and getting it out again with no problem:
the database has to be in utf8 collation!
For all table and text-or-varchar fields in utf8_general_ci
You cant do it later..(or its a pain in t.a...) It has to be done at setup!!!

I think this must be the major problem.. because I do NOT have that problem other than when sending the text by javascript!!!!.. (I spent 2 full days setting the database up correctly)


1. using the built in vbulletin functions:
the text arrives via post or get -->
before inserting it into the databse:
Code:

Content visible to verified customers only.
Now if I insert it into the database now.. it will appear correctly when i get it out again..

BUT .. if I want to display it immediately (after saving it.. but without getting it from the database again!! before displaying it) I will have to convert all & to &!!! (dont ask me why!!!) It seems that the database does that automatically... maybe it depends on the version? i'm using MySQL4.19

I then need your function:
Code:

Content visible to verified customers only.
before the txt is displayed correctly!
So thats what i did (It worked on my tests but i only tested with a couple of chinese characters..)

A yes and for those who do not want the vbulletin functions.. here is the second way ( I got it to work like that the first time):

Code:

Content visible to verified customers only.
thats all...

Luc


All times are GMT -5. The time now is 08:24 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97