Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Trying to us html in a define... HELP PLEASE!

    When I use quote marks ( " ) in a define, the quote turn into unicode ( ").

    I added this as my defined HEADER_SEARCH_BUTTON in includes/languages/english/MY_TEMPLATE/header.php:
    <i class="fa fa-search" aria-hidden="true"></i>&nbsp;Search

    When I load the page and check source, finding this:
    <i class=&quot;fa fa-search&quot; aria-hidden=&quot;true&quot;></i>&nbsp;Search

    Can somebody tell me how to escape those quotes? Or is that not my issue?

    ++++
    In case you want to see what it does, check the search button on the right of my top blue bar:
    https://002mc.justmedical.biz/Produc...-Test-1-Images

  2. #2
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Headed in the right direction... ?

    I changed this:
    define('HEADER_SEARCH_BUTTON','<i class="fa fa-search" aria-hidden="true"></i>&nbsp;Search');

    To this:
    define('HEADER_SEARCH_BUTTON',print '<i class="fa fa-search" aria-hidden="true"></i>&nbsp;Search');

    Seemed helpful-ish.

  3. #3
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Trying to us html in a define... HELP PLEASE!

    Why not try instead of "
    To use \"
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  4. #4
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    I'm pretty sure my define is getting cleaned. Even when I escape the quote mark ( \" ), I wind up with ( \&quot; ).

    Using "print" is the closest I've gotten. When I do that, the icon I want shows up, but it's at the very top of the screen and cannot be touched. Also the print default value of "1" shows up in the search box.

    I'll leave it like that for a while, I guess. I enlarged it to make it easier to see. But you have to look at the upper left corner of the page to see the icon. And you can see the number "1" on the button to the right of the search input box.

  5. #5
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    MC, I can put that escaped define back in if you want.

    But this is what it yields:
    <i class=\&quot;fa fa-search\&quot; aria-hidden=\&quot;true\&quot;></i>&nbsp;Search

  6. #6
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Btw, I've used that trick ( \" ) effectively in this EXACT cart. But that was for a language file in the admin.

    What I'm thinking is that there must be a cleaner in place, just in case folks try to use bad characters in the catalog language defines. I just need to figure out what's calling that and kill it!

  7. #7
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Small victory: I just managed to insert a symbol into a product description by inserting the call ( <i class="fa fa-search fa-5x" aria-hidden="true"></i> ) directly into the database (rather than using the admin product update page).

    https://002mc.justmedical.biz/Produc...-Test-1-Images

  8. #8
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Trying to us html in a define... HELP PLEASE!

    Quote Originally Posted by Feznizzle View Post
    Btw, I've used that trick ( \" ) effectively in this EXACT cart. But that was for a language file in the admin.

    What I'm thinking is that there must be a cleaner in place, just in case folks try to use bad characters in the catalog language defines. I just need to figure out what's calling that and kill it!
    But this is also a language file, no? Thought we were talking about trying to use standard HTML in the language header define HEADER_SEARCH_BUTTON which when I did a search for that I didn't find on a standard ZC install that the define was even used in the common/header.php file on the store side. What that means is that yes where it is being used as the output it is being sanitized by the display code.

    Now as for entering data in the admin and it being sanitized? Yes there is expected to be a level of that performed and what/how it is sanitized depends on the field and how it is used. The thing is, the sanitization is intended to offer a level of protection by not storing some items as raw html in the database as a security measure.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  9. #9
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Yes, this is a language file: includes/languages/english/MY_TEMPLATE/header.php

    Edited like this:
    define('HEADER_SEARCH_BUTTON', '<i class="fa fa-search" aria-hidden="true"></i>');

    I understand sanitizing the db, but I'm confused by why the language file won't allow me to escape special characters ( \" )?

    The admin language file (admin/includes/language/english.php) allowed me to do this:
    define('ERROR_EDITORS_FOLDER_NOT_FOUND', 'You have an HTML editor selected via Configuration>My Store>HTML Editor, but the \'/'.DIR_WS_EDITORS.'\' folder cannot be located. Please disable your selection or move your editor files into the \''.DIR_WS_CATALOG.DIR_WS_EDITORS.'\' folder.<br ><br ><strong>REMINDER: </strong> You specified the editor folder name ('.DIR_WS_EDITORS.') in the config file located at '.DIR_FS_ADMIN.'inludes/configure.php');

    When I use the back slash in the HEADER_SEARCH_BUTTON, the backslash comes thru literally and the " gets turned into unicode.

  10. #10
    Join Date
    Jul 2012
    Posts
    11,627
    Plugin Contributions
    13

    Default Re: Trying to us html in a define... HELP PLEASE!

    Quote Originally Posted by Feznizzle View Post
    Yes, this is a language file: includes/languages/english/MY_TEMPLATE/header.php

    Edited like this:
    define('HEADER_SEARCH_BUTTON', '<i class="fa fa-search" aria-hidden="true"></i>');

    I understand sanitizing the db, but I'm confused by why the language file won't allow me to escape special characters ( \" )?

    The admin language file (admin/includes/language/english.php) allowed me to do this:
    define('ERROR_EDITORS_FOLDER_NOT_FOUND', 'You have an HTML editor selected via Configuration>My Store>HTML Editor, but the \'/'.DIR_WS_EDITORS.'\' folder cannot be located. Please disable your selection or move your editor files into the \''.DIR_WS_CATALOG.DIR_WS_EDITORS.'\' folder.<br ><br ><strong>REMINDER: </strong> You specified the editor folder name ('.DIR_WS_EDITORS.') in the config file located at '.DIR_FS_ADMIN.'inludes/configure.php');

    When I use the back slash in the HEADER_SEARCH_BUTTON, the backslash comes thru literally and the " gets turned into unicode.
    It's not the language file that is the issue, its how the defined variable is "processed" on the other end (ie. typically template or module file that pushes the content to the browser which is doing the sanitization.) So need to be looking at the usage location(s) for what is going on. Search of files indicates that in a default install for the most part it looks like trying to put this image information within the zen_image_submit button and/or the value of an input submit button...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 7
    Last Post: 23 Apr 2017, 06:39 AM
  2. Define in Help Please. Newbe
    By Moneyshott in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 15 Dec 2011, 12:38 AM
  3. Please Help trying to setup PayPal Pro
    By ellisn in forum PayPal Website Payments Pro support
    Replies: 17
    Last Post: 9 Aug 2008, 12:12 PM
  4. Page Define Help Please
    By caradelrae in forum Basic Configuration
    Replies: 1
    Last Post: 30 May 2006, 06:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR