');
}
/*
* You can use this function to retrieve pages without parsing the link
* @param string $link -> The link of the page to retrieve
* @param string $cookie -> The cookie value if you need
* @param array $post -> Array name=>value of the post data
* @param string $referer -> The referer of the page, it might be the value you are missing if you can't get plugin to work
* @param string $auth -> Page authentication, unneeded in most circumstances
*/
public function GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0) {
if (!$referer && !empty($GLOBALS['Referer'])) {
$referer = $GLOBALS['Referer'];
}
$cURL = $GLOBALS['options']['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false;
$Url = parse_url(trim($link));
if (strtolower($Url['scheme']) == 'https') {
$chttps = false;
if ($cURL) {
$cV = curl_version();
if (in_array('https', $cV['protocols'], true)) $chttps = true;
}
if (!extension_loaded('openssl') && !$chttps) html_error('You need to install/enable PHP\'s OpenSSL extension to support HTTPS connections.');
elseif (!$chttps) $cURL = false;
}
if ($cURL) {
if ($XMLRequest) $referer .= "\r\nX-Requested-With: XMLHttpRequest";
$page = cURL($link, $cookie, $post, $referer, $auth);
} else {
global $pauth;
$page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest);
is_page($page);
}
return $page;
}
/*
* 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 = 0, $cookie = 0, $post = 0, $referer = 0, $force_name = 0, $auth = 0, $addon = array()) {
if (!$referer && !empty($GLOBALS['Referer'])) {
$referer = $GLOBALS['Referer'];
}
$url = parse_url($link);
$params = $this->DefaultParamArr($link, $cookie, $referer, true);
unset($params['premium_acc']);
$params['filename'] = urlencode(basename((!empty($FileName) ? $FileName : urldecode(parse_url($link, PHP_URL_PATH)))));
if (!empty($force_name)) $params['force_name'] = urlencode(basename($force_name));
$params['host'] = urlencode($url['host']);
if (!empty($url['port'])) $params['port'] = urlencode($url['port']);
$params['path'] = urlencode($url['path'] . (!empty($url['query']) ? '?' . $url['query'] : ''));
if (!empty($post)) $params['post'] = urlencode(encrypt(serialize($post)));
if (!empty($auth)) $params['auth'] = ($auth == '1' ? '1' : urlencode(encrypt(base64_encode($auth))));
if (!empty($addon)) {
if (!is_array($addon)) html_error('Plugin problem! Please report, error: "The parameter passed must be an array"'); // Some problems with the plugin, quit it
foreach ($addon as $name => $value) $params[$name] = (is_array($value) ? urlencode(serialize($value)) : urlencode($value));
}
insert_location($params);
}
/*
* Use this function to move your multiples links array to auto downloader
* @param array $link_array -> Normal array containing all download links
*/
public function moveToAutoDownloader($link_array) {
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($GLOBALS['options']['auto_download_disable'])) html_error('audl.php not found or you have disable auto download feature!');
$pos = strrpos($_SERVER['SCRIPT_NAME'], '/');
$audlpath = ($pos !== false) ? substr($_SERVER['SCRIPT_NAME'], 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();
}
public function CountDown($countDown) {
if ($countDown <= 0) return;
insert_timer($countDown, 'Waiting link timelock.', '', true);
}
/*
* Use this function to create Captcha display form
* @param string $captchaImg -> The link of the captcha image or downloaded captcha image on server
* @param array $inputs -> Key Value pairs for html form input elements ( these elements will be hidden form elements )
* @param string $captchaSize -> The size of captcha text box
* @param string $sname -> The text of submit button
* @param string $sname -> The name of captcha text field
*/
public function EnterCaptcha($captchaImg, $inputs, $captchaSize = '5', $sname = 'Enter Captcha', $iname = 'captcha') {
echo "\n\n";
include(TEMPLATE_DIR.'footer.php');
exit();
}
/*
* This function will return an array with the Default Key Value pairs including proxy, method, email, etc.
* @param string $link -> Adds the link value to the array url encoded if you need it.
* @param string $cookie -> Adds the cookie value to the array url encoded if you need it.
* @param string $referer -> Adds the referer value to the array url encoded if you need it. If isn't set, it will load $Referer value. (Set as 0 or false for not add it in the array.)
*/
public function DefaultParamArr($link = 0, $cookie = 0, $referer = 1, $encrypt = 0) {
if ($referer === 1 || $referer === true) {
global $Referer;
$referer = $Referer;
}
if (!empty($cookie)) {
if (is_array($cookie)) $cookie = CookiesToStr($cookie);
if ($encrypt) $cookie = encrypt($cookie);
}
$DParam = GetDefaultParams();
if (!empty($link)) $DParam['link'] = $link;
if (!empty($cookie)) $DParam['cookie'] = urlencode($cookie);
if (!empty($referer)) $DParam['referer'] = $referer;
return $DParam;
}
/* Use this function for filehost longer timelock
* Param int $secs -> The number of seconds to count down
* Param array $post -> Variable array to include as POST so you dont need to start over the process
* Param $string $text -> Default text you want to display when counting down
*/
public function JSCountdown($secs, $post = 0, $text = '', $stop = 1, $onFinish = '') {
if (empty($text)) $text = 'Waiting link timelock';
if (empty($onFinish)) $onFinish = (empty($post) ? 'location.reload();' : 'document.forms.js_timer.submit();');
echo "
\s*<(?:(div)|label for="response") class="fbc-imageselect-message-(?:text|error)">(?>(.*?)(?(2)div|label)>)@i', $page, $cMsg)) html_error("[RC2] {$c}Error getting challenge message.");
if (empty($cMsg[1])) {
if (!preg_match('@@i', $page, $addImage)) html_error("[RC2] {$c}Error getting challenge image.");
$addImage = $addImage[1];
} else {
$addImage = false;
}
$cMsg = $cMsg[3];
echo "\n\n";
include(TEMPLATE_DIR.'footer.php');
exit();
}
public function verifyReCaptchav2($directOutput = false, $retryMethod = 'retryReCaptchav2') {
if (empty($_POST['recaptcha2_challenge_field']) || empty($_POST['recaptcha2_public_key']) || preg_match('/[^\w\.\-]/', $_POST['recaptcha2_public_key'])) html_error('[RC2] Invalid / Missing reCaptcha2 data.');
if (empty($_POST['recaptcha2_response_field']) || !is_array($_POST['recaptcha2_response_field'])) html_error('[RC2] You didn\'t enter the image verification code.');
$publicKey = $_POST['recaptcha2_public_key'];
$post = 'c=' . urlencode($_POST['recaptcha2_challenge_field']) . '&response=' . implode(array_map('urlencode', $_POST['recaptcha2_response_field']), '&response=');
$link = 'http://www.google.com/recaptcha/api/fallback?k=' . urlencode($publicKey);
$this->rc2Page[$publicKey] = $page = $this->GetPage($link, array('PREF' => 'LD=en'), $post, $link);
is_present($page, 'Sorry, an error has occurred', '[RC2] Corrupted o Invalid reCaptcha2 Data.');
if (stripos($page, 'payload?c=') !== false) {
$retryCallback = array($this, $retryMethod);
if (is_callable($retryCallback)) {
echo '[RC2] Wrong CAPTCHA entered.
';
return call_user_func($retryCallback);
} else html_error('[RC2] retryMethod not found/callable.');
}
if (stripos($page, 'Copy this code') === false) html_error('[RC2] Unknown error after sending captcha.');
if (!preg_match('@>\s*([^<>\s]+)\s*@i', $page, $gibberish)) html_error('[RC2] Validated response not found.');
if ($directOutput) return urlencode($gibberish[1]);
else return array('g-recaptcha-response' => urlencode($gibberish[1]));
}
}
/**********************************************************
Added support of force_name in RedirectDownload function by Raj Malhotra on 02 May 2010
Fixed EnterCaptcha function ( Re-Write ) by Raj Malhotra on 16 May 2010
Added auto-encryption system (szal) 14 June 2010
Added GetPage support function for https connection by Th3-822 21 April 2011
Added GetPage support function for xml request by vdhdevil 9 July 2011
Tweaked DefaultParamArr code by Th3-822 22 July 2011
Moved JSCountdown function for future use by Th3-822
Add CheckBack function to test correctly download link by vdhdevil
Remove declaration of checkback function, it automatically signed in the plugin itself
Add new limitation options by Ruud v.Tony
**********************************************************/
?>