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


PHP tar类代码示例

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


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

示例1: execute

 function execute(&$controller, &$xoopsUser)
 {
     if (xoops_getrequest('_form_control_cancel') != null) {
         return LEGACYRENDER_FRAME_VIEW_CANCEL;
     }
     $this->mActionForm->fetch();
     $this->mActionForm->validate();
     if ($this->mActionForm->hasError()) {
         return $this->getDefaultView($controller, $xoopsUser);
     }
     require_once XOOPS_ROOT_PATH . "/class/class.tar.php";
     $tar = new tar();
     $formFile = $this->mActionForm->get('upload');
     //
     // [Warn] access private member directly
     // TODO We should define the access method because we oftern
     //      access private member of XCube_FormFile.
     //
     $tar->openTar($formFile->_mTmpFileName);
     if (!is_array($tar->files)) {
         return LEGACYRENDER_FRAME_VIEW_ERROR;
     }
     $tplsetName = null;
     foreach ($tar->files as $id => $info) {
         $infoArr = explode('/', str_replace("\\", '/', $info['name']));
         $tplsetName = $this->mActionForm->get('tplset_name');
         if ($tplsetName == null) {
             $tplsetName = trim($infoArr[0]);
         }
         if ($tplsetName != null) {
             break;
         }
     }
     //
     // Check tplset name.
     //
     if ($tplsetName == null || preg_match('/[' . preg_quote('\\/:*?"<>|', '/') . ']/', $tplsetName)) {
         $this->_addErrorMessage(_AD_LEGACYRENDER_ERROR_TPLSET_NAME_WRONG);
         return LEGACYRENDER_FRAME_VIEW_ERROR;
     }
     $handler =& xoops_getmodulehandler('tplset');
     if ($handler->getCount(new Criteria('tplset_name', $tplsetName)) != 0) {
         $this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_TPLSET_ALREADY_EXISTS, $tplsetName));
         return LEGACYRENDER_FRAME_VIEW_ERROR;
     }
     $tplset =& $handler->create();
     $tplset->set('tplset_name', $tplsetName);
     if (!$handler->insert($tplset)) {
         $this->_addErrorMessage(_AD_LEGACYRENDER_ERROR_COULD_NOT_SAVE_TPLSET);
         return LEGACYRENDER_FRAME_VIEW_ERROR;
     }
     $themeimages = array();
     if (!$this->_fetchTemplateFiles($tar, $tplset, $themeimages)) {
         return LEGACYRENDER_FRAME_VIEW_ERROR;
     }
     if (!$this->_fetchImageset($tar, $tplset, $themeimages)) {
         return LEGACYRENDER_FRAME_VIEW_ERROR;
     }
     return LEGACYRENDER_FRAME_VIEW_SUCCESS;
 }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:60,代码来源:TplsetUploadAction.class.php

