From 19e4f3c2f082278e524c463cce7ce0858a2258f8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Nov 2018 11:53:02 -0800 Subject: prevent incompatible export files (osada/zap) from being imported. This is to keep your DB from getting trashed. We probably need a similar thing for item import since the object formats aren't compatible --- include/text.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 646bfe749..edd0f7a5a 100644 --- a/include/text.php +++ b/include/text.php @@ -3467,6 +3467,28 @@ function print_val($v) { } +function array_path_exists($str,$arr) { + + $ptr = $arr; + $search = explode('/', $str); + + if($search) { + foreach($search as $s) { + if(array_key_exists($s,$ptr)) { + $ptr = $ptr[$s]; + } + else { + return false; + } + } + return true; + } + + return false; + +} + + /** * @brief Generate a unique ID. * @@ -3482,3 +3504,4 @@ function new_uuid() { return $hash; } + -- cgit v1.2.3