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


PHP PclTarExtract函数代码示例

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


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

示例1: extractTarGzip

 /**
 
     TarGzip file extractor function
   @param string Archive file
     @param string extraction path
   @return string
 */
 function extractTarGzip($archFile, $extractPath = ".")
 {
     /* include TAR library */
     require_once 'pcltar.func.php';
     /* extract and return list of extracted files */
     return PclTarExtract($archFile, $extractPath);
 }
开发者ID:4otaku,项目名称:4otaku,代码行数:14,代码来源:ArchiveExtractor.class.php

示例2: extractArchive

 function extractArchive()
 {
     global $mosConfig_absolute_path;
     $base_Dir = $this->pathName($mosConfig_absolute_path . "/media/");
     $archivename = $base_Dir . $this->installArchive();
     $tmpdir = uniqid("install_");
     if ($this->isWindows()) {
         $extractdir = str_replace('/', '\\', $this->pathName($base_Dir . "{$tmpdir}"));
         $archivename = str_replace('/', '\\', $archivename);
     } else {
         $extractdir = str_replace('\\', '/', $this->pathName($base_Dir . "{$tmpdir}"));
         $archivename = str_replace('\\', '/', $archivename);
     }
     $this->unpackDir($extractdir);
     // Find the extension of the file
     $fileext = substr(strrchr(basename($this->installArchive()), '.'), 1);
     if ($fileext == "gz" || $fileext == "tar") {
         PclTarExtract($archivename, $extractdir);
         if (PclErrorCode() != 1) {
             echo "<font color=\"red\">" . PclErrorString() . "<br />Updater -  error</font>";
             TrDisplay();
             exit;
         }
         $this->installDir($extractdir);
     } else {
         $zipfile = new PclZip($archivename);
         if ($this->isWindows()) {
             define('OS_WINDOWS', 1);
         } else {
             define('OS_WINDOWS', 0);
         }
         $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
         if ($ret == 0) {
             $this->setError(1, "Unrecoverable error '" . $zipfile->errorName(true) . "'", "Updater -  error");
             return false;
         }
         $this->installDir($extractdir);
     }
     // Try to find the correct install dir. in case that the package have subdirs
     // Save the install dir for later cleanup
     $filesindir = $this->readDirectory($this->installDir(), "");
     if (count($filesindir) == 1) {
         if (is_dir($extractdir . $filesindir[0])) {
             $this->installDir($extractdir . $filesindir[0]);
         }
     }
     return true;
 }
开发者ID:BGCX261,项目名称:zoom-gallery-svn-to-git,代码行数:48,代码来源:update.class.php

