Skip to content

Commit b93cbdb

Browse files
committed
Reverted master to 1.0.1 release and re-applied changes for POST support
1 parent 4a2c792 commit b93cbdb

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

phrets.php

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,10 @@ public function FetchRow($pointer_id) {
473473
// assign each value to it's name retrieved in the COLUMNS earlier
474474
$this_row[$name] = $field_data[$key];
475475
}
476-
}
477-
else {
476+
} else {
478477
$this->FreeResult($pointer_id);
479478
}
479+
480480
}
481481

482482
return $this_row;
@@ -533,7 +533,7 @@ public function SearchQuery($resource, $class, $query = "", $optional_params = a
533533
}
534534

535535
// setup additional, optional request arguments
536-
$search_arguments['Count'] = (!array_key_exists('Count', $optional_params)) ? 1 : $optional_params['Count'];
536+
$search_arguments['Count'] = (!array_key_exists('Count', $optional_params)) ? 1 : $optional_params['Count'];
537537
$search_arguments['Format'] = empty($optional_params['Format']) ? "COMPACT-DECODED" : $optional_params['Format'];
538538
$search_arguments['Limit'] = empty($optional_params['Limit']) ? 99999999 : $optional_params['Limit'];
539539

@@ -552,7 +552,7 @@ public function SearchQuery($resource, $class, $query = "", $optional_params = a
552552
if (!empty($optional_params['RestrictedIndicator'])) {
553553
$search_arguments['RestrictedIndicator'] = $optional_params['RestrictedIndicator'];
554554
}
555-
555+
556556
$usePost = (!empty($optional_params['UsePost']) && $optional_params['UsePost'] ===1) ? true : false;
557557

558558
$search_arguments['StandardNames'] = empty($optional_params['StandardNames']) ? 0 : $optional_params['StandardNames'];
@@ -572,13 +572,15 @@ public function SearchQuery($resource, $class, $query = "", $optional_params = a
572572
return false;
573573
}
574574

575-
$result = null;
576575
// make request
576+
$result = null;
577+
577578
if ($usePost) {
578579
$result = $this->RETSRequestPost($this->capability_url['Search'], $search_arguments);
579580
} else {
580581
$result = $this->RETSRequest($this->capability_url['Search'], $search_arguments);
581582
}
583+
582584
if (!$result) {
583585
return false;
584586
}
@@ -1276,8 +1278,6 @@ public function GetServerInformation() {
12761278
$system_id = "";
12771279
$system_description = "";
12781280
$system_comments = "";
1279-
$system_version = "";
1280-
$timezone_offset = "";
12811281

12821282
if ($this->is_server_version("1_5_or_below")) {
12831283
if (isset($xml->METADATA->{'METADATA-SYSTEM'}->System->SystemID)) {
@@ -1286,6 +1286,7 @@ public function GetServerInformation() {
12861286
if (isset($xml->METADATA->{'METADATA-SYSTEM'}->System->SystemDescription)) {
12871287
$system_description = "{$xml->METADATA->{'METADATA-SYSTEM'}->System->SystemDescription}";
12881288
}
1289+
$timezone_offset = "";
12891290
}
12901291
else {
12911292
if (isset($xml->METADATA->{'METADATA-SYSTEM'}->SYSTEM->attributes()->SystemID)) {
@@ -1302,16 +1303,12 @@ public function GetServerInformation() {
13021303
if (isset($xml->METADATA->{'METADATA-SYSTEM'}->SYSTEM->Comments)) {
13031304
$system_comments = "{$xml->METADATA->{'METADATA-SYSTEM'}->SYSTEM->Comments}";
13041305
}
1305-
if (isset($xml->METADATA->{'METADATA-SYSTEM'}->attributes()->Version)) {
1306-
$system_version = (string) $xml->METADATA->{'METADATA-SYSTEM'}->attributes()->Version;
1307-
}
13081306

13091307
return array(
13101308
'SystemID' => $system_id,
13111309
'SystemDescription' => $system_description,
13121310
'TimeZoneOffset' => $timezone_offset,
1313-
'Comments' => $system_comments,
1314-
'Version' => $system_version
1311+
'Comments' => $system_comments
13151312
);
13161313
}
13171314

@@ -1542,11 +1539,7 @@ public function ParseXMLResponse($data = "") {
15421539

15431540
if (!empty($data)) {
15441541
// parse XML function. ability to replace SimpleXML with something later fairly easily
1545-
if (defined('LIBXML_PARSEHUGE')) {
1546-
$xml = @simplexml_load_string($data, 'SimpleXMLElement', LIBXML_PARSEHUGE);
1547-
} else {
1548-
$xml = @simplexml_load_string($data);
1549-
}
1542+
$xml = @simplexml_load_string($data);
15501543
if (!is_object($xml)) {
15511544
$this->set_error_info("xml", -1, "XML parsing error: {$data}");
15521545
return false;
@@ -1563,7 +1556,6 @@ public function ParseXMLResponse($data = "") {
15631556
public function RETSRequest($action, $parameters = "") {
15641557
$this->reset_error_info();
15651558

1566-
$this->last_request = array();
15671559
$this->last_response_headers = array();
15681560
$this->last_response_headers_raw = "";
15691561
$this->last_remembered_header = "";
@@ -1587,7 +1579,7 @@ public function RETSRequest($action, $parameters = "") {
15871579
// build query string from arguments
15881580
$request_arguments = "";
15891581
if (is_array($parameters)) {
1590-
$request_arguments = http_build_query($parameters, '', '&');
1582+
$request_arguments = http_build_query($parameters);
15911583
}
15921584

15931585
// build entire URL if needed
@@ -1661,7 +1653,6 @@ public function RETSRequest($action, $parameters = "") {
16611653
return array($this->last_response_headers_raw, $response_body);
16621654
}
16631655

1664-
16651656
public function RETSRequestPost($action, $parameters = "") {
16661657
$this->reset_error_info();
16671658

@@ -1765,7 +1756,7 @@ public function RETSRequestPost($action, $parameters = "") {
17651756
// return raw headers and body
17661757
return array($this->last_response_headers_raw, $response_body);
17671758
}
1768-
1759+
17691760
private function read_custom_curl_headers($handle, $call_string) {
17701761
$this->last_response_headers_raw .= $call_string;
17711762
$header = null;

0 commit comments

Comments
 (0)