Project

General

Profile

Revision c1bcfc1b

IDc1bcfc1b4aea53225774497dd3b9ab8847edccdc
Parent 72e93746
Child f9da0eb9

Added by Andreas Kohlbecker over 8 years ago

fixing url encoding probelm in debug block data links

View differences:

7.x/modules/cdm_dataportal/cdm_api/cdm_api.module
1601 1601
  $time = microtime(TRUE) - $initial_time;
1602 1602

  
1603 1603
  // Decompose uri into path and query element.
1604
  // URI query elements are stored in an array
1605
  // suitable for drupal_http_build_query()
1606 1604
  $uri_parts = explode("?", $uri);
1607 1605
  $query = array();
1608 1606
  if (count($uri_parts) == 2) {
1609 1607
    $path = $uri_parts[0];
1610
    $queryparts = explode("&", $uri_parts[1]);
1611
    foreach ($queryparts as $querypart) {
1612
      $querypart = explode("=", $querypart);
1613
      if(count($querypart) == 2){
1614
        $query[$querypart[0]] = $querypart[1];
1615
      } else {
1616
        $query[$querypart[0]] = null;
1617
      }
1618
    }
1619 1608
  }
1620 1609
  else {
1621 1610
    $path = $uri;
1622 1611
  }
1623 1612

  
1613
  if(strpos($uri, '?') > 0){
1614
    $json_uri = str_replace('?', '.json?', $uri);
1615
    $xml_uri = str_replace('?', '.xml?', $uri);
1616
  } else {
1617
    $json_uri = $uri . '.json';
1618
    $xml_uri = $json_uri . '.xml';
1619
  }
1620

  
1624 1621
  // data links to make data accecsible as json and xml
1625 1622
  $data_links = '';
1626 1623
  if (_is_cdm_ws_uri($path)) {
1627
    $data_links .= '<a href="'
1628
        . url($path . '.xml', array('query' => $query, 'absolute' => TRUE))
1629
        . '" target="data">xml</a>-';
1630
    $data_links .= '<a href="'
1631
        . url('cdm_api/proxy/' . urlencode(url($path . '.xml', array('query' => $query))))
1632
        . '" target="data">proxied</a>';
1624
    $data_links .= '<a href="' . $xml_uri . '" target="data">xml</a>-';
1625
    $data_links .= '<a href="' . url('cdm_api/proxy/' . urlencode($xml_uri)) . '" target="data">proxied</a>';
1633 1626
    $data_links .= '<br/>';
1634
    $data_links .= '<a href="'
1635
        . url($path . '.json', array('query' => $query, 'absolute' => TRUE))
1636
        . '" target="data">json</a>-';
1637
    $data_links .= '<a href="'
1638
        . url('cdm_api/proxy/' . urlencode(url($path . '.json', array('query' => $query))))
1639
        . '" target="data">proxied</a>';
1627
    $data_links .= '<a href="' . $json_uri . '" target="data">json</a>-';
1628
    $data_links .= '<a href="' . url('cdm_api/proxy/' . urlencode($json_uri)) . '" target="data">proxied</a>';
1640 1629
  }
1641 1630
  else {
1642
    $data_links .= '<a href="' . url($path, array(
1643
        'query' => $query)) . '" target="data">open</a>';
1631
    $data_links .= '<a href="' . $uri . '" target="data">open</a>';
1644 1632
  }
1645 1633

  
1646 1634
  //

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)