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();
        }
    }
}
Пример #2
0
                         $row[$i] = str_replace($search_array, $replace_array, $row[$i]);
                         $dump .= "'{$row[$i]}'";
                     }
                 } else {
                     $dump .= "''";
                 }
             }
             $dump .= ");";
             echo $dump . $crlf;
         }
     }
     $contents = ob_get_contents();
     ob_end_clean();
     $file = stripinput($_POST['backup_filename']) . ".sql";
     require_once INCLUDES . "class.httpdownload.php";
     $object = new httpdownload();
     $object->use_resume = false;
     if ($_POST['backup_type'] == ".gz") {
         $object->use_resume = false;
         $object->set_mime("application/x-gzip gz tgz");
         $object->set_bydata(gzencode($contents, 9));
         $object->set_filename($file . ".gz");
     } else {
         $object->use_resume = false;
         $object->set_mime("text/plain");
         $object->set_bydata($contents);
         $object->set_filename($file);
     }
     $object->download();
     exit;
 }
Пример #3
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;
}
Пример #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;
}
Пример #5
0
$dl_settings = get_settings("downloads");
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' => '');
Пример #6
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();
Пример #7
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']);
Пример #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'];
     $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;
 }
Пример #9
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;
 }
            $filename = pdp_cleanup_filename($url);
        }
    } 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>