Esempio n. 1
0
if (!isset($_GET['download_id']) && !isset($_GET['cat_id'])) {
    add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name"));
}
add_breadcrumb(array('link' => INFUSIONS . 'downloads/downloads.php', 'title' => \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name")));
$result = NULL;
if (isset($_GET['file_id']) && isnum($_GET['file_id'])) {
    $res = 0;
    $data = dbarray(dbquery("SELECT download_url, download_file, download_cat, download_visibility FROM " . DB_DOWNLOADS . " WHERE download_id='" . intval($_GET['file_id']) . "'"));
    if (checkgroup($data['download_visibility'])) {
        $result = dbquery("UPDATE " . DB_DOWNLOADS . " SET download_count=download_count+1 WHERE download_id='" . intval($_GET['file_id']) . "'");
        if (!empty($data['download_file']) && file_exists(DOWNLOADS . 'files/' . $data['download_file'])) {
            $res = 1;
            require_once INCLUDES . "class.httpdownload.php";
            ob_end_clean();
            $object = new httpdownload();
            $object->set_byfile(DOWNLOADS . 'files/' . $data['download_file']);
            $object->use_resume = TRUE;
            $object->download();
            exit;
        } elseif (!empty($data['download_url'])) {
            $res = 1;
            $url_prefix = !strstr($data['download_url'], "http://") && !strstr($data['download_url'], "https://") ? "http://" : "";
            redirect($url_prefix . $data['download_url']);
        }
    }
    if ($res == 0) {
        redirect("downloads.php");
    }
}
$info = array('download_title' => $locale['download_1001'], 'download_language' => LANGUAGE, 'download_categories' => get_downloadCat(), 'allowed_filters' => array('download' => $locale['download_2003'], 'recent' => $locale['download_2002'], 'comments' => $locale['download_2001'], 'ratings' => $locale['download_2004']), 'download_last_updated' => 0, 'download_max_rows' => 0, 'download_rows' => 0, 'download_nav' => '');
/* Filter Construct */
Esempio n. 2
0
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;
}
Esempio n. 3
0
if (!isset($_GET["File"])) {
    print "no file selsect";
    exit;
}
$file = $_GET["File"];
$type = end(explode('.', $file));
if ($_GET['usernameModel'] == 'basename') {
    $fileName = null;
} else {
    $arrstr = explode('/', $file);
    $last = end($arrstr);
    $lastarr = explode('.', $last);
    // 	array_pop($lastarr);
    $fileName = implode('.', $lastarr);
}
include_once "class.httpdownload.php";
$object = new httpdownload();
$result = $object->set_byfile($file);
if ($type == 'ipa') {
    $object->mime = '.ipa application/iphone-package-archive';
} elseif ($type == 'apk') {
    $object->mime = '.apk application/vnd.android.package-archive';
} else {
}
if (!$result) {
    print "下载失败 ";
    exit;
}
$object->filename = $fileName;
$object->download();
ob_end_flush();
Esempio n. 4
0
        } elseif ($size[0] > $size[1]) {
            $img_w = 300;
            $img_h = round($size[1] * 300 / $size[0]);
        } else {
            $img_w = 300;
            $img_h = 200;
        }
    } else {
        $img_w = $size[0];
        $img_h = $size[1];
    }
    if ($size[0] != $img_w || $size[1] != $img_h) {
        $res = "<a href='" . FORUM . "attachments/" . $file . "'><img src='" . FORUM . "attachments/" . $file . "' width='" . $img_w . "' height='" . $img_h . "' style='border:0' /></a>";
    } else {
        $res = "<img src='" . FORUM . "attachments/" . $file . "' width='" . $img_w . "' height='" . $img_h . "' style='border:0' />";
    }
    return $res;
}
if (isset($_GET['getfile']) && isnum($_GET['getfile'])) {
    $result = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . $_GET['getfile'] . "'");
    if (dbrows($result)) {
        require_once INCLUDES . "class.httpdownload.php";
        ob_end_clean();
        $data = dbarray($result);
        $object = new httpdownload();
        $object->set_byfile(FORUM . "attachments/" . $data['attach_name']);
        $object->use_resume = true;
        $object->download();
    }
    exit;
}
Esempio n. 5
0
require_once "../../maincore.php";
require_once THEMES . "templates/header.php";
require_once INCLUDES . "comments_include.php";
require_once INCLUDES . "ratings_include.php";
require_once INFUSIONS . "addondb/infusion_db.php";
require_once INFUSIONS . "addondb/inc/inc.functions.php";
include INFUSIONS . "addondb/locale/" . LOCALESET . "addon_view.php";
if (isset($_GET['download']) && isnum($_GET['download'])) {
    $data = dbarray(dbquery("SELECT * FROM " . DB_ADDON_CATS . " JOIN " . DB_ADDONS . " USING(addon_cat_id) WHERE addon_id='" . $_GET['download'] . "'"));
    if (checkgroup($data['addon_cat_access'])) {
        $result = dbquery("UPDATE " . DB_ADDONS . " SET addon_download_count=(addon_download_count+1) WHERE addon_id='" . $_GET['download'] . "'");
        require_once INCLUDES . "class.httpdownload.php";
        redirect($addon_upload_dir . $data['addon_download']);
        ob_end_clean();
        $object = new httpdownload();
        $object->set_byfile($addon_upload_dir . $data['addon_download']);
        $object->use_resume = true;
        $object->download();
        exit;
    }
}
$addon_id = stripinput($_GET['addon_id']);
$q_addons = dbquery("SELECT * FROM " . DB_ADDON_CATS . " JOIN " . DB_ADDONS . " tm USING(addon_cat_id) JOIN " . DB_ADDON_VERSIONS . " USING(version_id) JOIN " . DB_USERS . " tu ON tm.addon_approved_user=tu.user_id WHERE addon_id='" . $addon_id . "'");
$d_addons = dbarray($q_addons);
if (!isnum($addon_id) || dbrows($q_addons) == 0 || $d_addons['addon_status'] != 0 && !iSUPERADMIN && $d_addons['addon_status'] != 0) {
    opentable($locale['addondb430']);
    echo "<center><br>" . $locale['addondb431'] . "<br><br><a href='index.php'>" . $locale['addondb433'] . "</a><br><br></center>";
    closetable();
} elseif (!checkgroup($d_addons['addon_cat_access'])) {
    opentable($locale['addondb430']);
    echo "<center><br>" . $locale['addondb432'] . "<br><br><a href='index.php'>" . $locale['addondb433'] . "</a><br><br></center>";
Esempio n. 6
0
<?php

/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------*
| Filename: downloads/index.php
| Author: Frederick MC Chan (Hien)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
$request = pathinfo($_SERVER['REQUEST_URI']);
$result = dbquery("SELECT download_file FROM " . DB_DOWNLOADS . " WHERE " . groupaccess('download_visibility') . " AND download_file='" . form_sanitizer($request['basename'], '') . "' ");
if (dbrows($result) > 0) {
    $data = dbarray($result);
    require_once INCLUDES . "class.httpdownload.php";
    $object = new httpdownload();
    $object->set_byfile(DOWNLOADS . "/files/" . $data['download_file']);
    $object->use_resume = true;
    $object->download();
}
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 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;
 }
        }
    } else {
        $downlink = $url;
    }
    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>