Results 1 to 10 of 809

Hybrid View

  1. #1
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: upgrading this plugin

    Design75 ... do you mind if I challenge that?

    I'm thinking that code change is redundant. Can you help me understand what I'm missing?
    Note the things I've highlighted below, as I think your suggested code change is duplicating what's already in that function's logic:

    Code:
      function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
        if (!is_array($exclude_array)) $exclude_array = array();
        $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
        $get_url = '';
        if (is_array($_GET) && (sizeof($_GET) > 0)) {
          reset($_GET);
          while (list($key, $value) = each($_GET)) {
    // bof dynamic filter 1 of 1
            if ( (!in_array($key, $exclude_array)) && (is_string($value) && strlen($value) > 0 || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 1
              if (!is_array($value)) {
                if (strlen($value) > 0) {
                  $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
                }
              } else {
                foreach(array_filter($value) as $arr){
                  $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
                }
              }
            }
          }
        }
        while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
        while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    
        return $get_url;
      }
    My point is really: if no changes are needed, then it's better not to touch the file.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: upgrading this plugin

    Quote Originally Posted by DrByte View Post
    Design75 ... do you mind if I challenge that?

    I'm thinking that code change is redundant. Can you help me understand what I'm missing?
    Note the things I've highlighted below, as I think your suggested code change is duplicating what's already in that function's logic:

    Code:
      function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
        if (!is_array($exclude_array)) $exclude_array = array();
        $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
        $get_url = '';
        if (is_array($_GET) && (sizeof($_GET) > 0)) {
          reset($_GET);
          while (list($key, $value) = each($_GET)) {
    // bof dynamic filter 1 of 1
            if ( (!in_array($key, $exclude_array)) && (is_string($value) && strlen($value) > 0 || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 1
              if (!is_array($value)) {
                if (strlen($value) > 0) {
                  $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
                }
              } else {
                foreach(array_filter($value) as $arr){
                  $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
                }
              }
            }
          }
        }
        while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
        while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    
        return $get_url;
      }
    My point is really: if no changes are needed, then it's better not to touch the file.
    I must admit I do not fully understand the code , but just compared old 1.5.1 and new 1.5.4 vanilla files end the code from the mod.
    This was the line that was left after comparing, but is you say it is not needed, (and after some better reading of that code block) I agree it seems unnecessary.
    I am going to test it right now, and will report back.

 

 

Similar Threads

  1. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 22
    Last Post: 26 Jan 2026, 06:47 AM
  2. Empty Dynamic Filter
    By LadyoftheCave in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 6 Jun 2016, 12:47 PM
  3. v150 Dynamic filter
    By Dinoleix in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 13 Aug 2013, 10:23 AM
  4. v150 Dynamic filter - All pages
    By Okkwebmedia in forum Addon Sideboxes
    Replies: 0
    Last Post: 8 Jul 2013, 08:52 AM
  5. v138a Dynamic Filter
    By SoftCorpse in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 18 Jun 2012, 01:32 PM

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