function dodownloadfile() { $filename = $this->get[2]; $filename = str_replace('*', '.', $filename); $filedir = HDWIKI_ROOT . "/data/db_backup/" . $filename; file::downloadfile($filedir); }
function dodownload() { if (!isset($this->get[2]) || !is_numeric($this->get[2])) { $this->message($this->view->lang['parameterError'], 'BACK'); } $result = $_ENV['attachment']->get_attachment('id', $this->get[2], 0); if (!(bool) ($attachment = $result[0])) { $this->message($this->view->lang['attachIsNotExist'], 'BACK'); } if ($this->user['uid'] != $attachment['uid']) { // 判断金币 $credit1 = $this->user['credit1']; // 拥有金币数 $coindown = $attachment['coindown']; // 下载此附件需要消耗金币数 if (0 > $credit1 - $coindown) { // 金币不足 $this->message($this->view->lang['goldNotEnough'], "index.php?doc-view-" . $attachment['did'], 0); } // 扣除金币 $_ENV['user']->add_credit($this->user['uid'], 'attachment-down', 0, -$coindown); // 增加金币 $_ENV['user']->add_credit($attachment['uid'], 'attachment-down', 0, $coindown); } $_ENV['attachment']->update_downloads($attachment['id']); file::downloadfile($attachment['attachment'], $attachment['filename']); }
function dodownload() { if (!isset($this->get[2]) || !is_numeric($this->get[2])) { $this->message($this->view->lang['parameterError'], 'BACK'); } $result = $_ENV['attachment']->get_attachment('id', $this->get[2], $this->get[3]); if (!(bool) ($attachment = $result[0])) { $this->message($this->view->lang['attachIsNotExist'], 'BACK'); } $_ENV['attachment']->update_downloads($attachment['id']); file::downloadfile($attachment['attachment'], $attachment['filename']); }