<?php
function tadgallery_content($cate_sn=""){
  global $xoopsDB;

  $sql="delete from `".$xoopsDB->prefix("tad_gallery")."`";
  $xoopsDB->queryF($sql) or die($sql);


  $sql="INSERT INTO `".$xoopsDB->prefix("tad_gallery")."` (`sn`, `csn`, `title`, `description`, `filename`, `size`, `type`, `width`, `height`, `dir`, `uid`, `post_date`, `counter`, `exif`, `tag`, `good`, `photo_sort`) VALUES

  (1, 1, '凌晨時分', '為了乘坐熱氣球，必須4:30就起床', 'photo01.jpg', 149187, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:14', 2, '[FILE][FileName]=phpMAqwID||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=149187||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 05:06:30||[IFD0][Orientation]=1||[EXIF][ExposureTime]=140000/1000000||[EXIF][ISOSpeedRatings]=592||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.714344||[GPS][longitude]=34.830398555556', '', '0', 0),
  (2, 1, '日出', '第一次在國外看日出，別有一番風味', 'photo02.jpg', 110159, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:15', 2, '[FILE][FileName]=php8qYSmm||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=110159||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 05:42:59||[IFD0][Orientation]=1||[EXIF][ExposureTime]=2380/1000000||[EXIF][ISOSpeedRatings]=117||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.714347833333||[GPS][longitude]=34.830413805556', '', '0', 0),
  (3, 1, '', '', 'photo03.jpg', 162230, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:15', 0, '[FILE][FileName]=php0pi8Jk||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=162230||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 05:43:43||[IFD0][Orientation]=1||[EXIF][ExposureTime]=5488/1000000||[EXIF][ISOSpeedRatings]=116||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.714439388889||[GPS][longitude]=34.830455777778', '', '0', 0),
  (4, 1, '好想游泳', '可是清晨的水很冰...', 'photo04.jpg', 154225, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:15', 0, '[FILE][FileName]=phpreKMyt||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=154225||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 05:44:06||[IFD0][Orientation]=1||[EXIF][ExposureTime]=9996/1000000||[EXIF][ISOSpeedRatings]=147||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.714473722222||[GPS][longitude]=34.830398555556', '', '0', 0),
  (5, 1, '好大的熱氣球！', '', 'photo05.jpg', 162416, 'image/jpeg', 1024, 768, '2013_07_17', 1, '2014-06-26 22:54:16', 0, '[FILE][FileName]=phpewljlV||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=162416||[COMPUTED][Width]=1024||[COMPUTED][Height]=768||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 06:33:04||[IFD0][Orientation]=1||[EXIF][ExposureTime]=1568/1000000||[EXIF][ISOSpeedRatings]=117||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (6, 1, '充氣', '已經有其他的熱氣球升空了！\r\n好感動！', 'photo06.jpg', 90454, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:16', 0, '[FILE][FileName]=phpDTtqKE||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=90454||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 06:35:55||[IFD0][Orientation]=1||[EXIF][ExposureTime]=308/1000000||[EXIF][ISOSpeedRatings]=121||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (7, 1, '終於充好了！', '只是這是別人家的～', 'photo07.jpg', 153140, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:16', 0, '[FILE][FileName]=phpMydI6y||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=153140||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 06:39:18||[IFD0][Orientation]=1||[EXIF][ExposureTime]=1456/1000000||[EXIF][ISOSpeedRatings]=118||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (8, 1, '', '越來越多的熱氣求升空，滿天飛舞。', 'photo08.jpg', 104479, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:17', 0, '[FILE][FileName]=phpuBM00E||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=104479||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 06:40:24||[IFD0][Orientation]=1||[EXIF][ExposureTime]=504/1000000||[EXIF][ISOSpeedRatings]=120||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (9, 1, '別人的漂亮熱氣球', '自己坐的熱氣球不用太漂亮，因為自己看不到。\r\n所以，祈禱別人的熱氣球漂亮一點比較重要！哈哈～', 'photo09.jpg', 158989, 'image/jpeg', 1024, 768, '2013_07_17', 1, '2014-06-26 22:54:17', 0, '[FILE][FileName]=phpWhGFrV||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=158989||[COMPUTED][Width]=1024||[COMPUTED][Height]=768||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 06:42:35||[IFD0][Orientation]=1||[EXIF][ExposureTime]=1372/1000000||[EXIF][ISOSpeedRatings]=116||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (10, 1, '升空', '', 'photo10.jpg', 154760, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:17', 0, '[FILE][FileName]=php4HW9hv||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=154760||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 06:49:22||[IFD0][Orientation]=1||[EXIF][ExposureTime]=1176/1000000||[EXIF][ISOSpeedRatings]=119||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (11, 1, '很舒服的熱氣球', '', 'photo11.jpg', 166529, 'image/jpeg', 1024, 768, '2013_07_17', 1, '2014-06-26 22:54:17', 0, '[FILE][FileName]=phpEqN30q||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=166529||[COMPUTED][Width]=1024||[COMPUTED][Height]=768||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:10:57||[IFD0][Orientation]=1||[EXIF][ExposureTime]=1036/1000000||[EXIF][ISOSpeedRatings]=117||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (12, 1, '', '', 'photo12.jpg', 169222, 'image/jpeg', 1024, 768, '2013_07_17', 1, '2014-06-26 22:54:18', 0, '[FILE][FileName]=phprjiX5w||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=169222||[COMPUTED][Width]=1024||[COMPUTED][Height]=768||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:12:26||[IFD0][Orientation]=1||[EXIF][ExposureTime]=896/1000000||[EXIF][ISOSpeedRatings]=118||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (13, 1, '居高臨下', '', 'photo13.jpg', 184122, 'image/jpeg', 1024, 768, '2013_07_17', 1, '2014-06-26 22:54:18', 0, '[FILE][FileName]=phpWwYasY||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=184122||[COMPUTED][Width]=1024||[COMPUTED][Height]=768||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:13:11||[IFD0][Orientation]=1||[EXIF][ExposureTime]=728/1000000||[EXIF][ISOSpeedRatings]=118||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (14, 1, '難得一見的地形', '豐富的地形景觀，令人目不暇給', 'photo14.jpg', 233691, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:18', 0, '[FILE][FileName]=phpbK8XRJ||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=233691||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:15:48||[IFD0][Orientation]=1||[EXIF][ExposureTime]=1176/1000000||[EXIF][ISOSpeedRatings]=119||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (15, 1, '', '', 'photo15.jpg', 149966, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:19', 0, '[FILE][FileName]=phpNGmKKQ||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=149966||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:31:07||[IFD0][Orientation]=1||[EXIF][ExposureTime]=420/1000000||[EXIF][ISOSpeedRatings]=117||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (16, 1, '', '', 'photo16.jpg', 187147, 'image/jpeg', 768, 1024, '2013_07_17', 1, '2014-06-26 22:54:19', 0, '[FILE][FileName]=php799nvf||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=187147||[COMPUTED][Width]=768||[COMPUTED][Height]=1024||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:32:10||[IFD0][Orientation]=1||[EXIF][ExposureTime]=952/1000000||[EXIF][ISOSpeedRatings]=119||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0),
  (17, 1, '', '', 'photo17.jpg', 144781, 'image/jpeg', 1024, 768, '2013_07_17', 1, '2014-06-26 22:54:19', 0, '[FILE][FileName]=phpJ0eFJY||[FILE][FileType]=2||[FILE][MimeType]=image/jpeg||[FILE][FileSize]=144781||[COMPUTED][Width]=1024||[COMPUTED][Height]=768||[IFD0][Make]=                               ||[IFD0][Model]=                               ||[IFD0][DateTime]=2013:07:17 07:32:25||[IFD0][Orientation]=1||[EXIF][ExposureTime]=504/1000000||[EXIF][ISOSpeedRatings]=120||[COMPUTED][ApertureFNumber]=f/2.4||[EXIF][Flash]=0||[EXIF][FocalLength]=350/100mm||[EXIF][ExposureBiasValue]=0/10EV||[GPS][latitude]=38.706829055556||[GPS][longitude]=34.842933638889', '', '0', 0);

  ";

  $xoopsDB->queryF($sql) or die($sql);

  uzip_file();
}

//上傳壓縮圖檔
function uzip_file(){
  global $xoopsDB,$xoopsUser,$xoopsModule,$xoopsModuleConfig,$type_to_mime;

  //取消上傳時間限制
  set_time_limit(0);

  //設置上傳大小
  ini_set('memory_limit', '100M');

  require_once XOOPS_ROOT_PATH."/modules/tad_guide/class/dunzip2/dUnzip2.inc.php";
  require_once XOOPS_ROOT_PATH."/modules/tad_guide/class/dunzip2/dZip.inc.php";
  copy(XOOPS_ROOT_PATH."/modules/tad_guide/admin/setup/tadgallery/tadgallery.zip", XOOPS_ROOT_PATH."/uploads/tadgallery/tadgallery.zip");
  $zip = new dUnzip2(XOOPS_ROOT_PATH."/uploads/tadgallery/tadgallery.zip");
  $zip->getList();
  $zip->unzipAll(XOOPS_ROOT_PATH."/uploads/tadgallery/");

}
?>