Browse Source

improve array save

master
filesite 6 months ago
parent
commit
122649b3ae
  1. 5
      plugins/Common.php

5
plugins/Common.php

@ -127,6 +127,7 @@ Class Common {
$shareDirs = self::getMyShareDirs($cellphone, $username); $shareDirs = self::getMyShareDirs($cellphone, $username);
if(!empty($shareDirs[$friends_cellphone]) && in_array($share_dir, $shareDirs[$friends_cellphone])) { if(!empty($shareDirs[$friends_cellphone]) && in_array($share_dir, $shareDirs[$friends_cellphone])) {
$shareDirs[$friends_cellphone] = array_diff($shareDirs[$friends_cellphone], array($share_dir)); $shareDirs[$friends_cellphone] = array_diff($shareDirs[$friends_cellphone], array($share_dir));
$shareDirs[$friends_cellphone] = array_values($shareDirs[$friends_cellphone]);
}else { }else {
return true; return true;
} }
@ -222,9 +223,7 @@ Class Common {
$dirs_after_delete = $friends_dirs; $dirs_after_delete = $friends_dirs;
if (in_array($share_dir, $friends_dirs)) { if (in_array($share_dir, $friends_dirs)) {
$dirs_after_delete = array_diff($friends_dirs, array($share_dir)); $dirs_after_delete = array_diff($friends_dirs, array($share_dir));
if (is_object($dirs_after_delete)) { $dirs_after_delete = array_values($dirs_after_delete);
$dirs_after_delete = self::dictToArray($dirs_after_delete);
}
}else { }else {
return true; return true;
} }

Loading…
Cancel
Save