/** * Create archive using php function and return the path * * @param string $dir target dir * @param array $files files names list * @param string $name archive name * @param array $arc archiver options * @return string|bool */ protected function PhpCompress($dir, $files, $name, $archiver) { include 'Archive.php'; $path = $this->_joinPath($dir, $name); $archive = new Archive($path); //add files foreach ($files as $file) { $add_path = $this->_joinPath($dir, $file); $archive->Add($add_path, $file); } $archive->compress(); return $path; }
public function download($comic, $language = 'en', $volume = 0, $chapter = "", $subchapter = 0, $team = 0, $joint = 0, $pagetext = 'page', $page = 1) { if(!get_setting('fs_dl_enabled')) show_404(); $comice = new Comic(); $comice->where('stub', $comic)->get(); if ($comice->result_count() == 0) { set_notice('warn', 'This comic doesn\'t exist.'); } if ($chapter == "") { redirect('/reader/comic/' . $comic); } $chaptere = new Chapter(); $chaptere->where('comic_id', $comice->id)->where('language', $language)->where('volume', $volume)->where('chapter', $chapter)->order_by('subchapter', 'ASC'); if (!is_int($subchapter) && $subchapter == 'page') { $current_page = $team; } else { $chaptere->where('subchapter', $subchapter); if ($team == 'page') $current_page = $joint; else { if ($team != 0) { $teame = new Team(); $teame->where('stub', $team)->get(); $chaptere->where('team_id', $teame->id); } if ($joint == 'page') $current_page = $pagetext; if ($joint != 0) { $chaptere->where('joint_id', $joint); } } } if (!isset($current_page)) { if ($page != 1) $current_page = $page; else $current_page = 1; } $chaptere->get(); if ($chaptere->result_count() == 0) { show_404(); } $archive = new Archive(); $url = $archive->compress($chaptere); redirect($url); }
public function download($comic, $language = 'en', $volume = null, $chapter = null, $subchapter = 0) { if (!get_setting('fs_dl_enabled')) { show_404(); } $comice = new Comic(); $comice->where('stub', $comic)->get(); if ($comice->result_count() == 0) { set_notice('warn', 'This comic does not exist.'); } $archive = new Archive(); $result = $archive->compress($comice, $language, $volume, $chapter, $subchapter); if ($this->input->is_cli_request()) { echo $result["server_path"] . PHP_EOL; } else { redirect($result["url"]); } }