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
This commit is contained in:
parent
c5a9b00eae
commit
19e4f3c2f0
@ -127,6 +127,15 @@ class Import extends \Zotlabs\Web\Controller {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// prevent incompatible osada or zap data from horking your database
|
||||
|
||||
if(array_path_exists('compatibility/codebase',$data)) {
|
||||
notice('Data export format is not compatible with this software');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($moving)
|
||||
$seize = 1;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user