Changeset 24833


Ignore:
Timestamp:
10/10/13 12:53:59 (6 years ago)
Author:
mistic100
Message:

make get_query_string_diff compatible with arrays and use build-in functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r24350 r24833  
    764764  } 
    765765 
    766   $query_string = ''; 
    767  
    768   $str = $_SERVER['QUERY_STRING']; 
    769   parse_str($str, $vars); 
    770  
    771   $is_first = true; 
    772   foreach ($vars as $key => $value) 
    773   { 
    774     if (!in_array($key, $rejects)) 
    775     { 
    776       $query_string.= $is_first ? '?' : ($escape ? '&' : '&' ); 
    777       $is_first = false; 
    778       $query_string.= $key.'='.$value; 
    779     } 
    780   } 
    781  
    782   return $query_string; 
    783 } 
    784  
     766  parse_str($_SERVER['QUERY_STRING'], $vars); 
     767 
     768  $vars = array_diff_key($vars, array_flip($rejects)); 
     769   
     770  return '?' . http_build_query($vars, '', $escape ? '&' : '&'); 
     771} 
     772 
     773/** 
     774 * returns true if the url is absolute (begins with http) 
     775 * @param string $url 
     776 * @returns boolean 
     777 */ 
    785778function url_is_remote($url) 
    786779{ 
Note: See TracChangeset for help on using the changeset viewer.