Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions core/toxidcurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,7 @@ protected function _getRemoteContent($sUrl)
$aResult = array();
$curl_handle = curl_init();

$params = http_build_query($this->additionalUrlParams);
if (false === strpos($sUrl, '?')) {
$sUrl .= "?{$params}";
} else {
$sUrl = rtrim($sUrl, '&') . "&{$params}";
}
$sUrl = $this->_appendAdditionalUrlParams($sUrl);

curl_setopt($curl_handle, CURLOPT_URL, $sUrl);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
Expand All @@ -394,6 +389,30 @@ protected function _getRemoteContent($sUrl)

return $aResult;
}

/**
* Returns the given $sUrl with the appended parameters, if any.
*
* @param $sUrl
*
* @return string
*/
protected function _appendAdditionalUrlParams($sUrl)
{
if (!$this->additionalUrlParams) {
return $sUrl;
}

$params = http_build_query($this->additionalUrlParams);

if (false === strpos($sUrl, '?')) {
$sUrl .= "?{$params}";
} else {
$sUrl = rtrim($sUrl, '&') . "&{$params}";
}

return $sUrl;
}

/**
* rewrites given string URL's, which belongs to typo3 and configured in aToxidCurlSource
Expand Down Expand Up @@ -506,8 +525,12 @@ protected function _getToxidLangUrlParam($iLangId = null, $blReset = false)
if ($iLangId === null) {
$iLangId = oxRegistry::getLang()->getBaseLanguage();
}

if ($param = $this->_aToxidLangUrlParam[$iLangId]) {
return '?' . ltrim($param, '?');
}

return '?' . ltrim($this->_aToxidLangUrlParam[$iLangId], '?');
return '';
}

/**
Expand Down