示例2: processform

 public function processform()
 {
     $plugin = tsourcefiles::i();
     if (isset($_POST['download'])) {
         set_time_limit(300);
         $version = litepublisher::$options->version;
         if (!(($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz")))) {
             return 'Error download';
         }
         tbackuper::include_tar();
         $tar = new tar();
         $tar->loadfromstring($s);
         if (!is_array($tar->files)) {
             unset($tar);
             return 'Invalid file archive';
         }
         tfiler::delete($plugin->root, true, false);
         foreach ($tar->files as $item) {
             $filename = $plugin->root . $item['name'];
             $dir = dirname($filename);
             if (!is_dir($dir)) {
                 $this->mkdir($dir);
             }
             file_put_contents($filename, $item['file']);
             @chmod($filename, 0666);
         }
         unset($tar);
         $plugin->reread();
     } elseif (isset($_POST['reread'])) {
         $plugin->reread();
     } else {
         $plugin->root = $_POST['root'];
         $plugin->save();
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:35,代码来源:admin.sourcefiles.class.php

示例3: execute

	function execute(&$controller, &$xoopsUser)
	{
		$form_cancel = $controller->mRoot->mContext->mRequest->getRequest('_form_control_cancel');
		if ($form_cancel != null) {
			return USER_FRAME_VIEW_CANCEL;
		}

		$this->mActionForm->fetch();
		$this->mActionForm->validate();
		
		if ($this->mActionForm->hasError()) {
			return $this->getDefaultView($controller, $xoopsUser);
		}
		
		$formFile = $this->mActionForm->get('upload');		
		$formFileExt = $formFile->getExtension();
		$files = array();
		$avatarimages = array();

		if ( strtolower($formFileExt) == "zip" ) {
		If ( !file_exists(XOOPS_ROOT_PATH . "/class/Archive_Zip.php") ) {
			return USER_FRAME_VIEW_ERROR;
		}
		require_once XOOPS_ROOT_PATH . "/class/Archive_Zip.php" ;
		$zip = new Archive_Zip($formFile->_mTmpFileName) ;
		$files = $zip->extract( array( 'extract_as_string' => true ) ) ;
		if( ! is_array( @$files ) ) {
		return USER_FRAME_VIEW_ERROR;
		}
		if (!$this->_fetchZipAvatarImages($files, $avatarimages)) {
			return USER_FRAME_VIEW_ERROR;
		}		
		}//if zip end
		else { 
		require_once XOOPS_ROOT_PATH . "/class/class.tar.php";
		$tar =new tar();
		$tar->openTar($formFile->_mTmpFileName);
		if (!is_array( @$tar->files)) {
			return USER_FRAME_VIEW_ERROR;
		}
		if (!$this->_fetchTarAvatarImages($tar->files, $avatarimages)) {
			return USER_FRAME_VIEW_ERROR;
		}		
		}//end tar
						
		if (!$this->_saveAvatarImages($avatarimages)) {
			return USER_FRAME_VIEW_ERROR;
		}
		return USER_FRAME_VIEW_SUCCESS;

	}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:51,代码来源:AvatarUploadAction.class.php

示例4: 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

示例5: MakeWikiZip

 function MakeWikiZip($pExportFile)
 {
     global $gBitUser, $gBitSystem;
     include_once UTIL_PKG_PATH . "tar.class.php";
     $tar = new tar();
     $query = "SELECT wp.`page_id` from `" . BIT_DB_PREFIX . "wiki_pages` wp INNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = wp.`content_id`) \n\t\t\t\t  ORDER BY lc." . $this->mDb->convertSortmode("title_asc");
     $result = $this->mDb->query($query, array());
     while ($res = $result->fetchRow()) {
         $page_id = $res["page_id"];
         $content = $this->export_wiki_page($page_id, 0);
         $tar->addData($page_id, $content, $gBitSystem->getUTCTime());
     }
     $tar->toTar($pExportFile, FALSE);
     return '';
 }
开发者ID:bitweaver,项目名称:wiki,代码行数:15,代码来源:export_lib.php

示例6: MakeWikiZip

 function MakeWikiZip()
 {
     global $tikidomain;
     $zipname = 'wikidb.zip';
     include_once 'lib/tar.class.php';
     $tar = new tar();
     $query = 'select `pageName` from `tiki_pages` order by ' . $this->convertSortMode('pageName_asc');
     $result = $this->query($query, array());
     while ($res = $result->fetchRow()) {
         $page = $res['pageName'];
         $content = $this->export_wiki_page($page, 0);
         $tar->addData($page, $content, $this->now);
     }
     $dump = 'dump';
     if ($tikidomain) {
         $dump .= "/{$tikidomain}";
     }
     $tar->toTar("{$dump}/export.tar", FALSE);
     return '';
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:20,代码来源:exportlib.php

示例7: MakeWikiZip

 function MakeWikiZip()
 {
     global $tikidomain;
     $zipname = "wikidb.zip";
     include_once "lib/tar.class.php";
     $tar = new tar();
     $query = "select `pageName` from `tiki_pages` order by " . $this->convert_sortmode("pageName_asc");
     $result = $this->query($query, array());
     while ($res = $result->fetchRow()) {
         $page = $res["pageName"];
         $content = $this->export_wiki_page($page, 0);
         $tar->addData($page, $content, date("U"));
     }
     $dump = "dump";
     if ($tikidomain) {
         $dump .= "/{$tikidomain}";
     }
     $tar->toTar("{$dump}/export.tar", FALSE);
     return '';
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:20,代码来源:exportlib.php

示例8: s_export_structure

 function s_export_structure($structure_id)
 {
     global $exportlib, $tikidomain;
     global $dbTiki;
     include_once 'lib/wiki/exportlib.php';
     include_once 'lib/tar.class.php';
     $page_info = $this->s_get_structure_info($structure_id);
     $page_name = $page_info['pageName'];
     $zipname = $page_name . '.zip';
     $tar = new tar();
     $pages = $this->s_get_structure_pages($page_info['page_ref_id']);
     foreach ($pages as $page) {
         $data = $exportlib->export_wiki_page($page['pageName'], 0);
         $tar->addData($page['pageName'], $data, $this->now);
     }
     $dump = 'dump';
     if ($tikidomain) {
         $dump .= "/{$tikidomain}";
     }
     $tar->toTar("{$dump}/{$page_name}.tar", FALSE);
     header("location: {$dump}/{$page_name}.tar");
     return '';
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:23,代码来源:structlib.php

示例9: foreach

    foreach ($dir_array as $n) {
        #echo $n."<br>";
        if ($n != '.' and $n != '..') {
            #echo "hier : $n <br>";
            if (is_dir($predir . $dir . "/" . $n)) {
                add_file_reku($predir . $dir . "/", $n);
            }
            if (!is_dir($predir . $dir . "/" . $n)) {
                $tar->addFile($predir . $dir . "/" . $n, TRUE);
            }
            #echo $predir.$dir."/".$n."<br>";
        }
    }
}
if ($FORM[filesubmit]) {
    $tar = new tar();
    foreach ($DIR as $key => $item) {
        add_file_reku("../", $key);
    }
    header("Content-type: tar/gzip");
    header("Content-Disposition: attachment; filename=redaxo_export_" . date("Ymd") . ".tar.gz");
    echo $tar->toTarOutput("redaxo_export_" . date("Ymd") . ".tar.gz", TRUE);
    exit;
}
if (isset($err_msg)) {
    $err_msg = "<tr><td class=dgrey colspan=2><font color=error>{$err_msg}</font></td></tr>";
}
## make dir inputs
chdir("..");
$handle = opendir(".");
$dirstring = "";
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:export.inc.php

示例10: fopen

     // ----- community0.5 anlegen
     $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";
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:setup.php

示例11: elseif

        } elseif ($extension == 'tar.gz') {
            gzAbortNotLoaded();
            $temp = gzTempfile($file);
            $temp = realpath($temp);
            include 'classes/class.tar.php';
            $tar = new tar();
            $tar->new_tar(viscacha_dirname($temp), basename($temp));
            $tar->extract_files(realpath($dir));
            $err = $tar->error;
            $filesystem->unlink($temp);
            if (!empty($err)) {
                error($redirect, $err);
            }
        } elseif ($extension == 'tar') {
            include 'classes/class.tar.php';
            $tar = new tar();
            $file = realpath($file);
            $tar->new_tar(viscacha_dirname($file), basename($file));
            $tar->extract_files($dir);
        } elseif ($extension == 'gz') {
            gzAbortNotLoaded();
            $new = $dir . DIRECTORY_SEPARATOR . basename($file);
            $temp = gzTempfile($file, $new);
        }
    }
    if (!isset($extension)) {
        error($redirect, 'File is not an supported archive. (Failed at position: setting extension)');
    } else {
        ok($redirect);
    }
} else {
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:explorer.php

示例12: dump

 function dump()
 {
     global $tikidomain, $wikiHomePage, $style;
     $dump_path = "dump";
     if ($tikidomain) {
         $dump_path .= "/{$tikidomain}";
     }
     @unlink("{$dump_path}/new.tar");
     $tar = new tar();
     $tar->addFile("styles/{$style}");
     // Foreach page
     $query = "select * from `tiki_pages`";
     $result = $this->query($query, array());
     while ($res = $result->fetchRow()) {
         $pageName = $res["pageName"] . '.html';
         $dat = $this->parse_data($res["data"]);
         // Now change index.php?page=foo to foo.html
         // and index.php to HomePage.html
         $dat = preg_replace("/tiki-index.php\\?page=([^\\'\"\$]+)/", "\$1.html", $dat);
         $dat = preg_replace("/tiki-editpage.php\\?page=([^\\'\"\$]+)/", "", $dat);
         //preg_match_all("/tiki-index.php\?page=([^ ]+)/",$dat,$cosas);
         //print_r($cosas);
         $data = "<html><head><title>" . $res["pageName"] . "</title><link rel='StyleSheet' href='styles/{$style}' type='text/css'></head><body><a class='wiki' href='{$wikiHomePage}.html'>home</a><br /><h1>" . $res["pageName"] . "</h1><div class='wikitext'>" . $dat . '</div></body></html>';
         $tar->addData($pageName, $data, $res["lastModif"]);
     }
     $tar->toTar("{$dump_path}/new.tar", FALSE);
     unset($tar);
     $action = "dump created";
     $t = date("U");
     $query = "insert into `tiki_actionlog`(`action`,`pageName`,`lastModif`,`user`,`ip`,`comment`) values(?,?,?,?,?,?)";
     $result = $this->query($query, array($action, $wikiHomePage, $t, 'admin', $_SERVER["REMOTE_ADDR"], ''));
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:32,代码来源:adminlib.php

示例13: logMerge

 function logMerge($title, $t_d, $t_m, $t_y, $f_d = 1, $f_m = 1, $f_y = 1980)
 {
     $logs = rcms_scandir($this->logging);
     $f = mktime(0, 0, 0, $f_m, $f_d, $f_y);
     $t = mktime(0, 0, 0, $t_m, $t_d, $t_y);
     $to_merge = array();
     foreach ($logs as $log_entry) {
         if (preg_match("/^(.*?)-(.*?)-(.*?)\\.log(|.gz)\$/i", $log_entry, $matches)) {
             $c = mktime(0, 0, 0, $matches[2], $matches[3], $matches[1]);
             if ($c >= $f && $c <= $t) {
                 $to_merge[] = $log_entry;
             }
         }
     }
     if (!empty($to_merge)) {
         if ($this->logging_gz) {
             $suffix = '.gz';
         } else {
             $suffix = '';
         }
         $merged_file = $this->logging . $title . '.tar' . $suffix;
         $merged = new tar();
         $merged->isGzipped = $this->logging_gz;
         $merged->filename = $merged_file;
         $path = getcwd();
         chdir($this->logging);
         foreach ($to_merge as $file) {
             $merged->addFile($file, substr($file, -3) == '.gz');
         }
         chdir($path);
         if ($merged->saveTar()) {
             foreach ($to_merge as $file) {
                 rcms_delete_files($this->logging . $file);
             }
         }
     }
     return true;
 }
开发者ID:Parashutik,项目名称:ReloadCMS,代码行数:38,代码来源:system.php

示例14: _unPack

 /**
  * 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

示例15: rex_tar

 function rex_tar()
 {
     parent::tar();
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:4,代码来源:class.rex_tar.inc.php


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