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


PHP tar::addstring方法代码示例

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


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

示例1: processform

 public function processform()
 {
     $html = $this->html;
     switch ($this->name) {
         case 'service':
             return $this->doupdate($_POST);
         case 'backup':
             if (!$this->checkbackuper()) {
                 return $html->h3->erroraccount;
             }
             extract($_POST, EXTR_SKIP);
             $backuper = tbackuper::i();
             if (isset($restore)) {
                 if (!is_uploaded_file($_FILES['filename']['tmp_name'])) {
                     return sprintf($html->h4red->attack, $_FILES["filename"]["name"]);
                 }
                 if (strpos($_FILES['filename']['name'], '.sql')) {
                     $backuper->uploaddump(file_get_contents($_FILES["filename"]["tmp_name"]), $_FILES["filename"]["name"]);
                 } else {
                     $url = litepublisher::$site->url;
                     if (dbversion) {
                         $dbconfig = litepublisher::$options->dbconfig;
                     }
                     $backuper->upload(file_get_contents($_FILES['filename']['tmp_name']), $backuper->getarchtype($_FILES['filename']['name']));
                     if (isset($saveurl)) {
                         $storage = new tdata();
                         $storage->basename = 'storage';
                         $storage->load();
                         $storage->data['site'] = litepublisher::$site->data;
                         if (dbversion) {
                             $data->data['options']['dbconfig'] = $dbconfig;
                         }
                         $storage->save();
                     }
                 }
                 ttheme::clearcache();
                 @header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
                 exit;
             } elseif (isset($downloadpartial)) {
                 $filename = str_replace('.', '-', litepublisher::$domain) . date('-Y-m-d') . $backuper->getfiletype();
                 $content = $backuper->getpartial(isset($plugins), isset($theme), isset($lib));
                 $this->sendfile($content, $filename);
             } elseif (isset($fullbackup)) {
                 $filename = str_replace('.', '-', litepublisher::$domain) . date('-Y-m-d') . $backuper->getfiletype();
                 $content = $backuper->getfull();
                 $this->sendfile($content, '');
             } elseif (isset($sqlbackup)) {
                 $content = $backuper->getdump();
                 $filename = litepublisher::$domain . date('-Y-m-d') . '.sql';
                 switch ($backuper->archtype) {
                     case 'tar':
                         tbackuper::include_tar();
                         $tar = new tar();
                         $tar->addstring($content, $filename, 0644);
                         $content = $this->tar->savetostring(true);
                         $filename .= '.tar.gz';
                         unset($tar);
                         break;
                     case 'zip':
                         tbackuper::include_zip();
                         $zip = new zipfile();
                         $zip->addFile($content, $filename);
                         $content = $zip->file();
                         $filename .= '.zip';
                         unset($zip);
                         break;
                     default:
                         $content = gzencode($content);
                         $filename .= '.gz';
                         break;
                 }
                 $this->sendfile($content, $filename);
             }
             break;
         case 'run':
             $result = eval($_POST['content']);
             return sprintf('<pre>%s</pre>', $result);
         case 'upload':
             $backuper = tbackuper::i();
             if (!$this->checkbackuper()) {
                 return $html->h3->erroraccount;
             }
             if (is_uploaded_file($_FILES['filename']['tmp_name']) && !(isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0)) {
                 $s = file_get_contents($_FILES['filename']['tmp_name']);
                 $archtype = $backuper->getarchtype($_FILES['filename']['name']);
             } else {
                 $url = trim($_POST['url']);
                 if (empty($url)) {
                     return '';
                 }
                 if (!($s = http::get($url))) {
                     return $html->h3->errordownload;
                 }
                 $archtype = $backuper->getarchtype($url);
             }
             if (!$archtype) {
                 //         local file header signature     4 bytes  (0x04034b50)
                 $archtype = strbegin($s, "PK") ? 'zip' : 'tar';
             }
             if ($backuper->uploaditem($s, $archtype)) {
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:litepublisher,代码行数:101,代码来源:admin.service.class.php


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