|
|
@ -213,6 +213,32 @@ Class Common { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//删除被共享的收藏夹 |
|
|
|
|
|
|
|
public static function deleteSharedFavDir($friends_cellphone, $current_username, $share_dir) { |
|
|
|
|
|
|
|
//不能删除朋友自己的收藏夹 |
|
|
|
|
|
|
|
if (self::isMyFavDir($friends_cellphone, $current_username, $share_dir)) {return false;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$friends_dirs = self::getMyDirs($friends_cellphone, $current_username); |
|
|
|
|
|
|
|
$dirs_after_delete = array_diff($friends_dirs, array($share_dir)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$my_id = self::getUserId($friends_cellphone); |
|
|
|
|
|
|
|
$rootDir = __DIR__ . '/../www/' . FSC::$app['config']['content_directory']; |
|
|
|
|
|
|
|
$rootDir = str_replace("/{$current_username}", "/{$my_id}", $rootDir); //获取自己的目录 |
|
|
|
|
|
|
|
if (!is_dir($rootDir)) { |
|
|
|
|
|
|
|
$my_first_id = self::getMappedUsername($friends_cellphone); |
|
|
|
|
|
|
|
$rootDir = str_replace("/{$my_id}", "/{$my_first_id}", $rootDir); //获取自己的目录 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cache_filename = "{$rootDir}/custom_config_usermap.json"; |
|
|
|
|
|
|
|
file_put_contents($cache_filename, json_encode($dirs_after_delete, JSON_PRETTY_PRINT)); |
|
|
|
|
|
|
|
}catch(Exception $e) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//新用户注册时初始化用户数据目录 |
|
|
|
//新用户注册时初始化用户数据目录 |
|
|
|
public static function initUserData($cellphone, $friends_code = '') { |
|
|
|
public static function initUserData($cellphone, $friends_code = '') { |
|
|
|
$userDir = self::getUserDataDir($cellphone); |
|
|
|
$userDir = self::getUserDataDir($cellphone); |
|
|
@ -318,7 +344,7 @@ Class Common { |
|
|
|
$cache_filename = "{$rootDir}/custom_config_usermap.json"; |
|
|
|
$cache_filename = "{$rootDir}/custom_config_usermap.json"; |
|
|
|
if (file_exists($cache_filename)) { |
|
|
|
if (file_exists($cache_filename)) { |
|
|
|
$mapContent = file_get_contents($cache_filename); |
|
|
|
$mapContent = file_get_contents($cache_filename); |
|
|
|
$map = json_decode($mapContent, true); |
|
|
|
$map = json_decode($mapContent); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -329,7 +355,7 @@ Class Common { |
|
|
|
array_merge($map, $tajian_user_map[$cellphone]) : array_push($map, $tajian_user_map[$cellphone]); |
|
|
|
array_merge($map, $tajian_user_map[$cellphone]) : array_push($map, $tajian_user_map[$cellphone]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return array_unique($map, SORT_NUMERIC); |
|
|
|
return array_values(array_unique($map)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static function getNicknameByDir($dir, $username){ |
|
|
|
public static function getNicknameByDir($dir, $username){ |
|
|
|