/**
  * Use this function instead of insert_location so that we can improve this feature in the future
  * 
  * @param string $link The download link of the file
  * @param string $FileName The name of the file
  * @param string $cookie The cookie value
  * @param array $post The post value will be serialized here
  * @param string $referer The page that refered to this link
  * @param string $auth In format username:password
  * @param array $params This parameter allows you to add extra _GET values to be passed on
  */
 public function RedirectDownload($link, $FileName, $cookie = 0, $post = 0, $referer = 0, $force_name = 0, $auth = "", $params = array())
 {
     global $pauth;
     if (!$referer) {
         global $Referer;
         $referer = $Referer;
     }
     $Url = parse_url($link);
     //if (substr($auth,0,6) != "&auth=") $auth = "&auth=" . $auth;
     if (!is_array($params)) {
         // Some problems with the plugin, quit it
         html_error('Plugin problem! Please report, error: "The parameter passed must be an array"');
     }
     $addon = "";
     if (count((array) $params) > 0) {
         foreach ($params as $name => $value) {
             if (is_array($value)) {
                 $value = serialize($value);
             }
             $addon .= '&' . $name . '=' . urlencode($value) . '&';
         }
         $addon = substr($addon, 0, -1);
     }
     $loc = "{$_SERVER['PHP_SELF']}?filename=" . urlencode($FileName) . "&host=" . $Url["host"] . "&port=" . $Url["port"] . "&path=" . urlencode($Url["path"] . ($Url["query"] ? "?" . $Url["query"] : "")) . "&referer=" . urlencode($referer) . "&email=" . ($_GET["domail"] ? $_GET["email"] : "") . "&partSize=" . ($_GET["split"] ? $_GET["partSize"] : "") . "&method=" . $_GET["method"] . "&proxy=" . ($_GET["useproxy"] ? $_GET["proxy"] : "") . "&saveto=" . $_GET["path"] . "&link=" . urlencode($link) . ($_GET["add_comment"] == "on" ? "&comment=" . urlencode($_GET["comment"]) : "") . ($auth ? '&auth=' . ($auth == 1 ? 1 : urlencode($auth)) : "") . ($pauth ? "&pauth={$pauth}" : "") . ($_GET["uploadlater"] ? "&uploadlater=" . $_GET["uploadlater"] . "&uploadtohost=" . $_GET['uploadtohost'] : "") . "&cookie=" . ($cookie ? urlencode(encrypt($cookie)) : 0) . "&post=" . urlencode(serialize($post)) . ($_POST["uploadlater"] ? "&uploadlater=" . $_POST["uploadlater"] . "&uploadtohost=" . urlencode($_POST['uploadtohost']) : "") . ($_POST['autoclose'] ? "&autoclose=1" : "") . (isset($_GET["audl"]) ? "&audl=doum" : "") . $addon;
     if ($force_name) {
         $loc = $loc . "&force_name=" . urlencode($force_name);
     }
     insert_location($loc);
 }
