<?php
//This script is used for create the file structure for a new user.
function mkdirIfNotExists($path){
	if (!file_exists($path)){
		mkdir($path,0777,true);
	}
}

function buildUserDirectory($userDir,$folderList){
	foreach ($folderList as $folder){
		mkdirIfNotExists($userDir . $folder);
	}
}

$userDir = $dataStorage; //必須從 caller 處輸入 $dataStorage 路徑，參考 index.php
$folderList = ["post/public/","post/private/","post/friends-only/","files/image/","files/video/","files/audio/","files/code/","files/documents/","user/profile/"];
buildUserDirectory($userDir,$folderList);
//寫入使用者顯示名稱（可以跟帳號名稱不一樣）
file_put_contents($userDir . "user/profile/displayname.inf",$_SESSION['login']);
?>