[SOLVED] CGCalendar frontend edit encodes html tags to named encoding

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
Mantlet
Forum Members
Forum Members
Posts: 114
Joined: Fri Apr 28, 2006 9:42 am
Location: Haarlem - Netherlands

[SOLVED] CGCalendar frontend edit encodes html tags to named encoding

Post by Mantlet »

Hi All,

I've been trying to get the frontend edit part of CGCalendar to work. It works well when I add plain text to the textarea's. However, when I add a HTML tag, the get's converted to <p&gt

When editing this textarea through the admin side, it does save with the normal encoding. What do I need to change to make sure the frontend doesn't mess with the encoding as well?

Thanks a bunch, maybe even a million  ;)

I use the following config:
----------------------------------------------

Cms Version: 1.8.2

Installed Modules:

CMSMailer: 2.0
FileManager: 1.0.2
MenuManager: 1.6.5
ModuleManager: 1.4
News: 2.10.6
nuSOAP: 1.0.2
Printing: 1.1.0
Search: 1.6.5
ThemeManager: 1.1.1
TinyMCE: 2.7.2
CustomContent: 1.7.3
Captcha: 0.4.3
CGExtensions: 1.20
FormBuilder: 0.6.4
FrontEndUsers: 1.12.3
NMS: 2.3.2
CGSimpleSmarty: 1.4.5
CGGoogleMaps: 1.5.6
CGCalendar: 1.5.6
FileBackup: 0.5
SelfRegistration: 1.6.5
Gallery: 1.4.1
CGFeedMaker: 1.0.11

Config Information:

php_memory_limit:
process_whole_template: false
output_compression: false
max_upload_size: 128000000
default_upload_permission: 664
url_rewriting: mod_rewrite
page_extension:
query_var: page
use_hierarchy: true
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:

phpversion: 5.2.13
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
memory_limit: 128M
max_execution_time: 60
output_buffering: On
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 128M
upload_max_filesize: 128M
session_save_path: No check because open basedir active
session_use_cookies: On (True)
xml_function: On (True)

Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.1.48

----------------------------------------------
Last edited by Mantlet on Fri Oct 15, 2010 9:22 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: CGCalendar frontend edit encodes html tags to named encoding

Post by Dr.CSS »

Most likely the template for front end editing has some code like |escapehtmlentities or some such, this may be to prevent anyone from adding some cross browser scripting, look thru the template for it and change it if you need to...
Mantlet
Forum Members
Forum Members
Posts: 114
Joined: Fri Apr 28, 2006 9:42 am
Location: Haarlem - Netherlands

Re: CGCalendar frontend edit encodes html tags to named encoding

Post by Mantlet »

I've found my own workaround. Not fully tested, so I hope it works completely. If it does though, the great thing is, is that is works fully in the display and edit template. So you can upgrade the cgcalendar, without overwriting your own changes.

For each edit field you add this in the addedit_event template "|htmlspecialchars_decode":

Code: Select all

{if isset($fields)}
{foreach from=$fields item='field'}
<div class="row">
  <p>{$field->name}:<br/>
    {$field->field|htmlspecialchars_decode}
  </p>
</div>
{/foreach}
{/if}
You do the same for each display of these fields:

Code: Select all

{$event.fields.fieldname|htmlspecialchars_decode}
This converts all encoded html chars back to normal chars.
Locked

Return to “Modules/Add-Ons”