Esempio n. 2
0
 public function Download($link)
 {
     if (!preg_match('@/video(?:embed)?/(\\d+)@i', $link, $xid)) {
         html_error('Video ID not found.');
     }
     $this->xid = $xid[1];
     $this->link = 'http://ok.ru/video/' . $this->xid;
     $page = $this->GetPage($this->link);
     is_present($page, "Video has not been found", 'Video not found or it was deleted.');
     $json = cut_str($page, 'data-options="', '"');
     if (empty($json)) {
         html_error('Video Data not Found.');
     }
     $json = $this->json2array(html_entity_decode(str_replace('\\\\u0026', '&', $json), ENT_QUOTES, 'UTF-8'), 'Error Parsing Video Data.');
     if (!empty($json['flashvars']['metadata']) && !is_array($json['flashvars']['metadata'])) {
         $json['flashvars']['metadata'] = $this->json2array($json['flashvars']['metadata'], 'Error Parsing Video Metadata.');
     } else {
         if (empty($json['flashvars']['metadata'])) {
             html_error('Video Metadata Not Found');
         }
     }
     $json = $json['flashvars']['metadata'];
     if (empty($json['movie']['title'])) {
         html_error('Video Title Not Found');
     }
     $this->streams = array();
     foreach ($json['videos'] as $video) {
         if (array_key_exists($video['name'], $this->formats) && !empty($video['url'])) {
             $this->streams[$video['name']] = $video['url'];
         }
     }
     if (empty($this->streams)) {
         html_error('Non Aceptable Video Streams Found.');
     }
     // I did see a couple of videos that links to youtube, i will add code to send them to the youtube plugin.
     if (count($json['videos']) == 1 && empty($json['movie']['collageInfo'])) {
         // Looks Like A Video for a External Site.
         $extLink = $this->streams[key($this->streams)];
         if (preg_match('@youtube\\.com/(?:v|embed)/([\\w\\-\\.]{11})@i', $extLink, $YT)) {
             // It's a  YT link, send it to the youtube plugin.
             insert_location($this->DefaultParamArr('https://www.youtube.com/watch?v=' . $YT[1]));
             exit;
         }
         html_error('This video doesn\'t seems to be hosted on ok.ru, link: ' . htmlspecialchars($extLink));
     }
     if (empty($_POST['dlstream']) && !isset($_GET['audl'])) {
         return $this->QSelector();
     } elseif (empty($_POST['dlstream']) || !empty($this->streams[$_POST['dlstream']])) {
         $key = empty($_POST['dlstream']) ? key($this->streams) : $_POST['dlstream'];
         $DL = $this->streams[$key];
     } else {
         html_error('Selected video stream was not found.');
     }
     $filename = preg_replace('@[^ A-Za-z_\\-\\d\\.,\\(\\)\\[\\]\\{\\}&\\!\'\\@\\%\\#]@u', '_', html_entity_decode(trim($json['movie']['title']), ENT_QUOTES, 'UTF-8'));
     $filename .= " [OK-{$this->formats[$key]}p][{$this->xid}].mp4";
     $this->RedirectDownload($DL, $filename, 0, 0, 0, $filename);
 }
