本文整理汇总了PHP中tar::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP tar::getFile方法的具体用法?PHP tar::getFile怎么用?PHP tar::getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tar
的用法示例。
在下文中一共展示了tar::getFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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";
}
}
示例2: 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);
}
示例3: 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);
}
示例4: elseif
$output .= rcms_parse_text('[quote=' . $logfile . ']' . $contents . '[/quote]', true, false, true);
}
rcms_showAdminMessage($output);
} elseif (!empty($_POST['showlogs_from_archive']) && !empty($_POST['archive']) && !empty($_POST['viewlog']) && is_array($_POST['viewlog'])) {
$frm = new InputForm('', 'post', '<<< ' . __('Back'));
$frm->hidden('browse_archive', '1');
$frm->hidden('browse', $_POST['archive']);
$frm->show();
$_POST['archive'] = basename($_POST['archive']);
if (@is_readable($system->logging . $_POST['archive'])) {
$output = '';
$archive = new tar();
$archive->openTAR($system->logging . $_POST['archive']);
foreach ($_POST['viewlog'] as $logfile) {
$logfile = basename($logfile);
if ($gz_contents = $archive->getFile($logfile)) {
$gz_contents = $gz_contents['file'];
if (substr($logfile, -3) == '.gz') {
file_write_contents($system->logging . $logfile, $gz_contents);
$contents = gzfile_get_contents($system->logging . $logfile);
rcms_delete_files($system->logging . $logfile);
} 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'])) {
示例5: tar
$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")) {
echo "This tar file contains a file named 'tar.class.php'!<br>\n";
} else {
echo "This tar file does NOT contain a file named 'tar.class.php'!<br>\n";
}
// There is no need to save our tar file since we did not edit it, so delete our tar class
unset($tar);
// Get information about a file in a TAR file
$tar = new tar();
$tar->openTar("new.tar");
// If second argument is not present, default is FALSE
$information = $tar->getFile("tar.class.php");
echo "<br>\n<b>Information about tar.class.php!</b><br>\n";
foreach ($information as $key => $value) {
echo " {$key} = " . text2html($value) . "<br>\n";
}
echo "<br>\n";
echo "</font>";
示例6: 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);
}