当前位置: 首页>>代码示例>>PHP>>正文


PHP tar::openTAR方法代码示例

本文整理汇总了PHP中tar::openTAR方法的典型用法代码示例。如果您正苦于以下问题:PHP tar::openTAR方法的具体用法?PHP tar::openTAR怎么用?PHP tar::openTAR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tar的用法示例。


在下文中一共展示了tar::openTAR方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unlink

 function dl_remote($remote, $file, $local)
 {
     $meat = $this->get_remote($remote . "/Dist/" . $file . ".tgz");
     if ($meat) {
         $localfile = $local . "/Cache/" . $file . ".tgz";
         if (is_file($localfile)) {
             unlink($localfile);
         }
         $fp = fopen($localfile, "wb");
         fwrite($fp, $meat);
         fclose($fp);
         require "lib/tar.class.php";
         $tar = new tar();
         if ($tar->openTAR($localfile)) {
             foreach ($tar->files as $f) {
                 $this->prepare_dir(dirname($local . '/' . $f['name']));
                 $fp = fopen($local . '/' . $f['name'], "wb");
                 fwrite($fp, $f['file'], $f['size']);
                 fclose($fp);
             }
         } else {
             $this->feedback[] = array('num' => 1, 'mes' => sprintf(tra('File %s is not a valid archive'), $localfile));
             return false;
         }
     } else {
         $this->feedback[] = array('num' => 1, 'mes' => sprintf(tra('%s is an empty archive file'), $file));
         return false;
     }
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:29,代码来源:modslib.php

示例2: main

function main()
{
    $tar = new tar();
    $tar->addFile('./test.pdf');
    $tar->toTar('./test_create.tar', false);
    $tar1 = new tar();
    $opened = $tar1->openTAR('./test_create.tar');
    if ($opened) {
        $soubor = $tar1->getFile('./test.pdf');
        echo $soubor["file"];
    } else {
        echo "FAILED TO OPEN ARCHIVE";
    }
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:14,代码来源:tar_test.php

示例3: tar

 /**
  * Untar a downloaded tar ball
  *
  * @return array Returns file list
  */
 function _unPack()
 {
     require_once _XE_PATH_ . 'libs/tar.class.php';
     $oTar = new tar();
     $oTar->openTAR($this->download_file);
     $_files = $oTar->files;
     $file_list = array();
     if (is_array($_files)) {
         foreach ($_files as $key => $info) {
             FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
             $file_list[] = $info['name'];
         }
     }
     return $file_list;
 }
开发者ID:Gunmania,项目名称:xe-core,代码行数:20,代码来源:autoinstall.lib.php

示例4: importLayout

 /**
  * import layout
  * @param int $layout_srl
  * @param string $source_file path of imported file
  * @return void
  */
 function importLayout($layout_srl, $source_file)
 {
     $oLayoutModel = getModel('layout');
     $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
     $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
     foreach ($file_list as $key => $file) {
         FileHandler::removeFile($user_layout_path . $file);
     }
     require_once _XE_PATH_ . 'libs/tar.class.php';
     $image_path = $oLayoutModel->getUserLayoutImagePath($layout_srl);
     FileHandler::makeDir($image_path);
     $tar = new tar();
     $tar->openTAR($source_file);
     // If layout.ini file does not exist
     if (!$tar->getFile('layout.ini')) {
         return;
     }
     $replace_path = getNumberingPath($layout_srl, 3);
     foreach ($tar->files as $key => $info) {
         FileHandler::writeFile($user_layout_path . $info['name'], str_replace('__LAYOUT_PATH__', $replace_path, $info['file']));
     }
     // Remove uploaded file
     FileHandler::removeFile($source_file);
 }
开发者ID:ddmshu,项目名称:xe-core,代码行数:30,代码来源:layout.admin.controller.php

示例5: fopen

     $REX[version] = "2.7";
     // ----- db anlegen
     $file_temp = "include/install/community0.5_redaxo2.7.sql";
     $h = fopen($file_temp, "r");
     $conts = fread($h, filesize($file_temp));
     $all = explode("\n", $conts);
     $add = new sql();
     // $add->debugsql = 1;
     foreach ($all as $hier) {
         $add->setquery(Trim(str_replace("||||||+N+||||||", "\n", $hier), ";"));
         $add->flush();
     }
     // ----- dateien anlegen
     $file_temp = $REX[INCLUDE_PATH] . "/install/community0.5_redaxo2.7.tar.gz";
     $tar = new tar();
     $tar->openTAR($file_temp);
     if (!$tar->extractTar()) {
         $err_msg = $I18N->msg("problem_when_extracting") . "<br>";
         if (count($tar->message) > 0) {
             $err_msg .= $I18N->msg("create_dirs_manually") . "<br>";
             reset($tar->message);
             for ($fol = 0; $fol < count($tar->message); $fol++) {
                 $err_msg .= key($tar->message) . "<br>";
                 next($tar->message);
             }
         }
     }
 } elseif ($dbanlegen == 3) {
     // ----- update
     $fname = "include/install/update2_6-2_7.sql";
     $h = fopen($fname, "r");
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:setup.php

示例6: procShopToolUserSkinImport

        public function procShopToolUserSkinImport(){
            if(!$this->module_srl) exit();

            // check upload
            if(!Context::isUploaded()) exit();
            $file = Context::get('file');
            if(!is_uploaded_file($file['tmp_name'])) exit();
            if(!preg_match('/\.(tar)$/i', $file['name'])) exit();

            $oShopModel = $this->model;
            $skin_path = FileHandler::getRealPath($oShopModel->getShopPath($this->module_srl));

            $tar_file = $skin_path . 'shop_skin.tar';

            FileHandler::removeDir($skin_path);
            FileHandler::makeDir($skin_path);

            if(!move_uploaded_file($file['tmp_name'], $tar_file)) exit();

            require_once(_XE_PATH_.'libs/tar.class.php');

            $tar = new tar();
            $tar->openTAR($tar_file);

            if(!$tar->getFile('shop.html')) return;

            $replace_path = getNumberingPath($this->module_srl,3);
            foreach($tar->files as $key => $info) {
                FileHandler::writeFile($skin_path . $info['name'],str_replace('__SHOP_SKIN_PATH__',$replace_path,$info['file']));
            }

            FileHandler::removeFile($tar_file);
        }
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:33,代码来源:shop.controller.php

示例7: rex_a1_import_files

/**
 * Importiert das Tar-Archiv $filename in den Ordner /files
 * 
 * @param string Pfad + Dateinamen zum Tar-Archiv
 * 
 * @return array Gibt ein Assoc. Array zurück.
 *               'state' => boolean (Status ob fehler aufgetreten sind)
 *               'message' => Evtl. Status/Fehlermeldung  
 */
function rex_a1_import_files($filename)
{
    global $REX, $I18N_IM_EXPORT;
    $return = array();
    $return['state'] = false;
    if ($filename == '') {
        $return['message'] = $I18N_IM_EXPORT->msg("no_import_file_chosen") . "<br>";
        return $return;
    }
    // Ordner /files komplett leeren
    rex_deleteDir($REX['INCLUDE_PATH'] . "/../../files");
    $tar = new tar();
    $tar->openTAR($filename);
    if (!$tar->extractTar()) {
        $msg = $I18N_IM_EXPORT->msg("problem_when_extracting") . "<br>";
        if (count($tar->message) > 0) {
            $msg .= $I18N_IM_EXPORT->msg("create_dirs_manually") . "<br>";
            reset($tar->message);
            for ($fol = 0; $fol < count($tar->message); $fol++) {
                $msg .= rex_absPath(str_replace("'", "", key($tar->message))) . "<br>";
                next($tar->message);
            }
        }
    } else {
        $msg = $I18N_IM_EXPORT->msg("file_imported") . "<br>";
    }
    $return['state'] = true;
    $return['message'] = $msg;
    return $return;
}
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:39,代码来源:function_import_export.inc.php

示例8: unset

                } else {
                    $contents =& $gz_contents;
                }
                $output .= rcms_parse_text('[quote=' . $logfile . ']' . $contents . '[/quote]', true, false, true);
            }
        }
        unset($archive);
    }
    rcms_showAdminMessage($output);
} elseif (!empty($_POST['browse_archive']) && !empty($_POST['browse'])) {
    $frm = new InputForm('', 'post', '&lt;&lt;&lt; ' . __('Back'));
    $frm->show();
    $_POST['browse'] = basename($_POST['browse']);
    if (is_readable($system->logging . $_POST['browse'])) {
        $archive = new tar();
        $archive->openTAR($system->logging . $_POST['browse']);
        $frm = new InputForm('', 'post', __('Show selected'));
        $frm->addbreak(__('Avaible logs in archive') . ' ' . $_POST['browse']);
        $frm->hidden('showlogs_from_archive', '1');
        $frm->hidden('archive', $_POST['browse']);
        foreach ($archive->files as $file_data) {
            if (preg_match("/^((.*?)-(.*?)-(.*?))\\.log(|.gz)\$/i", $file_data['name'], $matches)) {
                $frm->addrow($matches[1], $frm->checkbox('viewlog[]', $file_data['name'], ''));
            }
        }
        $frm->show();
        unset($archive);
    }
} else {
    if (!empty($_POST['build_monthly'])) {
        $system->logMergeByMonth();
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:31,代码来源:logging.php

示例9: tar

    return $html;
}
// Include TAR Class
include "tar.class.php";
// Creating a NEW Tar file
$tar = new tar();
$tar->addFile("exmaple.php");
$tar->addFile("example2.php");
$tar->addFile("tar.class.php");
$tar->toTar("new.tar", FALSE);
// Normal TAR
// $tar->toFile("new.tgz",TRUE);	// Gzipped TAR
unset($tar);
// Appending 2 tar files together, saving in gzipped format (Gzipping requires zlib)
$tar = new tar();
$tar->openTAR("my.tar", FALSE);
$tar->appendTar("another.tar", FALSE);
$tar->toTar("combined.tgz", TRUE);
unset($tar);
// Removing 2 files from the new.tar file created above
$tar = new tar();
$tar->openTar("new.tar", FALSE);
$tar->removeFile("example.php");
$tar->removeFile("example2.php");
$tar->saveTar();
// Saves to currently open TAR file (In this case, new.tar)
unset($tar);
// Check if a TAR file contains a specific file
$tar = new tar();
$tar->openTar("new.tar", FALSE);
if ($tar->containsFile("tar.class.php")) {
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:example2.php

示例10: procTextyleToolUserSkinImport

 function procTextyleToolUserSkinImport()
 {
     if (!$this->module_srl) {
         exit;
     }
     // check upload
     if (!Context::isUploaded()) {
         exit;
     }
     $file = Context::get('file');
     if (!is_uploaded_file($file['tmp_name'])) {
         exit;
     }
     if (!preg_match('/\\.(tar)$/i', $file['name'])) {
         exit;
     }
     $oTextyleModel =& getModel('textyle');
     $skin_path = FileHandler::getRealPath($oTextyleModel->getTextylePath($this->module_srl));
     $tar_file = $skin_path . 'textyle_skin.tar';
     FileHandler::removeDir($skin_path);
     FileHandler::makeDir($skin_path);
     if (!move_uploaded_file($file['tmp_name'], $tar_file)) {
         exit;
     }
     require_once _XE_PATH_ . 'libs/tar.class.php';
     $tar = new tar();
     $tar->openTAR($tar_file);
     if (!$tar->getFile('textyle.html')) {
         return;
     }
     $replace_path = getNumberingPath($this->module_srl, 3);
     foreach ($tar->files as $key => $info) {
         FileHandler::writeFile($skin_path . $info['name'], str_replace('__TEXTYLE_SKIN_PATH__', $replace_path, $info['file']));
     }
     FileHandler::removeFile($tar_file);
 }
开发者ID:google-code-backups,项目名称:xe-textyle,代码行数:36,代码来源:textyle.controller.php

示例11: rtrim

         require "../footer.php";
         exit;
     }
 case "importqimages":
     if ($myrights < 100 || !$allowmacroinstall) {
         echo "You don't have the authority for this action";
         break;
     }
     $uploaddir = rtrim(dirname(__FILE__), '/\\') . '/import/';
     $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
     if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
         if (strpos($uploadfile, '.tar.gz') !== FALSE) {
             include "../includes/tar.class.php";
             include "../includes/filehandler.php";
             $tar = new tar();
             $tar->openTAR($uploadfile);
             if ($tar->hasFiles()) {
                 if ($GLOBALS['filehandertypecfiles'] == 's3') {
                     $n = $tar->extractToS3("qimages", "public");
                 } else {
                     $n = $tar->extractToDir("../assessment/qimages/");
                 }
                 require "../header.php";
                 echo "<p>Extracted {$n} files.  <a href=\"admin.php\">Continue</a></p>\n";
                 require "../footer.php";
                 exit;
             } else {
                 require "../header.php";
                 echo "<p>File appears to contain nothing</p>\n";
                 require "../footer.php";
                 exit;
开发者ID:ericvanboven,项目名称:IMathAS,代码行数:31,代码来源:actions.php


注:本文中的tar::openTAR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。