當前位置: 首頁>>代碼示例>>PHP>>正文


PHP rar_list函數代碼示例

本文整理匯總了PHP中rar_list函數的典型用法代碼示例。如果您正苦於以下問題:PHP rar_list函數的具體用法?PHP rar_list怎麽用?PHP rar_list使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了rar_list函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Analyze

 public function Analyze()
 {
     $info =& $this->getid3->info;
     $info['fileformat'] = 'rar';
     if ($this->option_use_rar_extension === true) {
         if (function_exists('rar_open')) {
             if ($rp = rar_open($info['filenamepath'])) {
                 $info['rar']['files'] = array();
                 $entries = rar_list($rp);
                 foreach ($entries as $entry) {
                     $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
                 }
                 rar_close($rp);
                 return true;
             } else {
                 $info['error'][] = 'failed to rar_open(' . $info['filename'] . ')';
             }
         } else {
             $info['error'][] = 'RAR support does not appear to be available in this PHP installation';
         }
     } else {
         $info['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)';
     }
     return false;
 }
開發者ID:anandsrijan,項目名稱:mahariya-001,代碼行數:25,代碼來源:module.archive.rar.php

示例2: load_toc

 public function load_toc()
 {
     if ($fp = rar_open($this->filename)) {
         $entries = rar_list($fp);
         $this->toc['cd']['entries'] = count($entries);
         $dir = NULL;
         for ($i = 0; $i < $this->toc['cd']['entries']; ++$i) {
             //			foreach ($entries as $entry) {
             $entry['filename'] = $entries[$i]->getName();
             $entry['crc'] = $entries[$i]->getCrc();
             $entry['mode'] = $entries[$i]->getAttr();
             $entry['size'] = $entries[$i]->getUnpackedSize();
             $entry['compressed_size'] = $entries[$i]->getPackedSize();
             $entry['mtime'] = strtotime($entries[$i]->getFileTime());
             $entry['version'] = $entries[$i]->getVersion();
             if (substr($entry['filename'], -1) != '/') {
                 $this->toc['files'][$i] = $entry;
                 $dir['entries'][$i] =& $this->toc['files'][$i];
             } else {
                 $this->toc['dirs'][$i] = $entry;
                 $dir =& $this->toc['dirs'][$i];
             }
         }
         rar_close($fp);
         return true;
     }
     return false;
 }
開發者ID:cbsistem,項目名稱:nexos,代碼行數:28,代碼來源:rar.php

示例3: uncompress_rar

	public function uncompress_rar($path, $cachedir) {
		$rar_file = rar_open($path);
		$entries = rar_list($rar_file);
		$allowed = array('.jpg', '.gif', '.png', 'jpeg');
		foreach ($entries as $entry) {
			if (in_array(substr($entry->getName(), -4), $allowed))
				$entry->extract($cachedir);
		}
		rar_close($rar_file);
	}
開發者ID:Nakei,項目名稱:FoOlSlide,代碼行數:10,代碼來源:files_model.php

示例4: unrar

function unrar($rarfile)
{
    $rar_file = rar_open($rarfile) or die("Can't open Rar archive");
    $entries = rar_list($rar_file);
    foreach ($entries as $entry) {
        echo 'Filename: ' . $entry->getName() . "\n";
        echo 'Packed size: ' . $entry->getPackedSize() . "\n";
        echo 'Unpacked size: ' . $entry->getUnpackedSize() . "\n";
        $entry->extract('D:/usr/lioncube/');
    }
    rar_close($rar_file);
}
開發者ID:pankajsinghjarial,項目名稱:SYLC-AMERICAN,代碼行數:12,代碼來源:zip_funct.php

示例5: extract

 public function extract($source, $target, $password)
 {
     $rarFile = rar_open(suffix($source, '.rar'), $password);
     $list = rar_list($rarFile);
     if (!empty($list)) {
         foreach ($list as $file) {
             $entry = rar_entry_get($rarFile, $file);
             $entry->extract($target);
         }
     } else {
         throw new InvalidArgumentException('Error', 'emptyVariable', '$list');
     }
     rar_close($rarFile);
 }
開發者ID:znframework,項目名稱:znframework,代碼行數:14,代碼來源:RAR.php

示例6: unrarFile

function unrarFile()
{
    $rar_file = rar_open(RAR_FILE);
    try {
        $list = rar_list($rar_file);
        foreach ($list as $file) {
            $file->extract(TARGET_DIR);
        }
    } catch (Exception $e) {
        try {
            rar_close($rar_file);
        } catch (Exception $e) {
        }
        echo "An exception occured while extracting archive: " . $e . "\n";
    }
}
開發者ID:sasfeld,項目名稱:Scripts,代碼行數:16,代碼來源:index_extractor.php

示例7: extract

 public function extract($source = '', $target = '.', $password = NULL)
 {
     if (!is_file($source)) {
         return Error::set('Error', 'fileParameter', '1.(source)');
     }
     $rarFile = rar_open($source, $password);
     $list = rar_list($rarFile);
     if (!empty($list)) {
         foreach ($list as $file) {
             $entry = rar_entry_get($rarFile, $file);
             $entry->extract($target);
         }
     } else {
         return Error::set('Error', 'emptyVariable', '$list');
     }
     rar_close($rarFile);
 }
開發者ID:bytemtek,項目名稱:znframework,代碼行數:17,代碼來源:RAR.php

示例8: getArchiveTree

function getArchiveTree($level = 1)
{
    $tree = [];
    if (isset($_GET['path'])) {
        //TODO: Common::checkPath($path) return false...
        $source = getWorkspacePath($_GET['path']);
        //$source = WORKSPACE . "/" . $_GET['path'];
        if (file_exists($source)) {
            $source_info = pathinfo($source);
            if (isset($source_info['extension']) && !empty($source_info['extension'])) {
                $des = dirname($source);
                if ($source_info['extension'] == 'zip') {
                    if (class_exists('ZipArchive') && ($zip = new ZipArchive())) {
                        if ($res = $zip->open($source)) {
                            for ($i = 0; $i < $zip->numFiles; $i++) {
                                $name = $zip->getNameIndex($i);
                                $path = $name;
                                $count = substr_count($path, '/');
                                if ($count > $level) {
                                    continue;
                                }
                                $tree[$name] = $path;
                            }
                            $zip->close();
                        }
                    }
                } elseif ($source_info['extension'] == 'tar') {
                    if (class_exists('PharData') && ($tar = new PharData($source))) {
                        //TODO: get tar tree
                    }
                } elseif ($source_info['extension'] == 'rar') {
                    if (class_exists('rar_open') && ($rar = new rar_open())) {
                        if ($res = $rar->open($source)) {
                            $entries = rar_list($res);
                            //TODO: get rar tree
                            $rar->close();
                        }
                    }
                }
            }
        }
    }
    return $tree;
}
開發者ID:practico,項目名稱:Codiad-Archives,代碼行數:44,代碼來源:functions.php

示例9: next

 /**
  * @see File_Archive_Reader::next()
  */
 function next()
 {
     $error = parent::next();
     if (PEAR::isError($error)) {
         return $error;
     }
     if ($this->rarFile === null) {
         $dataFilename = $this->source->getDataFilename();
         if ($dataFilename !== null) {
             $this->rarTmpName = null;
             $this->rarFile = rar_open($dataFilename);
         } else {
             $this->rarTmpName = tempnam(File_Archive::getOption('tmpDirectory'), 'far');
             //Generate the tmp data
             $dest = new File_Archive_Writer_Files();
             $dest->newFile($this->tmpName);
             $this->source->sendData($dest);
             $dest->close();
             $this->rarFile = rar_open($this->tmpName);
         }
         if (!$this->rarFile) {
             return PEAR::raiseError("Unable to open rar file {$dataFilename}");
         }
         if ($this->rarList === null) {
             $this->rarList = rar_list($this->rarFile);
             reset($this->rarList);
         }
     }
     if ($fileReader !== null) {
         $this->fileReader->close();
         $this->fileReader = null;
     }
     $entryName = next($this->rarList);
     $this->source = null;
     if ($entryName === false) {
         return false;
     }
     $this->rarEntry = rar_entry_get($this->rarFile, $entryName);
     if (!$this->rarEntry) {
         return PEAR::raiseError("Error reading entry {$entryName}");
     }
     return true;
 }
開發者ID:orcoliver,項目名稱:oneye,代碼行數:46,代碼來源:Rar.php

示例10: extract

 /**
  * Extract a ZIP compressed file to a given path
  *
  * @access	public
  * @param	string	$archive		Path to ZIP archive to extract
  * @param	string	$destination	Path to extract archive into
  * @param	array	$options		Extraction options [unused]
  * @return	boolean	True if successful
  * @since	1.5
  */
 function extract($archive, $destination, $options = array())
 {
     if (!is_file($archive)) {
         return PEAR::raiseError('Archive does not exist');
     }
     if (!$this->isSupported()) {
         return PEAR::raiseError('RAR Extraction not supported by your PHP installation.');
     }
     $arch = rar_open($archive);
     if ($arch === FALSE) {
         return PEAR::raiseError("Cannot open the rar archive");
     }
     $entries = rar_list($arch);
     if ($entries === FALSE) {
         return PEAR::raiseError("Cannot retrieve entries");
     }
     foreach ($entries as $file) {
         $file->extract($destination);
     }
     return true;
 }
開發者ID:xamiro-dev,項目名稱:xamiro,代碼行數:31,代碼來源:rar.php

示例11: func_rar

function func_rar($path1, $file2, $unrar = '')
{
    if (!function_exists("rar_open")) {
        if ($unrar['key'] == false) {
            echo 'You have not selected the variable $unrar=$arc[type_archive] in setup.php';
            echo "\n";
            $error6 = 1;
        }
        if ($unrar['path'] == false) {
            echo 'You have not selected the variable $unrar[path] in setup.php';
            echo "\n";
            $error6 = 1;
        }
        //echo $unrar['path'].' '.$unrar['key'].' '.$path1.'/'.$file2.' '.$unrar['out_dir'].$path1.'/'; echo "\n\n";
        exec($unrar['path'] . ' ' . $unrar['key'] . ' ' . $path1 . '/' . $file2 . ' ' . $unrar['out_dir'] . $path1 . '/', $out, $val);
        //print_r($out);
        if (!isset($out[1])) {
            echo "There no installed php functions php-rar or bash function unrar. Install one of this functions\n";
        }
        if ($out[$unrar['id_ok']] == $unrar['value_ok'] && $error6 == false) {
            return 0;
        } else {
            return 1;
        }
    } else {
        //echo "rar_php\n";
        $rar_file = @rar_open($path1 . '/' . $file2);
        if ($rar_file == false) {
            return false;
        } else {
            $entries = rar_list($rar_file);
            foreach ($entries as $entry) {
                $entry->extract($path1);
            }
            rar_close($rar_file);
            return 0;
        }
    }
}
開發者ID:RoSk0,項目名稱:nod_upd_php,代碼行數:39,代碼來源:functions.php

示例12: content_do_import_data


//.........這裏部分代碼省略.........
        // get the data from the file
        while ($d = bzread($bz)) {
            fwrite($import_filehandle, $d);
        }
        // close the compressed file
        bzclose($bz);
    } elseif ($compression == 'gz') {
        // open file for reading
        $zp = gzopen($thefile, 'r');
        // get the data from the file
        while ($d = gzread($zp, 1024)) {
            fwrite($import_filehandle, $d);
        }
        // close the compressed file
        gzclose($zp);
    } elseif ($compression == 'zip') {
        // open the zip archive
        if ($zip = zip_open($thefile)) {
            // zip can have multiple files
            while ($zip_entry = zip_read($zip)) {
                // include the data in ALL the zipped files
                if (zip_entry_open($zip, $zip_entry, "r")) {
                    fwrite($import_filehandle, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
                }
                zip_entry_close($zip_entry);
            }
            // close the compressed file handle
            zip_close($zip);
        }
    } elseif ($compression == 'rar') {
        // open the rar archive
        if ($rar = rar_open($thefile)) {
            // rar can have multiple files
            $entries = rar_list($rar);
            // include the data in ALL the rar'd files
            $rar_temp_name = tempnam(FALSE, 'sqlicity_rar');
            foreach ($entries as $entry) {
                // get the actual entry for extracting
                $entry = rar_entry_get($rar, $entry);
                // have to create the extracted file, read it then delete it...
                //  because rar ONLY has an extract() function, no direct read!
                if ($entry->extract(FALSE, $rar_temp_name)) {
                    fwrite($import_filehandle, file_get_contents($rar_temp_name));
                }
            }
            // close the compressed file handle and remove temp file
            unlink($rar_temp_name);
            rar_close($rar);
        }
    } else {
        // open plaintext file for reading
        $pt = fopen($thefile, 'r');
        // get the data from the file
        while ($d = fread($pt, 1024)) {
            fwrite($import_filehandle, $d);
        }
        // close the plaintext file
        fclose($pt);
    }
    //	else { fwrite($import_filehandle, file_get_contents($thefile))); }
    // needed for escaping input chars
    global $mysql_escaped_chars;
    // we just wrote the file for import, now back up to read it all in
    rewind($import_filehandle);
    // fseek($import_filehandle, 0);
    while (!feof($import_filehandle)) {
開發者ID:rogusdev,項目名稱:SQLicity,代碼行數:67,代碼來源:sqlicity.php

示例13: scandisk

function scandisk($dir, $sendermail = false)
{
    //mysql_query("INSERT INTO temir (text) VALUES('asdf')");
    $files = scandir($dir, 1);
    if (is_file($file = $dir . '/' . $files[0])) {
        //parsexcelsimple($file);
        $info = pathinfo($file);
        if (!$sendermail) {
            $sender = explode('--', $info['filename']);
            if (isset($sender[1])) {
                $sendermail = $sender[1];
            } else {
                $sendermail = '';
            }
            /*if($sendermail=='alla-ultra@mail.ru')
              {
                  $newname=$dir.'/the--alla-ultra@mail.ru--file.xml';
                  rename($file, $newname); //because alla sends xml file with xls extension
                  $file=$newname;
              }*/
        }
        $path = pathinfo(realpath($file), PATHINFO_DIRNAME);
        if ($info["extension"] == "xls" || $info["extension"] == "xlsx" || $info["extension"] == "xml") {
            //file from alla-ultra is saved as xls and it's corrupt. to fix it we use convert() in dmail() and skip the corrupted one here
            //file from elenaultra is saved as skip and it's kinda also corrupt
            if (strpos($info["basename"], 'alla-ultra@mail.ru--file.xls') === false || strpos($info["basename"], 'skip') === false) {
                parsexcel($file, $sendermail);
                //parsexcelsimple($file,$sendermail);
                $sendermail = '';
            } else {
                $sendermail = false;
            }
        } elseif ($info["extension"] == "zip") {
            $zip = new ZipArchive();
            if ($zip->open($file) === TRUE) {
                $zip->extractTo($path);
                $zip->close();
            } else {
                die("Can't open zip archive");
            }
        } elseif ($info["extension"] == "rar") {
            //install rar from here:http://php.net/manual/en/rar.installation.php
            $rar_file = rar_open($file) or die("Can't open Rar archive");
            $entries = rar_list($rar_file);
            foreach ($entries as $entry) {
                $entry->extract($path);
            }
            rar_close($rar_file);
        }
        unlink($file);
        scandisk($dir, $sendermail);
    }
}
開發者ID:temirfe,項目名稱:jugur,代碼行數:53,代碼來源:jugur.php

示例14: rar_open

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="-1">
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" type="text/css" href="css/book.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.transform2d.js"></script>
<script type="text/javascript">
    var pageIndex = 0;
    var pageTable = [];
<?php 
// Unzip the file and load the pages
$pageCount = 0;
if ($mimetype == 'application/x-rar-compressed') {
    $rar_file = rar_open($path) or die("Failed to open Rar archive");
    $list = rar_list($rar_file);
    usort($list, "cmp_rar_obj");
    foreach ($list as $file) {
        if ($file->getUnpackedSize() > 0 && preg_match('/jp(e?)g|gif|png/i', $file->getName())) {
            $lhs = rawurlencode($file->getName());
            $rhs = basename($file->getName());
            print "pageTable.push([\"" . $lhs . "\",\"" . $rhs . "\"]);";
            $pageCount++;
        }
    }
} elseif ($mimetype == 'application/zip') {
    $zip = new ZipArchive();
    $zip->open($path) or die("cannot open {$relpath}!\n");
    $filelist = array();
    for ($i = 0; $i < $zip->numFiles; $i++) {
        $entry = $zip->statIndex($i);
開發者ID:awgh,項目名稱:php-cbviewer,代碼行數:31,代碼來源:book.php

示例15: decompress

 /**
  * Decompresses the given content
  *
  * @param  string $content
  * @return bool
  * @throws Exception\RuntimeException if archive not found, cannot be opened,
  *                                    or error during decompression
  */
 public function decompress($content)
 {
     if (!file_exists($content)) {
         throw new Exception\RuntimeException('RAR Archive not found');
     }
     $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, realpath($content));
     $password = $this->getPassword();
     if ($password !== null) {
         $archive = rar_open($archive, $password);
     } else {
         $archive = rar_open($archive);
     }
     if (!$archive) {
         throw new Exception\RuntimeException("Error opening the RAR Archive");
     }
     $target = $this->getTarget();
     if (!is_dir($target)) {
         $target = dirname($target);
     }
     $filelist = rar_list($archive);
     if (!$filelist) {
         throw new Exception\RuntimeException("Error reading the RAR Archive");
     }
     foreach ($filelist as $file) {
         $file->extract($target);
     }
     rar_close($archive);
     return true;
 }
開發者ID:Flesh192,項目名稱:magento,代碼行數:37,代碼來源:Rar.php


注:本文中的rar_list函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。