$post = array();
$post["referer2"] = "";
$post["download"] = 1;
$post["imageField.x"] = rand(1, 140);
$post["imageField.y"] = rand(1, 20);
$page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), $Referer, 0, $post, 0, $_GET["proxy"], $pauth);
is_page($page);
$enclink = cut_str($page, "link_enc=new Array('", "')");
$linkdown = preg_replace('/[,\']/i', '', $enclink);
if ($linkdown) {
    $Url = parse_url($linkdown);
} else {
    html_error("Link not found", 0);
}
insert_timer("60");
/*
		$page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), $Referer, 0, $post, 0, $_GET["proxy"],$pauth);
		is_page($page);

		if (preg_match('/Array\((.+)\);link/', $page, $jsaray)) {
			$linkenc = $jsaray[1];
			$zsharelink = preg_replace('/\'[, ]?[ ,]?/six', '', $linkenc);
			$Url = parse_url($zsharelink);
		}elseif(preg_match('/<param name="URL" value="(.+)?">/', $page, $audio)){
			$zsharelink =$audio[1]
			$Url = parse_url($zsharelink);
		}
*/
$FileName = basename($Url["path"]);
insert_location("{$PHP_SELF}?filename=" . urlencode($FileName) . "&host=" . $Url["host"] . "&path=" . urlencode($Url["path"] . ($Url["query"] ? "?" . $Url["query"] : "")) . "&referer=" . urlencode($Referer) . "&cookie=" . urlencode($cookie) . "&email=" . ($_GET["domail"] ? $_GET["email"] : "") . "&partSize=" . ($_GET["split"] ? $_GET["partSize"] : "") . "&method=" . $_GET["method"] . "&proxy=" . ($_GET["useproxy"] ? $_GET["proxy"] : "") . "&saveto=" . $_GET["path"] . "&link=" . urlencode($LINK) . ($_GET["add_comment"] == "on" ? "&comment=" . urlencode($_GET["comment"]) : "") . ($pauth ? "&pauth={$pauth}" : "") . (isset($_GET["audl"]) ? "&audl=doum" : ""));
// Update by kaox 12/09/2009
Esempio n. 4
0
     $redir = GetDefaultParams();
     $redir['filename'] = urlencode($FileName);
     $redir['host'] = urlencode($Url['host']);
     if (!empty($Url['port'])) {
         $redir['port'] = urlencode($Url['port']);
     }
     $redir['path'] = urlencode($Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''));
     $redir['referer'] = urlencode($Referer);
     $redir['link'] = urlencode($LINK);
     if (!empty($_GET['cookie'])) {
         $redir['cookie'] = urlencode(encrypt($_GET['cookie']));
     }
     if (!empty($auth)) {
         $redir['auth'] = $auth;
     }
     insert_location($redir);
 }
 echo "<script type='text/javascript'>updateStatus({$i}, '" . lang(25) . "');</script>{$nn}";
 $_GET['saveto'] = $options['download_dir_is_changeable'] ? urldecode(trim($_GET['saveto'])) : substr($options['download_dir'], 0, 6) != 'ftp://' ? realpath(DOWNLOAD_DIR) : $options['download_dir'];
 $_GET['proxy'] = !empty($_GET['proxy']) ? trim(urldecode($_GET['proxy'])) : '';
 $pauth = empty($_GET['proxy']) || empty($_GET['pauth']) ? '' : urldecode(trim($_GET['pauth']));
 do {
     $_GET['filename'] = urldecode(trim($_GET['filename']));
     if (strpos($_GET['filename'], '?') !== false) {
         $_GET['filename'] = substr($_GET['filename'], 0, strpos($_GET['filename'], '?'));
     }
     $_GET['host'] = urldecode(trim($_GET['host']));
     $_GET['path'] = urldecode(trim($_GET['path']));
     $_GET['port'] = !empty($_GET['port']) ? urldecode(trim($_GET['port'])) : 0;
     $_GET['referer'] = !empty($_GET['referer']) ? urldecode(trim($_GET['referer'])) : 0;
     $_GET['link'] = urldecode(trim($_GET['link']));
<?php

if (!defined('RAPIDLEECH')) {
    require_once "index.html";
    exit;
}
$page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), $Referer, 0, 0, 0, $_GET["proxy"], $pauth);
is_page($page);
$cookie = GetCookies($page);
$wait = cut_str($page, 'var waitTime=', ';');
$dwn = cut_str($page, "var dlLink=unescape('", "'");
insert_timer(10);
$Url = parse_url(urldecode($dwn));
$page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), $Referer, $cookie, 0, 0, $_GET["proxy"], $pauth);
is_page($page);
$locat = cut_str($page, "Location: ", "\r");
$FileName = basename($locat);
$Url = parse_url($locat);
$loc = "{$PHP_SELF}?filename=" . urlencode($FileName) . "&force_name=" . urlencode($FileName) . "&host=" . $Url["host"] . "&port=" . $Url["port"] . "&path=" . urlencode($Url["path"] . ($Url["query"] ? "?" . $Url["query"] : "")) . "&referer=" . urlencode($Referer) . "&email=" . ($_GET["domail"] ? $_GET["email"] : "") . "&partSize=" . ($_GET["split"] ? $_GET["partSize"] : "") . "&method=" . $_GET["method"] . "&proxy=" . ($_GET["useproxy"] ? $_GET["proxy"] : "") . "&saveto=" . $_GET["path"] . "&link=" . urlencode($LINK) . ($_GET["add_comment"] == "on" ? "&comment=" . urlencode($_GET["comment"]) : "") . $auth . ($pauth ? "&pauth={$pauth}" : "") . "&cookie=" . urlencode($cookie);
insert_location($loc);
/*************************\
 WRITTEN BY KAOX 06-oct-09
\*************************/
 public function Download($link)
 {
     global $premium_acc;
     $user = '';
     $pass = '';
     if ($_REQUEST['iuser'] != '' && $_REQUEST['ipass'] != '') {
         $user = $_REQUEST['iuser'];
         $pass = $_REQUEST['ipass'];
     } else {
         if (isset($premium_acc["filesonic_com"]['user']) && $premium_acc["filesonic_com"]['user'] != '' && $premium_acc["filesonic_com"]['pass'] != '') {
             $user = $premium_acc["filesonic_com"]['user'];
             $pass = $premium_acc["filesonic_com"]['pass'];
         } else {
             if ($_REQUEST['premium_user'] != '' && $_REQUEST['premium_pass'] != '') {
                 $user = $_REQUEST['premium_user'];
                 $pass = $_REQUEST['premium_pass'];
             }
         }
     }
     try {
         $regex = '|/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?$|';
         $matches = array();
         preg_match($regex, $link, $matches);
         if (!isset($matches[1])) {
             throw new Exception("Invalid FileSonic Link");
         }
         $id = str_replace('/', '-', $matches[1]);
         $post = array('u' => $user, 'p' => $pass, 'ids' => $id);
         $page = geturl("api.filesonic.com", 80, '/link?method=getDownloadLink', 0, 0, $post, 0, $_GET["proxy"], $pauth);
         $response = explode("\n", $page);
         $body = '';
         foreach ($response as $content) {
             $content = trim($content);
             if (isset($isBody) && $isBody <= 1) {
                 $isBody++;
             }
             if ($content == '') {
                 $isBody = 0;
             }
             if ($content == '0') {
                 break;
             }
             if ($isBody == 2) {
                 $body = $content;
             }
         }
         $apiResponse = json_decode($body, true);
         if (!$apiResponse || !isset($apiResponse['FSApi_Link']) || !isset($apiResponse['FSApi_Link']['getDownloadLink']) || !isset($apiResponse['FSApi_Link']['getDownloadLink']['status'])) {
             throw new Exception("Unable to get download link, unknow API response. Debugging: " . $page);
         }
         if ($apiResponse['FSApi_Link']['getDownloadLink']['status'] == 'failed') {
             $msg = '';
             foreach ($apiResponse['FSApi_Link']['getDownloadLink']['errors'] as $type => $errors) {
                 switch ($type) {
                     case 'FSApi_Auth_Exception':
                         $msg .= $errors . ' (user: '******')' . "\n";
                         break;
                     default:
                         $msg .= $errors . "\n";
                 }
             }
             throw new Exception("Failed to get download link with message: " . $msg);
         }
         $download = $apiResponse['FSApi_Link']['getDownloadLink']['response']['links'][0];
         if ($download['status'] == 'NOT_AVAILABLE') {
             throw new Exception("This file was deleted");
         }
         if ($download['status'] != 'AVAILABLE') {
             throw new Exception("Unable to download this file: " . $download['status']);
         }
         $Url = parse_url($download['url']);
         $loc = "{$_SERVER['PHP_SELF']}?filename=" . urlencode($download['filename']) . "&host=" . $Url["host"] . "&port=" . $Url["port"] . "&path=" . urlencode($Url["path"] . ($Url["query"] ? "?" . $Url["query"] : "")) . "&referer=&email=&partSize=" . ($_GET["split"] ? $_GET["partSize"] : "") . "&method=" . $_GET["method"] . "&proxy=" . ($_GET["useproxy"] ? $_GET["proxy"] : "") . "&saveto=" . $_GET["path"] . "&link=&comment=&cookie=&post=";
         insert_location($loc);
     } catch (Exception $e) {
         html_error($e->getMessage());
     }
 }
 public function moveToAutoDownloader($link_array)
 {
     global $PHP_SELF, $options;
     if (empty($link_array) || !is_array($link_array) || count($link_array) == 0) {
         html_error('Error getting links from folder.');
     }
     if (!is_file('audl.php') || !empty($options['auto_download_disable'])) {
         html_error('audl.php not found or you have disable auto download feature!');
     }
     $pos = strrpos($PHP_SELF, '/');
     $audlpath = $pos !== false ? substr($PHP_SELF, 0, $pos + 1) . 'audl.php?GO=GO' : 'audl.php?GO=GO';
     $inputs = GetDefaultParams();
     $inputs['links'] = implode("\r\n", $link_array);
     $key_array = array('premium_acc', 'premium_user', 'premium_pass', 'cookieuse', 'cookie');
     foreach ($key_array as $v) {
         if (!empty($_GET[$v])) {
             $inputs[$v] = urlencode($_GET[$v]);
         }
     }
     insert_location($inputs, $audlpath);
     exit;
 }