示例3: switch

     XoopsLoad::load('pclzip', 'system');
     XoopsLoad::load('pcltar', 'system');
     $file1 = XoopsFile::getHandler('file', $path_file);
     $extension = $file1->ext();
     switch ($extension) {
         case 'zip':
             $archive = new PclZip($path_file);
             if ($archive->extract(PCLZIP_OPT_PATH, $path) == 0) {
                 echo $xoops->alert('error', _AM_SYSTEM_FILEMANAGER_EXTRACT_ERROR);
             } else {
                 echo $xoops->alert('info', _AM_SYSTEM_FILEMANAGER_EXTRACT_FILE);
             }
             break;
         case 'tar':
         case 'gz':
             PclTarExtract($path_file, $path);
             break;
     }
     break;
     //Confirm delete file
 //Confirm delete file
 case 'filemanager_confirm_delete_file':
     echo '<div class="confirmMsg">' . sprintf(_AM_SYSTEM_FILEMANAGER_SUREDEL, $_REQUEST['file']) . '<br /><br /><div class="buttons"><a href="#" class="ui-corner-all" onclick="filemanager_delete_file(\'' . $_REQUEST['path_file'] . '\', \'' . $_REQUEST['path'] . '\');">' . _AM_SYSTEM_FILEMANAGER_DELETE . '</a>&nbsp;&nbsp;<a href="#" class="ui-corner-all" onclick="$(\'#confirm_delete\').hide();filemanager_load_tree(); filemanager_display_file(\'\', 0)">' . _AM_SYSTEM_FILEMANAGER_CANCEL . '</a></div></div>';
     break;
     //Delete one file
 //Delete one file
 case 'filemanager_delete_file':
     $file = XoopsFile::getHandler('file', $_REQUEST['path_file']);
     if (!$file->delete()) {
         echo $xoops->alert('error', _AM_SYSTEM_FILEMANAGER_ERROR);
     } else {
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:jquery.php

示例4: pluginProcessUpload

 function pluginProcessUpload()
 {
     if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
         exit;
     }
     $fl = e107::getFile();
     $data = $fl->getUploaded(e_TEMP);
     $mes = e107::getMessage();
     if (empty($data[0]['error'])) {
         if ($fl->unzipArchive($data[0]['name'], 'plugin')) {
             $mes->addSuccess(EPL_ADLAN_43);
         } else {
             $mes->addError(EPL_ADLAN_97);
         }
     }
     //	$data = process_uploaded_files(e_TEMP);
     //	print_a($data);
     echo $mes->render();
     return;
     // ----------------- Everything below is unused.
     extract($_FILES);
     /* check if e_PLUGIN dir is writable ... */
     if (!is_writable(e_PLUGIN)) {
         // still not writable - spawn error message
         e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
     } else {
         // e_PLUGIN is writable
         require_once e_HANDLER . "upload_handler.php";
         $fileName = $file_userfile['name'][0];
         $fileSize = $file_userfile['size'][0];
         $fileType = $file_userfile['type'][0];
         if (strstr($file_userfile['type'][0], "gzip")) {
             $fileType = "tar";
         } else {
             if (strstr($file_userfile['type'][0], "zip")) {
                 $fileType = "zip";
             } else {
                 // not zip or tar - spawn error message
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
                 return false;
             }
         }
         if ($fileSize) {
             $uploaded = file_upload(e_PLUGIN);
             $archiveName = $uploaded[0]['name'];
             // attempt to unarchive
             if ($fileType == "zip") {
                 require_once e_HANDLER . "pclzip.lib.php";
                 $archive = new PclZip(e_PLUGIN . $archiveName);
                 $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666);
             } else {
                 require_once e_HANDLER . "pcltar.lib.php";
                 $unarc = $fileList = PclTarExtract($archiveName, e_PLUGIN);
             }
             if (!$unarc) {
                 // unarc failed ...
                 if ($fileType == "zip") {
                     $error = EPL_ADLAN_46 . " '" . $archive->errorName(TRUE) . "'";
                 } else {
                     $error = EPL_ADLAN_47 . PclErrorString() . ", " . EPL_ADLAN_48 . intval(PclErrorCode());
                 }
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42 . " " . $archiveName . " " . $error);
                 require_once "footer.php";
                 exit;
             }
             // ok it looks like the unarc succeeded - continue */
             // get folder name ...
             $folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
             if (file_exists(e_PLUGIN . $folderName . "/plugin.php") || file_exists(e_PLUGIN . $folderName . "/plugin.xml")) {
                 /* upload is a plugin */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
             } elseif (file_exists(e_PLUGIN . $folderName . "/theme.php") || file_exists(e_PLUGIN . $folderName . "/theme.xml")) {
                 /* upload is a menu */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
             } else {
                 /* upload is unlocatable */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_98 . ' ' . $fileList[0]['stored_filename']);
             }
             /* attempt to delete uploaded archive */
             @unlink(e_PLUGIN . $archiveName);
         }
     }
 }
开发者ID:KonzolozZ,项目名称:e107,代码行数:83,代码来源:plugin.php

示例5: unpack_gz

function unpack_gz($f, $d)
{
    $p = 'plug/tar/pcl';
    include_once $p . 'tar.lib.php';
    include_once $p . 'error.lib.php';
    include_once $p . 'trace.lib.php';
    PclTarExtract($f, $d, '', '');
}
开发者ID:philum,项目名称:cms,代码行数:8,代码来源:lib.php

