Changeset 286 for tags/2.0.2


Ignore:
Timestamp:
Oct 21, 2007 1:01:28 AM (17 years ago)
Author:
quinn
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/2.0.2/lib/App.inc.php

    r157 r286  
    668668        // Get the first delimiter that is needed in the url.
    669669        $delim = strpos($url, '?') !== false ? ini_get('arg_separator.output') : '?';
    670 
     670       
     671        // Separate any #anchor component.
     672        preg_match('/^([^#]+)#([^#]+)$/i', $url, $anchor_match);
     673        if (isset($anchor_match[2])) {
     674            $url = $anchor_match[1];
     675            $anchor = '#' . $anchor_match[2];
     676        } else {
     677            $anchor = '';
     678        }
    671679
    672680        $q = '';
     
    674682            // Join the global _carry_queries and local one_time_carry_queries.
    675683            $query_args = urlEncodeArray(array_merge($_this->_carry_queries, $one_time_carry_queries));
    676             foreach ($query_args as $key=>$val) {
     684            foreach ($query_args as $key => $val) {
    677685                // Check value is set and value does not already exist in the url.
    678686                if (!preg_match('/[?&]' . preg_quote($key) . '=/', $url)) {
     
    711719            && !preg_match('/[?&]' . preg_quote(session_name()) . '=/', $url)
    712720        ) {
    713             $url .= $q . $delim . session_name() . '=' . session_id();
    714             return $url;
    715         } else {
    716             $url .= $q;
    717             return $url;
    718         }
     721            $q .= $delim . session_name() . '=' . session_id();
     722        }
     723
     724        return $url . $q . $anchor;
    719725    }
    720726
Note: See TracChangeset for help on using the changeset viewer.