コード例 #1
0
ファイル: ffile__commonlib.php プロジェクト: soar-team/kloxo
 function zipExtract()
 {
     $extractdir = coreFfile::getRealPath($this->main->zip_extract_dir_f);
     $fulzippath = "{$this->main->root}/{$extractdir}";
     $zipd = trim($this->main->zip_extract_dir_f);
     $zipd = trim($this->main->zip_extract_dir_f, "/");
     if (!$zipd) {
         throw new lxexception('cannot_unzip_in_root', '', '');
     }
     if (lxfile_exists($fulzippath) && $this->main->__username_o === 'root') {
         throw new lxexception("root_cannot_extract_to_existing_dir", 'unzippath', $this->main->zip_extract_dir_f);
     }
     lxfile_mkdir($fulzippath);
     lxfile_unix_chown($fulzippath, $this->main->__username_o);
     $dir = expand_real_root($fulzippath);
     $file = expand_real_root($this->main->getFullPath());
     if ($file[0] !== '/') {
         $fullpath = getcwd() . "/{$file}";
     } else {
         $fullpath = $file;
     }
     $fullpath = expand_real_root($fullpath);
     if ($this->main->ttype === "zip") {
         $cmd = "/usr/bin/unzip -oq {$fullpath}";
     } else {
         $cmd = "/bin/tar -xzf {$fullpath}";
     }
     new_process_cmd($this->main->__username_o, $dir, $cmd);
     return $dir;
 }
コード例 #2
0
ファイル: ffilelib.php プロジェクト: lonelywoolf/hypervm
 function setFileType()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->base = basename($this->nname);
     $this->fullpath = $this->getFullPath();
     $sel_append = NULL;
     if (isset($gbl->c_session->ssession_vars["frm_clip_action"]) && $gbl->c_session->ssession_vars['frm_clip_root'] == $this->root && $gbl->c_session->ssession_vars['frm_clip_server'] === $this->syncserver) {
         $selaction = $gbl->c_session->ssession_vars["frm_clip_action"];
         $sellist = $gbl->c_session->ssession_vars["frm_clip_list"];
         if (array_search_bool($this->nname, $sellist)) {
             $sel_append = "_" . $selaction;
         }
     }
     if ($this->base === "..") {
         $this->ttype = "back";
         return;
     }
     if ($this->base === ".trash") {
         $this->ttype = "trash";
         $this->protect = "na";
         return;
     }
     if ($this->isInsideTrash()) {
         $this->protect = "na";
     }
     /*
     	if ($this->is_link()) {
     		$this->ttype = "link";
     		return;
     	}
     */
     $this->ttype = "{$this->ttype}{$sel_append}";
     if ($this->is_dir()) {
         if ($this->getParentO()->is__table('web')) {
             if (strpos(dirname($this->nname), '/') === false || dirname($this->nname) === '/') {
                 if ($this->base != "www") {
                     $this->protect = "na";
                 }
             }
             if (!isset($this->protect)) {
                 try {
                     $protname = $this->getParentO()->nname . "_" . coreFfile::getRealPath($this->nname);
                     $prot = $this->getParentO()->getFromList("dirprotect", $protname);
                     if ($prot->status != 'nonexistant') {
                         $this->protect = "on";
                     } else {
                         $this->protect = 'off';
                     }
                 } catch (exception $e) {
                     $this->protect = "off";
                 }
             }
         }
         return;
     }
     $this->protect = "na";
 }