function unstripinput($text) { if (QUOTES_GPC) { $text = stripslashes($text); } $search = array("\n", "&", """, "'", "\", """, "'", "<", ">"); $replace = array("\r\n", "&", "\"", "'", "\\", '\\"', "\\'", "<", ">"); $text = str_replace($search, $replace, $text); return $text; } if (isset($_GET['thread_id']) && isnum($_GET['thread_id']) && (isset($_GET['post_id']) && isnum($_GET['post_id'])) && (isset($_GET['code_id']) && isnum($_GET['code_id']))) { $result = dbquery("SELECT fp.*, ff.* FROM " . DB_POSTS . " AS fp\r\n\t\tINNER JOIN " . DB_FORUMS . " AS ff ON ff.forum_id=fp.forum_id\r\n\t\tWHERE fp.thread_id='" . $_GET['thread_id'] . "' AND fp.post_id='" . $_GET['post_id'] . "'"); if (dbrows($result)) { $data = dbarray($result); if (!checkgroup($data['forum_access']) || !$data['forum_cat']) { redirect(BASEDIR . "forum/viewthread.php?thread_id=" . $_GET['thread_id']); } $text = $data['post_message']; preg_match_all("#\\[geshi=(.*?)\\](.*?)\\[/geshi\\]#si", $text, $matches, PREG_PATTERN_ORDER); if (isset($matches[1][$_GET['code_id']]) && isset($matches[2][$_GET['code_id']])) { $ext = strtolower(str_replace("4strict", "", $matches[1][$_GET['code_id']])); $text = unstripinput($matches[2][$_GET['code_id']]); $filename = "geshi_" . $_GET['thread_id'] . "_" . $_GET['post_id'] . "_" . $_GET['code_id'] . "." . $ext; $object = new httpdownload(); $object->set_bydata($text); $object->use_resume = true; $object->set_filename($filename); $object->download(); } } }
function download_file($file) { require_once INCLUDES . "class.httpdownload.php"; ob_end_clean(); $object = new httpdownload(); $object->set_byfile($file); $object->use_resume = true; $object->download(); exit; }
public function FileDownload($id = null) { include_once Openbiz::$app->getModulePath() . '/attachment/lib/class.httpdownload.php'; if ($id == null || $id == '') { $id = Openbiz::$app->getClientProxy()->getFormInputs('_selectedId'); } if (!$id) { $id = $this->recordId; } $dataRec = $this->getDataObj()->fetchById($id); $file_source = $dataRec['path']; $file_name = $dataRec['filename']; $object = new httpdownload(); $object->filename = $file_name; $object->set_byfile($file_source); //Download from a file $object->mime = $type; $object->use_resume = true; //Enable Resume Mode $object->download(); //Download File exit; }
public function FileDownload($id = null) { include_once Openbiz::$app->getModulePath() . '/attachment/lib/class.httpdownload.php'; if ($id == null || $id == '') { $id = Openbiz::$app->getClientProxy()->getFormInputs('_selectedId'); } if (!$id) { $id = $this->recordId; } $dataRec = $this->getDataObj()->fetchById($id); $file_source = $dataRec['path']; $file_name = $dataRec['filename']; $dataRec['download_count'] = (int) $dataRec['download_count'] + 1; $this->getDataObj()->updateRecord($dataRec); $logRec = array("user_id" => Openbiz::$app->getUserProfile("Id"), "attachment_id" => $id, "timestamp" => date('Y-m-d H:i:s')); Openbiz::getObject("attachment.do.AttachmentDownloadLogDO")->insertRecord($logRec); $object = new httpdownload(); $object->filename = $file_name; $object->set_byfile($file_source); //Download from a file $object->mime = $type; $object->use_resume = true; //Enable Resume Mode $object->download(); //Download File exit; }
dbquery("UPDATE " . DB_PDP_DOWNLOADS . "\n\t\tSET\n\t\tdl_count=dl_count+1\n\t\tWHERE download_id='" . $download->id . "'"); dbquery("UPDATE " . DB_PDP_FILES . "\n\t\tSET\n\t\tdownload_count=download_count+1\n\t\tWHERE file_id='" . $file['file_id'] . "'\n\t\t\tAND download_id='" . $download->id . "'"); if (empty($filename)) { fallback($downlink); } else { error_reporting(0); require_once INCLUDES . 'class.httpdownload.php'; // @ini_set('zlib.output_compression', 'Off'); while (@ob_end_clean()) { } $object = new httpdownload(); if (!$object->set_byfile($downlink)) { fallback('error.php?type=missing_file'); } $object->use_resume = true; if (!$object->download()) { die('FIXME:F**K!'); } exit; } // show license } else { opentable($pdp->settings['title']); echo ' <div align="text-align:center;"> <p> <a href="download.php?did=' . $download->id . '">' . $locale['PDP026'] . '</a> </p> </div>'; // get from database if ($download->data['license_id']) {