<?php
function xoops_module_install_tad_player(&$module) {

	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player");
	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player/file");
	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player/image");
	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player/image/.thumbs");
	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player/img");
	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player/flv");
	mk_dir(XOOPS_ROOT_PATH."/uploads/tad_player_batch_uploads");
	if(!file_exists(XOOPS_ROOT_PATH."/uploads/tad_player/mediaplayer.swf")){
		copy(XOOPS_ROOT_PATH."/modules/tad_player/class/jw_player/mediaplayer.swf",XOOPS_ROOT_PATH."/uploads/tad_player/mediaplayer.swf");}
		
	if(!file_exists(XOOPS_ROOT_PATH."/uploads/tad_player/yt.swf")){
		copy(XOOPS_ROOT_PATH."/modules/tad_player/class/jw_player/yt.swf",XOOPS_ROOT_PATH."/uploads/tad_player/yt.swf");
	}

	return true;
}

//建立目錄
function mk_dir($dir=""){
    //若無目錄名稱秀出警告訊息
    if(empty($dir))return;
    //若目錄不存在的話建立目錄
    if (!is_dir($dir)) {
        umask(000);
        //若建立失敗秀出警告訊息
        mkdir($dir, 0777);
    }
}

?>
