Commit 892d3618 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Store.php: _GET['s'] and _POST['s'] will saved during initialization to check...

Store.php: _GET['s'] and _POST['s'] will saved during initialization to check later if the call is for form load for form save.
parent eff488cc
......@@ -44,6 +44,8 @@ class Store {
T3_BODYTEXT_DEBUG_SAVE => SANATIZE_DIGIT,
CLIENT_SIP => SANATIZE_DIGIT,
CLIENT_GET_SIP => SANATIZE_DIGIT,
CLIENT_POST_SIP => SANATIZE_DIGIT,
CLIENT_RECORD_ID => SANATIZE_DIGIT,
CLIENT_KEY_SEM_ID => SANATIZE_DIGIT,
CLIENT_KEY_SEM_ID_USER => SANATIZE_DIGIT,
......@@ -58,7 +60,15 @@ class Store {
SYSTEM_DB => SANATIZE_ALNUMX,
SYSTEM_TESTDB => SANATIZE_ALNUMX,
SYSTEM_SESSIONNAME => SANATIZE_ALNUMX,
SYSTEM_DBH => SANATIZE_ALL
SYSTEM_DBH => SANATIZE_ALL,
// SYSTEM_FORM_DEF => SANATIZE_ALL,
// SYSTEM_FORM_ELEMENT_DEF => SANATIZE_ALL,
// SYSTEM_FORM_ELEMENT_FIELD => SANATIZE_ALL,
SYSTEM_SQL_RAW => SANATIZE_ALL,
SYSTEM_SQL_FINAL => SANATIZE_ALL,
SYSTEM_SQL_COUNT => SANATIZE_DIGIT
];
self::fillSystemStore();
......@@ -113,6 +123,26 @@ class Store {
$arr[$key] = $value;
}
self::setVarArray($arr, STORE_CLIENT);
# SIP: if POST exist, this means 'form save'. To distinguish load and save, store both.
if (isset($_GET[CLIENT_SIP]))
self::setVar(CLIENT_GET_SIP, $_GET[CLIENT_SIP], STORE_CLIENT);
if (isset($_POST[CLIENT_SIP]))
self::setVar(CLIENT_POST_SIP, $_GET[CLIENT_SIP], STORE_CLIENT);
}
/**
* @param $key
* @param $value
* @param $store
* @throws CodeException
*/
public static function setVar($key, $value, $store) {
self::$raw[$store][$key] = $value;
// Invalidate cache to force new sanatize
self::$cache[$store][$key] = null;
}
/**
......@@ -135,20 +165,6 @@ class Store {
return self::$instance;
}
/**
* @param $key
* @param $value
* @param $store
* @throws CodeException
*/
public static function setVar($key, $value, $store) {
self::$raw[$store][$key] = $value;
// Invalidate cache to force new sanatize
self::$cache[$store][$key] = null;
}
/**
* Cycles throught all stores in $useStore.
* First match will return the found value.
......@@ -195,13 +211,6 @@ class Store {
}
// sanatize
// $value = \qfq\Sanatize::sanatize($rawVal, $sanatizeClass);
// self::$cache[$store][$key] = $value;
//
// if(!isset(self::$cache[$store])) {
// self::$cache[$store]=array();
// self::$cache[$store][$key] = $value;
// }
self::$cache[$store][$key] = \qfq\Sanatize::sanatize($rawVal, $sanatizeClass);
return self::$cache[$store][$key];
......@@ -209,6 +218,7 @@ class Store {
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