Commit c716e5d8 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Sip.php: renamed urlParamToSip to queryStringToSip, getSipFromUrlParam to...

Sip.php: renamed urlParamToSip to queryStringToSip, getSipFromUrlParam to getSipFromQueryString. Added getQueryStringFromSip
parent 5b3b5128
...@@ -55,12 +55,20 @@ class Sip { ...@@ -55,12 +55,20 @@ class Sip {
} }
/** /**
* @param $urlParam * @param string $queryString Possible variants:
* * http://www.math.uzh.ch/index.php?a=1&s=4b3403665fea6&r=45&type=99&id=person
* * index.php?a=1&s=4b3403665fea6&r=45&type=99&id=person
* * ?a=1&s=4b3403665fea6&r=45&type=99&id=person
* * a=1&s=4b3403665fea6&r=45&type=99&id=person
*
* @param string $mode Possible values: RETURN_URL|RETURN_SIP
* @return string * @return string
* * mode=RETURN_URL: return complete URL
* * mofr=RETURN_SIP: returns only the sip
* @throws CodeException * @throws CodeException
* @throws UserException * @throws UserException
*/ */
public function urlParamToSip($urlParam, $mode = RETURN_URL) { public function queryStringToSip($queryString, $mode = RETURN_URL) {
// Validation: Check if still the same fe_user is logged in. // Validation: Check if still the same fe_user is logged in.
if (isset($GLOBALS["TSFE"]->fe_user->user["uid"])) { if (isset($GLOBALS["TSFE"]->fe_user->user["uid"])) {
...@@ -73,7 +81,7 @@ class Sip { ...@@ -73,7 +81,7 @@ class Sip {
$sipArray = array(); $sipArray = array();
// Split URL parameter: // Split URL parameter:
$paramArray = KeyValueStringParser::parse($urlParam, "=", "&"); $paramArray = KeyValueStringParser::parse($queryString, "=", "&");
// Split parameter between Script, Client and SIP // Split parameter between Script, Client and SIP
$script = $this->splitParamClientSip($paramArray, $clientArray, $sipArray); $script = $this->splitParamClientSip($paramArray, $clientArray, $sipArray);
...@@ -224,12 +232,23 @@ class Sip { ...@@ -224,12 +232,23 @@ class Sip {
} }
/** /**
* @param $urlParam * @param $queryString
* @return mixed
*/
public function getSipFromQueryString($queryString) {
if (isset($_SESSION[$queryString])) {
return $_SESSION[$queryString];
}
return false;
}
/**
* @param $queryString
* @return mixed * @return mixed
*/ */
public function getSipFromUrlParam($urlParam) { public function getQueryStringFromSip($s) {
if (isset($_SESSION[$urlParam])) { if (isset($_SESSION[$s])) {
return $_SESSION[$urlParam]; return $_SESSION[$s];
} }
return false; return false;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment