OSDN Git Service

Added new function untar.
authorKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Wed, 22 Sep 2010 02:10:12 +0000 (02:10 +0000)
committerKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Wed, 22 Sep 2010 02:10:12 +0000 (02:10 +0000)
git-svn-id: svn://svn.code.sf.net/p/intdb/svn/trunk@554 2b68903e-0b30-0410-9a39-a2e4f3c5be39

inc/function.php
inc/versioninfo.php

index 21477f1..54ed98b 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: function.php - Last Update: 09/15/2010 SVN 544 - Author: cooldude2k $
+    $FileInfo: function.php - Last Update: 09/21/2010 SVN 554 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="function.php"||$File3Name=="/function.php") {
@@ -65,6 +65,41 @@ $REFERERurl = null;
 function output_error($message, $level=E_USER_ERROR) {
     $caller = next(debug_backtrace());
     trigger_error($message.' in <strong>'.$caller['function'].'</strong> called from <strong>'.$caller['file'].'</strong> on line <strong>'.$caller['line'].'</strong>'."\n<br />error handler", $level); }
+// Untar a File
+function untar($tarfile,$outdir) {
+if($outdir!=""&&!file_exists($outdir)) {
+       mkdir($outdir); }
+$thandle = fopen($tarfile, "r");
+while (!feof($thandle)) {
+       $FileName = $outdir.trim(fread($thandle,100));
+       $FileMode = trim(fread($thandle,8));
+       $OwnerID = trim(fread($thandle,8));
+       $GroupID = trim(fread($thandle,8));
+       $FileSize = octdec(trim(fread($thandle,12)));
+       $LastEdit = trim(fread($thandle,12));
+       $Checksum = trim(fread($thandle,8));
+       $FileType = trim(fread($thandle,1));
+       fseek($thandle,355,SEEK_CUR);
+       if($FileType=="0") {
+               $FileContent = fread($thandle,$FileSize); }
+       if($FileType=="5") {
+               $FileContent = null; }
+       if($FileType=="0") {
+               $subhandle = fopen($FileName, "a+");
+               fwrite($subhandle,$FileContent,$FileSize);
+               fclose($subhandle); }
+       if($FileType=="5") {
+               mkdir($FileName); }
+       touch($FileName,$LastEdit);
+       if($FileType=="0") {
+               $CheckSize = 512;
+               while ($CheckSize<$FileSize) {
+                       if($CheckSize<$FileSize) {
+                       $CheckSize = $CheckSize + 512; } }
+               $SeekSize = $CheckSize - $FileSize;
+               fseek($thandle,$SeekSize,SEEK_CUR); } }
+       fclose($thandle); 
+       return true; }
 // http://us.php.net/manual/en/function.uniqid.php#94959
 /**
   * Generates an UUID
index c79a403..a588b71 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: versioninfo.php - Last Update: 09/21/2010 SVN 553 - Author: cooldude2k $
+    $FileInfo: versioninfo.php - Last Update: 09/21/2010 SVN 554 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="versioninfo.php"||$File3Name=="/versioninfo.php") {
@@ -27,7 +27,7 @@ function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) {
        return $return_var; }
 // Version number and date stuff. :P
 $VER1[0] = 0; $VER1[1] = 4; $VER1[2] = 1; $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2];
-$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 553; $RName = "iDB"; $SFName = "IntDB";
+$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 554; $RName = "iDB"; $SFName = "IntDB";
 $SVNDay[0] = 09; $SVNDay[1] = 21; $SVNDay[2] = 2010; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
 $VerInfo['iDB_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,false);
 $VerInfo['iDB_Ver_SVN'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,true);