if (!defined('RAPIDLEECH')) {
    require_once "index.html";
    exit;
}
$page = geturl($Url["host"], $Url["port"] ? $Url["port"] : 80, $Url["path"] . ($Url["query"] ? "?" . $Url["query"] : ""), $Referer, 0, 0, 0, $_GET["proxy"], $pauth);
is_page($page);
$cookie = biscotti($page);
is_present($page, "File Not Found");
if (preg_match('%FileSend -(\\r|\\n)*(.*)(\\r|\\n)*</title>%i', $page, $fname)) {
    $FileName = $fname[2];
}
preg_match('/action="(.*dl\\.php\\?.*?)"/i', $page, $loc);
preg_match_all('/\\w{40,44}/i', $page, $comb);
$act = cut_str($loc[0], 'action="', '"');
$Href = $act;
$Url = parse_url($Href);
$FileName = !$FileName ? basename($Url["path"]) : $FileName;
$post = array();
$post[$comb[0][0]] = $comb[0][1];
insert_location("{$PHP_SELF}?filename=none&host=" . $Url["host"] . "&path=" . urlencode($Url["path"] . ($Url["query"] ? "?" . $Url["query"] : "")) . "&referer=" . urlencode($LINK) . "&post=" . urlencode(serialize($post)) . "&cookie=" . urlencode($cookie) . "&email=" . ($_GET["domail"] ? $_GET["email"] : "") . "&partSize=" . ($_GET["split"] ? $_GET["partSize"] : "") . "&proxy=" . ($_GET["useproxy"] ? $_GET["proxy"] : "") . "&saveto=" . $_GET["path"] . "&link=" . urlencode($LINK) . ($_GET["add_comment"] == "on" ? "&comment=" . urlencode($_GET["comment"]) : "") . "&auth=" . $auth . ($pauth ? "&pauth={$pauth}" : ""));
function biscotti($content)
{
    is_page($content);
    preg_match_all("/Set-Cookie: (.*)\n/", $content, $matches);
    foreach ($matches[0] as $coll) {
        $bis .= cut_str($coll, "Set-Cookie: ", "; ") . "; ";
    }
    return $bis;
}
// written by kaox 10/05/09
Esempio n. 9
0
function insert_address_for_user($country = 0, $region = 0, $city = 0, $location = 0, $comments = 0, $streets = 0, $numbers = 0, $userid = 0)
{
    $comments = $comments;
    if ($userid) {
        $not_null = 0;
        $countryid = 0;
        if ($country) {
            $not_null = 1;
            $countryid = insert_country($country);
        }
        $regionid = 0;
        if ($region) {
            $not_null = 1;
            $regionid = insert_region($region);
        }
        $cityid = 0;
        if ($city) {
            $not_null = 1;
            $cityid = insert_city($city);
        }
        $locationid = 0;
        if ($location) {
            $not_null = 1;
            $locationid = insert_location($location);
        }
        if (NULL != ($addressid = exists_address_for_user($countryid, $regionid, $cityid, $locationid, $comments, $streets, $numbers, $userid))) {
            $nextaddressid = get_next_auto_increment_for_table("contacts", "addresses");
            for ($col = 0; $col < count($streets); $col++) {
                $streetid = 0;
                if ($streets[$col]) {
                    $not_null = 1;
                    $streetid = insert_street($streets[$col]);
                    $relationid = insert_relation("addresses", "streets", $nextaddressid, $streetid);
                    if ($numbers[$col]) {
                        insert_streetnum($relationid, $numbers[$col]);
                    }
                }
            }
            if ($not_null) {
                return Query("INSERT INTO addresses (`countryid`,`regionid`,`cityid`,`locationid`,`comments`) VALUES ('" . $countryid . "','" . $regionid . "','" . $cityid . "','" . $locationid . "','" . $comments . "')", debug_backtrace());
            } else {
                return NULL;
            }
        }
        return $addressid;
    } else {
        return NULL;
    }
}
Esempio n. 10
0
         require_once HOST_DIR . 'download/' . $file;
         $class = substr($file, 0, -4);
         $firstchar = substr($file, 0, 1);
         if ($firstchar > 0) {
             $class = "d" . $class;
         }
         if (class_exists($class)) {
             $hostClass = new $class();
             $hostClass->Download($LINK);
         }
         $isHost = true;
     }
 }
 if (!$isHost) {
     $FileName = basename($Url["path"]);
     insert_location("{$PHP_SELF}?filename=" . urlencode($FileName) . "&host=" . $Url["host"] . "&port=" . $Url["port"] . "&path=" . urlencode($Url["path"] . ($Url["query"] ? "?" . $Url["query"] : "")) . "&referer=" . urlencode($Referer) . "&email=&partSize=&method=&proxy=" . ($_GET["useproxy"] ? $_GET["proxy"] : "") . "&saveto=" . $_GET["path"] . "&link=" . urlencode($LINK));
 }
 echo '<script type="text/javascript">updateStatus(' . $i . ", '" . lang(25) . "');</script>" . $nn;
 $redir = "";
 $lastError = "";
 do {
     list($_GET["filename"], $tmp) = explode('?', urldecode(trim($_GET["filename"])));
     $_GET["saveto"] = urldecode(trim($_GET["saveto"]));
     $_GET["host"] = urldecode(trim($_GET["host"]));
     $_GET["path"] = urldecode(trim($_GET["path"]));
     $_GET["port"] = $_GET["port"] ? urldecode(trim($_GET["port"])) : 80;
     $_GET["referer"] = $_GET["referer"] ? urldecode(trim($_GET["referer"])) : 0;
     $_GET["link"] = urldecode(trim($_GET["link"]));
     $_GET["post"] = $_GET["post"] ? unserialize(stripslashes(urldecode(trim($_GET["post"])))) : 0;
     $_GET["cookie"] = $_GET["cookie"] ? urldecode(trim($_GET["cookie"])) : 0;
     $redirectto = "";