OSDN Git Service

Another update to untar function.
authorKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Wed, 22 Sep 2010 06:13:18 +0000 (06:13 +0000)
committerKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Wed, 22 Sep 2010 06:13:18 +0000 (06:13 +0000)
git-svn-id: svn://svn.code.sf.net/p/intdb/svn/trunk@556 2b68903e-0b30-0410-9a39-a2e4f3c5be39

inc/function.php
inc/versioninfo.php

index ebf573d..19bd23f 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/21/2010 SVN 555 - Author: cooldude2k $
+    $FileInfo: function.php - Last Update: 09/21/2010 SVN 556 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="function.php"||$File3Name=="/function.php") {
@@ -65,16 +65,21 @@ $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) {
+// PHP iUnTAR Version 2.7
+function untar($tarfile,$outdir="./",$chmod=null) {
 $TarSize = filesize($tarfile);
 $TarSizeEnd = $TarSize - 1024;
 if($outdir!=""&&!file_exists($outdir)) {
-       mkdir($outdir); }
+       mkdir($outdir); 
+       chmod($outdir,0777); }
 $thandle = fopen($tarfile, "r");
 while (ftell($thandle)<$TarSizeEnd) {
        $FileName = $outdir.trim(fread($thandle,100));
        $FileMode = trim(fread($thandle,8));
+       if($chmod===null) {
+               $FileCHMOD = "0".substr($FileMode,-3); }
+       if($chmod!==null) {
+               $FileCHMOD = $chmod; }
        $OwnerID = trim(fread($thandle,8));
        $GroupID = trim(fread($thandle,8));
        $FileSize = octdec(trim(fread($thandle,12)));
@@ -92,7 +97,8 @@ while (ftell($thandle)<$TarSizeEnd) {
                fclose($subhandle); }
        if($FileType=="5") {
                mkdir($FileName); }
-       touch($FileName,$LastEdit);
+       chmod($FileName,$FileCHMOD);
+       //touch($FileName,$LastEdit);
        if($FileType=="0") {
                $CheckSize = 512;
                while ($CheckSize<$FileSize) {
index db8d67c..be44bb8 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 555 - Author: cooldude2k $
+    $FileInfo: versioninfo.php - Last Update: 09/21/2010 SVN 556 - 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 = 555; $RName = "iDB"; $SFName = "IntDB";
+$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 556; $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);