示例6: pluginProcessUpload

 function pluginProcessUpload()
 {
     if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
         exit;
     }
     extract($_FILES);
     /* check if e_PLUGIN dir is writable ... */
     if (!is_writable(e_PLUGIN)) {
         /* still not writable - spawn error message */
         e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
     } else {
         /* e_PLUGIN is writable - continue */
         require_once e_HANDLER . "upload_handler.php";
         $fileName = $file_userfile['name'][0];
         $fileSize = $file_userfile['size'][0];
         $fileType = $file_userfile['type'][0];
         if (strstr($file_userfile['type'][0], "gzip")) {
             $fileType = "tar";
         } else {
             if (strstr($file_userfile['type'][0], "zip")) {
                 $fileType = "zip";
             } else {
                 /* not zip or tar - spawn error message */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
                 require_once "footer.php";
                 exit;
             }
         }
         if ($fileSize) {
             $uploaded = file_upload(e_PLUGIN);
             $archiveName = $uploaded[0]['name'];
             /* attempt to unarchive ... */
             if ($fileType == "zip") {
                 require_once e_HANDLER . "pclzip.lib.php";
                 $archive = new PclZip(e_PLUGIN . $archiveName);
                 $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666);
             } else {
                 require_once e_HANDLER . "pcltar.lib.php";
                 $unarc = $fileList = PclTarExtract($archiveName, e_PLUGIN);
             }
             if (!$unarc) {
                 /* unarc failed ... */
                 if ($fileType == "zip") {
                     $error = EPL_ADLAN_46 . " '" . $archive->errorName(TRUE) . "'";
                 } else {
                     $error = EPL_ADLAN_47 . PclErrorString() . ", " . EPL_ADLAN_48 . intval(PclErrorCode());
                 }
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_42 . " " . $archiveName . " " . $error);
                 require_once "footer.php";
                 exit;
             }
             /* ok it looks like the unarc succeeded - continue */
             /* get folder name ...  */
             $folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
             if (file_exists(e_PLUGIN . $folderName . "/plugin.php") || file_exists(e_PLUGIN . $folderName . "/plugin.xml")) {
                 /* upload is a plugin */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
             } elseif (file_exists(e_PLUGIN . $folderName . "/theme.php") || file_exists(e_PLUGIN . $folderName . "/theme.xml")) {
                 /* upload is a menu */
                 e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
             } else {
                 /* upload is unlocatable */
                 e107::getRender()->tablerender(EPL_ADLAN_40, 'Unknown file: ' . $fileList[0]['stored_filename']);
             }
             /* attempt to delete uploaded archive */
             @unlink(e_PLUGIN . $archiveName);
         }
     }
 }
开发者ID:notzen,项目名称:e107,代码行数:69,代码来源:plugin.php

