cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-17 14:14
Návrat hore
Odpovedať s citátom
|
Hi all,
I am using PME instead of PhpMyAdmin to update my website which is store in MySQL.
So I am editing HTML !
My current issue is linked to "special characters"
When I am entering < :
1- In MySQL, the result is well stored as <
2- In PME, it is displayed: <
3- If I edit another time this code, as it is displayed < instead of < the special character is not stored as < but with <
Of course, I have already tested
| Kód: |
| $opts['fdd']['column']['escape'] = false; |
But it doesn't work !
Can you help me?
Thanks,
Cyril.
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-18 18:03
Návrat hore
Odpovedať s citátom
|
Try strip_tags|LF instead of escape and see if that gives you what you want.
| Kód: |
$opts['fdd']['content'] = array(
'default' => '',
'input' => '',
'name' => 'Content',
'options' => 'ACPVDFL',
'select' => 'T',
'sqlw' => 'TRIM("$val_as")',
'strip_tags|LF' => true,
'textarea' => array('rows' => '30', 'cols' => 80),
'trimlen|LF' => 20,
'sort' => false
); |
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-19 12:37
Návrat hore
Odpovedať s citátom
|
| doug Napísal: |
Try strip_tags|LF instead of escape and see if that gives you what you want.
);[/code] |
Le HTML code is never display in the list view, it is only editable in the following :
A - add,
C - change,
P - copy,
D - delete,
In the "V - view", the HTML code is not displayed but I can this the result itself, which is fine for me !
I have tried to use :
$opts['fdd']['Contenu']['strip_tags'] = false;
but it still doesn't work !
Any other idea ?
Thanks,
Cyril.
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-19 13:29
Návrat hore
Odpovedať s citátom
|
Probably it is best if you post the code from the entire script so that all the code can be seen.
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-19 22:54
Návrat hore
Odpovedať s citátom
|
Here is my code:
| Kód: |
$opts['fdd']['Contenu'] = array(
'name' => 'Contenu',
'options' => 'AVCPD',
'select' => 'T',
'maxlen' => -1,
'textarea' => array(
'rows' => 50,
'cols' => 135),
'tab' => 'Contenu',
'sort' => true
);
$opts['fdd']['Contenu']['strip_tags'] = false;
|
Do you want the whole page?
Thanks for your help,
Cyril
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-19 23:13
Návrat hore
Odpovedať s citátom
|
No, I guess I missed the part about "In MySQL, the result is well stored as <"
I fail to understand why you don't simply store the HTML (not enough brain cells on my end to understand your reasoning and/or purpose).
For the 'content' field example that I posted above, I always store the HTML just the way it is. In the text content I might use " to replace " or & to replace & but otherwise just store the HTML. Works fine for 100 websites so far.
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-19 23:24
Návrat hore
Odpovedať s citátom
|
| doug Napísal: |
No, I guess I missed the part about "In MySQL, the result is well stored as <"
I fail to understand why you don't simply store the HTML (not enough brain cells on my end to understand your reasoning and/or purpose).
For the 'content' field example that I posted above, I always store the HTML just the way it is. In the text content I might use " to replace " or & to replace & but otherwise just store the HTML. Works fine for 100 websites so far. |
So, when you are doing the following:
1- Add a new content with for exemple:
2- Save
3- Edit this new content
=> You can see and not " "
For me, I got: " "
- Cyril
Naposledy upravil cbek dňa 2009-04-20 00:30, celkom upravené 1 krát
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-19 23:45
Návrat hore
Odpovedať s citátom
|
'maxlen' should not be a negative number. Perhaps that is part of the problem. Otherwise, I am out of ideas.
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-20 00:42
Návrat hore
Odpovedať s citátom
|
| doug Napísal: |
| 'maxlen' should not be a negative number. Perhaps that is part of the problem. Otherwise, I am out of ideas. |
This is the same without 'maxlen' :-(
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-20 01:16
Návrat hore
Odpovedať s citátom
|
You can test my problem here: http://www.telethon95.fr/pme_pages.php
=> In this page, you can see the special caracter
Then, when you want to edit the content:
http://www.telethon95.fr/pme_pages.php?PME_sys_fl=0&PME_sys_fm=0&PME_sys_sfn[0]=0&&PME_sys_operation=PME_op_Change&PME_sys_rec=0_Actu
=> it is replace by " "
Then, if you ask your browser to display the HTML code, then you can see !!!
| Kód: |
<textarea class="pme-input-0" name="PME_data_Contenu" rows="20" cols="50" wrap="virtual"><div class="block">
€
</div></textarea> |
Why am I not seeing € like in the HTML source?
Ok, I'm going to sleep :-)
Cyril.
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-20 11:13
Návrat hore
Odpovedať s citátom
|
After several tests, here is my understanding.
To work properly, my HTML code need to be escaped.
It's working well in the list view but not in the edit view (with <textearea>).
I have found in phpMyEdit.class.php the htmlTextarea function with the following code:
| Kód: |
| if($escape) $ret .= htmlspecialchars($value); |
Just before this code, I have added the following line :
| Kód: |
| echo 'DEBUG $escape='.$escape; |
=> $escape doesn't contain true !
In fact i got "$escape=" so $escape is empty !!!
I am using the v1.212 and php 5
Do you have an idea?
P.S.: You can test here : http://www.telethon95.fr/pme_pages.php
Thanks,
Cyril.
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-04-20 11:36
Návrat hore
Odpovedať s citátom
|
I don't know if it is good, but here is the update I made in phpMyEdit.class.php
1:
| Kód: |
function display_change_field($row, $k) /* {{{ */
{ |
Become:
| Kód: |
function display_change_field($row, $k) /* {{{ */
{
GLOBAL $escape; |
2:
| Kód: |
function htmlTextarea($name, $css, $k, $value = null, $js = NULL)
{ |
Become:
| Kód: |
function htmlTextarea($name, $css, $k, $value = null, $js = NULL)
{
GLOBAL $escape; |
Now, $escape is well tested in the htmlTextarea function and it's working fine for me !
QUESTION : My correction is it good?
Thanks,
Cyril.
|
cbek
Založený: 25.10.2008
Príspevky: 27
Zaslal: 2009-05-05 07:00
Návrat hore
Odpovedať s citátom
|
| cbek Napísal: |
| QUESTION : My correction is it good? |
Up ;-)
|
|
Odoslať novú tému
Odpovedať na tému
|