prevent incompatible export files (osada/zap) from being imported (manual patch from dev)
This commit is contained in:
parent
9ef6c57ca5
commit
9fcadc2d7c
@ -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;
|
||||
|
||||
|
@ -3217,6 +3217,28 @@ function array2XML($obj, $array) {
|
||||
}
|
||||
}
|
||||
|
||||
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 Inserts an array into $table.
|
||||
*
|
||||
@ -3480,3 +3502,4 @@ function print_val($v) {
|
||||
return $v;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user