示例7: COUNT

 $dir = '../templates/';
 if (!is_writable($dir)) {
     $is_writable = @chmod($dir, 0777) ? true : false;
 }
 @clearstatcache();
 $error = '';
 if (is_writable($dir)) {
     $check_theme = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_THEMES . " WHERE theme = '" . strprotect($_FILES['upload_theme']['name']) . "'", __LINE__, __FILE__);
     if (empty($check_theme) && !is_dir('../templates/' . $_FILES['upload_theme']['name'])) {
         import('io/upload');
         $Upload = new Upload($dir);
         if ($Upload->file('upload_theme', '`([a-z0-9()_-])+\\.(gzip|zip)+$`i')) {
             $archive_path = '../templates/' . $Upload->filename['upload_theme'];
             if ($Upload->extension['upload_theme'] == 'gzip') {
                 import('lib/pcl/pcltar', LIB_IMPORT);
                 if (!($zip_files = PclTarExtract($Upload->filename['upload_theme'], '../templates/'))) {
                     $error = $Upload->error;
                 }
             } elseif ($Upload->extension['upload_theme'] == 'zip') {
                 import('lib/pcl/pclzip', LIB_IMPORT);
                 $Zip = new PclZip($archive_path);
                 if (!($zip_files = $Zip->extract(PCLZIP_OPT_PATH, '../templates/', PCLZIP_OPT_SET_CHMOD, 0666))) {
                     $error = $Upload->error;
                 }
             } else {
                 $error = 'e_upload_invalid_format';
             }
             if (!@unlink($archive_path)) {
                 $error = 'e_unlink_disabled';
             }
         } else {
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:admin_themes_add.php

示例8: upload_module

 private function upload_module()
 {
     $modules_folder = PATH_TO_ROOT . '/';
     if (!is_writable($modules_folder)) {
         $is_writable = @chmod($dir, 0755);
     } else {
         $is_writable = true;
     }
     if ($is_writable) {
         $uploaded_file = $this->form->get_value('file');
         if ($uploaded_file !== null) {
             $upload = new Upload($modules_folder);
             if ($upload->file('upload_module_file', '`([a-z0-9()_-])+\\.(gz|zip)+$`i')) {
                 $archive = $modules_folder . $upload->get_filename();
                 if ($upload->get_extension() == 'gz') {
                     include_once PATH_TO_ROOT . '/kernel/lib/php/pcl/pcltar.lib.php';
                     $archive_content = PclTarList($upload->get_filename());
                 } else {
                     include_once PATH_TO_ROOT . '/kernel/lib/php/pcl/pclzip.lib.php';
                     $zip = new PclZip($archive);
                     $archive_content = $zip->listContent();
                 }
                 $archive_root_content = array();
                 $required_files = array('/config.ini', '/index.php');
                 foreach ($archive_content as $element) {
                     if (substr($element['filename'], -1) == '/') {
                         $element['filename'] = substr($element['filename'], 0, -1);
                     }
                     if (substr_count($element['filename'], '/') == 0) {
                         $archive_root_content[] = array('filename' => $element['filename'], 'folder' => isset($element['folder']) && $element['folder'] == 1 || isset($element['typeflag']) && $element['typeflag'] == 5);
                     }
                     if (isset($archive_root_content[0])) {
                         $name_in_archive = str_replace($archive_root_content[0]['filename'] . '/', '/', $element['filename']);
                         if (in_array($name_in_archive, $required_files)) {
                             unset($required_files[array_search($name_in_archive, $required_files)]);
                         }
                     }
                 }
                 if (count($archive_root_content) == 1 && $archive_root_content[0]['folder'] && empty($required_files)) {
                     $module_id = $archive_root_content[0]['filename'];
                     if (!ModulesManager::is_module_installed($module_id)) {
                         if ($upload->get_extension() == 'gz') {
                             PclTarExtract($upload->get_filename(), $modules_folder);
                         } else {
                             $zip->extract(PCLZIP_OPT_PATH, $modules_folder, PCLZIP_OPT_SET_CHMOD, 0755);
                         }
                         $this->install_module($module_id, true);
                     } else {
                         $this->view->put('MSG', MessageHelper::display(LangLoader::get_message('element.already_exists', 'status-messages-common'), MessageHelper::NOTICE));
                     }
                 } else {
                     $this->view->put('MSG', MessageHelper::display(LangLoader::get_message('error.invalid_archive_content', 'status-messages-common'), MessageHelper::NOTICE));
                 }
                 $uploaded_file = new File($archive);
                 $uploaded_file->delete();
             } else {
                 $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_invalid_format'], MessageHelper::NOTICE));
             }
         } else {
             $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_error'], MessageHelper::NOTICE));
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:63,代码来源:AdminModuleAddController.class.php

示例9: ProcessUploadedHAR

function ProcessUploadedHAR($testPath)
{
    require_once './lib/pcltar.lib.php3';
    require_once './lib/pclerror.lib.php3';
    require_once './lib/pcltrace.lib.php3';
    global $done;
    global $flattenUploadedZippedHar;
    // From the mobile agents we get the zip file with sub-folders
    if (isset($_FILES['file'])) {
        //var_dump($_FILES['file']);
        logMsg(" Extracting uploaded file '{$_FILES['file']['tmp_name']}' to '{$testPath}'\n");
        if ($_FILES['file']['type'] == "application/tar" || preg_match("/\\.tar\$/", $_FILES['file']['name'])) {
            PclTarExtract($_FILES['file']['tmp_name'], "{$testPath}", "/", "tar");
        } else {
            if (preg_match("/\\.zip\$/", $_FILES['file']['name'])) {
                $archive = new PclZip($_FILES['file']['tmp_name']);
                if ($flattenUploadedZippedHar) {
                    // PCLZIP_OPT_REMOVE_ALL_PATH causes any directory structure
                    // within the zip to be flattened.  Different agents have
                    // slightly different directory layout, but all file names
                    // are guaranteed to be unique.  Flattening allows us to avoid
                    // directory traversal.
                    // TODO(skerner): Find out why the blaze agents have different
                    // directory structure and make it consistent, and remove
                    // $flattenUploadedZippedHar as an option.
                    $archive->extract(PCLZIP_OPT_PATH, "{$testPath}/", PCLZIP_OPT_REMOVE_ALL_PATH);
                } else {
                    logMalformedInput("Depricated har upload path.  Agents should " . "set flattenZippedHar=1.");
                    $archive->extract(PCLZIP_OPT_PATH, "{$testPath}/");
                }
            } else {
                move_uploaded_file($_FILES['file']['tmp_name'], $testPath . "/" . $_FILES['file']['name']);
            }
        }
    }
    // The HAR may hold multiple page loads.
    $harIsFromSinglePageLoad = false;
    ProcessHARText($testPath, $harIsFromSinglePageLoad);
}
开发者ID:ceeaspb,项目名称:webpagetest,代码行数:39,代码来源:workdone.php

示例10: inject_typos

function inject_typos($v)
{
    $dr = 'plug/tar/';
    include $dr . 'pclerror.lib.php';
    include $dr . 'pcltrace.lib.php';
    include $dr . 'pcltar.lib.php';
    PclTarExtract($v, 'fonts', '', '');
    return lka($v) . ' installed' . br();
}
开发者ID:philum,项目名称:cms,代码行数:9,代码来源:admin.php

示例11: position

	    	                 $rejected = true;
	    	                 $rej_reason = $lang['plugins-rejmultpath'];
	    	                 break;
	    	             }
	    	             # TODO: This should be a regex to make sure the file is in the right position (<pluginname>/<pluginname>.yaml)
	    	             if (strpos($value,$u_plugin_name.'.yaml')!==false){
	    	                 $yaml_index = $key;
	    	             }
	    	         }
	    	         # TODO: We should extract the yaml file if it exists and validate it.
	    	         if ($yaml_index===false){
	    	             $rejected = true;
	    	             $rej_reason = $lang['plugins-rejmetadata'];
	    	         }
	    	         if (!$rejected){
	    	             if (!(is_array(PclTarExtract($tmp_file, '../../plugins/')))){
	    	             	#TODO: If the new plugin is already activated we should update the DB with the new yaml info.
	    	                $rejected = true;
	    	             	$rej_reason = $lang['plugins-rejarchprob'].' '.PclErrorString(PclErrorCode());
	    	             	
	    	             }
	    	         }   	         
	    	     }
	    	 }
	    	 else {
	    	     $rejected = true;
	    	     $rej_reason = $lang['plugins-rejfileprob'];
	    	 }	 
	    }
	}
	else {
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:team_plugins.php

示例12: maj_tar

function maj_tar($d)
{
    calltar();
    $f = maj_server() . '/' . $d;
    $t = read_file($f);
    write_file($d, $t);
    PclTarExtract($d, '/', '', '');
}
开发者ID:philum,项目名称:cms,代码行数:8,代码来源:distribution.php

示例13: COUNT

 $dir = '../lang/';
 if (!is_writable($dir)) {
     $is_writable = @chmod($dir, 0777) ? true : false;
 }
 @clearstatcache();
 $error = '';
 if (is_writable($dir)) {
     $check_lang = $Sql->query("SELECT COUNT(*) FROM " . DB_TABLE_LANG . " WHERE lang = '" . strprotect($_FILES['upload_lang']['name']) . "'", __LINE__, __FILE__);
     if (empty($check_lang)) {
         import('io/upload');
         $Upload = new Upload($dir);
         if ($Upload->file('upload_lang', '`([a-z0-9()_-])+\\.(gzip|zip)+$`i')) {
             $archive_path = '../lang/' . $Upload->filename['upload_lang'];
             if ($Upload->extension['upload_lang'] == 'gzip') {
                 import('lib/pcl/pcltar', LIB_IMPORT);
                 if (!($zip_files = PclTarExtract($Upload->filename['upload_lang'], '../lang/'))) {
                     $error = $Upload->error;
                 }
             } elseif ($Upload->extension['upload_lang'] == 'zip') {
                 import('lib/pcl/pclzip', LIB_IMPORT);
                 $Zip = new PclZip($archive_path);
                 if (!($zip_files = $Zip->extract(PCLZIP_OPT_PATH, '../lang/', PCLZIP_OPT_SET_CHMOD, 0666))) {
                     $error = $Upload->error;
                 }
             } else {
                 $error = 'e_upload_invalid_format';
             }
             if (!@unlink($archive_path)) {
                 $error = 'e_unlink_disabled';
             }
         } else {
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:31,代码来源:admin_lang_add.php

示例14: themeUpload

 function themeUpload()
 {
     if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
         exit;
     }
     $mes = e107::getMessage();
     $ns = e107::getRender();
     extract($_FILES);
     if (!is_writable(e_THEME)) {
         //	$ns->tablerender(TPVLAN_16, TPVLAN_20);
         $mes->add(TPVLAN_20, E_MESSAGE_INFO);
         return FALSE;
     } else {
         require_once e_HANDLER . "upload_handler.php";
         $fileName = $file_userfile['name'][0];
         $fileSize = $file_userfile['size'][0];
         $fileType = $file_userfile['type'][0];
         if (strstr($file_userfile['type'][0], "gzip")) {
             $fileType = "tar";
         } else {
             if (strstr($file_userfile['type'][0], "zip")) {
                 $fileType = "zip";
             } else {
                 $mes->add(TPVLAN_17, E_MESSAGE_ERROR);
                 //	$ns->tablerender(TPVLAN_16, TPVLAN_17);
                 //	require_once("footer.php");
                 return FALSE;
             }
         }
         if ($fileSize) {
             $uploaded = file_upload(e_THEME);
             $archiveName = $uploaded[0]['name'];
             if ($fileType == "zip") {
                 require_once e_HANDLER . "pclzip.lib.php";
                 $archive = new PclZip(e_THEME . $archiveName);
                 $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0666);
             } else {
                 require_once e_HANDLER . "pcltar.lib.php";
                 $unarc = $fileList = PclTarExtract($archiveName, e_THEME);
             }
             if (!$unarc) {
                 if ($fileType == "zip") {
                     $error = TPVLAN_46 . " '" . $archive->errorName(TRUE) . "'";
                 } else {
                     $error = TPVLAN_47 . PclErrorString() . ", " . TPVLAN_48 . intval(PclErrorCode());
                 }
                 $mes->add(TPVLAN_18 . " " . $archiveName . " " . $error, E_MESSAGE_ERROR);
                 //	$ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error);
                 return FALSE;
             }
             $folderName = substr($fileList[0]['stored_filename'], 0, strpos($fileList[0]['stored_filename'], "/"));
             $mes->add(TPVLAN_19, E_MESSAGE_SUCCESS);
             if (varset($_POST['setUploadTheme'])) {
                 $themeArray = $this->getThemes();
                 $this->id = $themeArray[$folderName]['id'];
                 $this->setTheme();
             }
             //		$ns->tablerender(TPVLAN_16, "<div class='center'>".TPVLAN_19."</div>");
             @unlink(e_THEME . $archiveName);
         }
     }
 }
开发者ID:notzen,项目名称:e107,代码行数:62,代码来源:theme_handler.php

示例15: upload_module

 private function upload_module()
 {
     $modules_folder = PATH_TO_ROOT . '/';
     if (!is_writable($modules_folder)) {
         $is_writable = @chmod($dir, 0755);
     } else {
         $is_writable = true;
     }
     if ($is_writable) {
         $file = $this->form->get_value('file');
         if ($file !== null) {
             $modules_id = $file->get_name_without_extension();
             if (ModulesManager::is_module_installed($modules_id)) {
                 $upload = new Upload($modules_folder);
                 $upload->disableContentCheck();
                 if ($upload->file('upload_module_file', '`([A-Za-z0-9-_]+)\\.(gz|zip)+$`i', false, 100000000, false)) {
                     $archive_path = $modules_folder . $upload->get_filename();
                     if ($upload->get_extension() == 'gz') {
                         include_once PATH_TO_ROOT . '/kernel/lib/php/pcl/pcltar.lib.php';
                         PclTarExtract($upload->get_filename(), $modules_folder);
                         $file = new File($archive_path);
                         $file->delete();
                     } else {
                         if ($upload->get_extension() == 'zip') {
                             include_once PATH_TO_ROOT . '/kernel/lib/php/pcl/pclzip.lib.php';
                             $zip = new PclZip($archive_path);
                             $zip->extract(PCLZIP_OPT_PATH, $modules_folder, PCLZIP_OPT_SET_CHMOD, 0755);
                             $file = new File($archive_path);
                             $file->delete();
                         } else {
                             $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_invalid_format'], MessageHelper::NOTICE, 4));
                         }
                     }
                     $this->upgrade_module($modules_id);
                 } else {
                     $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_error'], MessageHelper::NOTICE, 4));
                 }
             } else {
                 $this->view->put('MSG', MessageHelper::display($this->lang['modules.not_installed_module'], MessageHelper::NOTICE, 4));
             }
         } else {
             $this->view->put('MSG', MessageHelper::display($this->lang['modules.upload_error'], MessageHelper::NOTICE, 4));
         }
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:45,代码来源:AdminModuleUpdateController.class.php


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