예제 #1
0
파일: manager.php 프로젝트: bizanto/Hooked
 public function doExport()
 {
     // check for request forgeries
     YRequest::checkToken() or jexit('Invalid Token');
     $group = $this->application->getGroup();
     require_once JPATH_ROOT . '/administrator/includes/pcl/pclzip.lib.php';
     $filepath = JPATH_ROOT . '/tmp/' . $group . '.zip';
     $read_directory = ZOO_APPLICATION_PATH . '/' . $group . '/';
     $zip = new PclZip($filepath);
     $files = YFile::readDirectoryFiles($read_directory, $read_directory, '', '/^[^\\.]/');
     $zip->create($files, PCLZIP_OPT_ADD_PATH, '../', PCLZIP_OPT_REMOVE_PATH, $read_directory);
     if (is_readable($filepath) && JFile::exists($filepath)) {
         YFile::output($filepath);
         if (!JFile::delete($filepath)) {
             JError::raiseNotice(0, JText::_('Unable to delete file') . ' (' . $filepath . ')');
             $this->setRedirect($this->baseurl . '&task=info');
         }
     } else {
         JError::raiseNotice(0, JText::_('Unable to create file') . ' (' . $filepath . ')');
         $this->setRedirect($this->baseurl . '&task=info');
     }
 }
예제 #2
0
파일: download.php 프로젝트: bizanto/Hooked
 public function download($check = '')
 {
     // init vars
     $filepath = JPATH_ROOT . '/' . $this->_data->get('file');
     $download_mode = $this->_config->get('download_mode');
     // check limit
     if ($this->isDownloadLimitReached()) {
         header('Content-Type: text/html');
         echo JText::_('Download limit reached!');
         return;
     }
     // output file
     if ($download_mode == 1 && is_readable($filepath) && is_file($filepath)) {
         $this->_data->set('hits', $this->_data->get('hits', 0) + 1);
         YFile::output($filepath);
     } else {
         if ($download_mode == 2 && $this->filecheck() == $check && is_readable($filepath) && is_file($filepath)) {
             $this->_data->set('hits', $this->_data->get('hits', 0) + 1);
             YFile::output($filepath);
         } else {
             header('Content-Type: text/html');
             echo JText::_('Invalid file!');
         }
     }
     // save item
     YTable::getInstance('item')->save($this->getItem());
 }