Commit 61617f52 authored by Carsten  Rose's avatar Carsten Rose
Browse files

F7529 - Guarantee Sip Action plays only once. Update Doc, change from set to...

F7529 - Guarantee Sip Action plays only once. Update Doc, change from set to '' to removing SIP Key/Value completely.
parent cc47b950
Pipeline #1978 passed with stages
in 2 minutes and 50 seconds
......@@ -1257,7 +1257,11 @@ The following `escape` & `action` types are available:
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| Token | Description |
+=======+==================================================================================================================================+
| m | `real_escape_string() <http://php.net/manual/en/mysqli.real-escape-string.php>`_ (m = mysql) |
| c | Config - the escape type configured in `configuration`_. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| C | Colon ':' will be escaped against \\:. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| d | Double ticks " will be escaped against \\". |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| l | LDAP search filter values: `ldap-escape() <http://php.net/manual/en/function.ldap-escape.php>`_ (LDAP_ESCAPE_FILTER). |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
......@@ -1265,21 +1269,19 @@ The following `escape` & `action` types are available:
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| s | Single ticks ' will be escaped against \\'. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| d | Double ticks " will be escaped against \\". |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| C | Colon ':' will be escaped against \\:. |
| S | Stop replace. If the replaced value contains nested variables, they won't be replaced. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| c | Config - the escape type configured in `configuration`_. |
| m | `real_escape_string() <http://php.net/manual/en/mysqli.real-escape-string.php>`_ (m = mysql) |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| p | Password hashing: depends on the hashing type in the Typo3 installation, includes salting if configured. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| '' | Nothing defined - the escape/action class type configured in `configuration`_. |
| w | wipe out current key/value pair from SIP store `variable-escape-wipe-key`_ |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| \- | No escaping. |
| X | Throw exception if variable is not found in the given store(s). Outputs `variable-type-message-violate`_ |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| S | Stop replace. If the replaced value contains nested variables, they won't be replaced. |
| '' | Nothing defined - the escape/action class type configured in `configuration`_. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| X | Throw exception if variable is not found in the given store(s). Outputs `variable-type-message-violate`_ |
| \- | No escaping. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
......@@ -1319,6 +1321,17 @@ Action
In special situation it might be useful to do a full stop on all current actions (no further procession). A custom
message can be defined via: `variable-type-message-violate`_.
.. _`variable-escape-wipe-key`:
* *wipe* - 'w': In special cases it might be useful to get a value via SIP only one time and after retrieving the value
it will be deleted in STORE SIP . Further access to the variable will return 'variable undefined'. At time of writing
only the STORE SIP supports the feature 'wipe'. This is useful to suppress any repeating events by using the browser history.
The following example will send a mail only the first when it is called with a given SIP::
10.sql = SELECT '...' AS _sendmail FROM Person AS p WHERE '{{action:S::w}}'='send' AND p.id={{pId:S}}
.. _`variable-default`:
Default
......
......@@ -425,10 +425,10 @@ class Evaluate {
if ($flagWipe) {
switch ($foundInStore) {
case STORE_SIP:
$this->store::setVar($arrToken[VAR_INDEX_VALUE], '', $foundInStore, true);
$this->store::unsetVar($arrToken[VAR_INDEX_VALUE], STORE_SIP);
$sip = new Sip();
$sip->removeKeyFromSip($this->store::getVar(SIP_SIP, $foundInStore), $arrToken[VAR_INDEX_VALUE]);
$sip->removeKeyFromSip($this->store::getVar(SIP_SIP, STORE_SIP), $arrToken[VAR_INDEX_VALUE]);
break;
case STORE_EMPTY:
case STORE_ZERO:
......
......@@ -290,7 +290,8 @@ class Sip {
}
/**
* Remove one key/value from SIP. Do not change the SIP.
* Remove one key (incl value) from SIP. Do not change the SIP.
*
* set: sip['badcaffee1234']="r=123&action=start" >> sip['badcaffee1234']="r=123"
* unset: sip['r=123&action=start']
* set: sip("r=123")= 'badcaffee1234'
......@@ -305,6 +306,7 @@ class Sip {
$arr = explode('&', $sipParamStringOld);
// Find key and remove from array
foreach ($arr as $idx => $value) {
$tokenArr = explode('=', $value, 2);
if (($tokenArr[0] ?? '') == $key) {
......@@ -314,10 +316,10 @@ class Sip {
$sipParamStringNew = implode('&', $arr);
# Remove old
// Remove old
Session::unsetItem($sipParamStringOld);
# Set new
// Set new
Session::set($s, $sipParamStringNew);
Session::set($sipParamStringNew, $s);
}
......
Markdown is supported
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