diff --git a/.htaccess b/.htaccess
index 194fbbc..a951e3a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,6 +1,6 @@
order deny,allow
-
+
deny from all
@@ -29,10 +29,6 @@ allow from all
allow from all
-
-allow from all
-
-
allow from all
@@ -43,4 +39,12 @@ allow from all
deny from all
-
\ No newline at end of file
+
+
+#CGI Auth Fix
+
+ Options +SymLinksIfOwnerMatch
+ RewriteEngine on
+ RewriteCond %{HTTP:Authorization} !^$
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
diff --git a/audl.php b/audl.php
index 138e7a3..7d3f598 100644
--- a/audl.php
+++ b/audl.php
@@ -1,33 +1,13 @@
-
+ Remove non-supported characters from filename
+
+
-
-
-
-
-
-
-
-
-
-
-
+ [22] Video: MP4 720p | Audio: AAC ~192 kbps
+ [43] Video: WebM 360p | Audio: Vorbis ~128 kbps
+ [18] Video: MP4 360p | Audio: AAC ~96 kbps
+ [5] Video: FLV 240p | Audio: MP3 ~64 kbps
diff --git a/auul.php b/auul.php
index bf6ec6f..a3065a2 100644
--- a/auul.php
+++ b/auul.php
@@ -1,37 +1,19 @@
diff --git a/classes/.htaccess b/classes/.htaccess
index 6c073da..d8cdd32 100644
--- a/classes/.htaccess
+++ b/classes/.htaccess
@@ -1,13 +1,10 @@
order deny,allow
-
-
deny from all
-
-
-deny from all
+
+allow from all
allow from all
-
\ No newline at end of file
+
diff --git a/classes/ftp.php b/classes/ftp.php
index 20462d4..4b0c332 100644
--- a/classes/ftp.php
+++ b/classes/ftp.php
@@ -20,17 +20,17 @@ function getftpurl($host, $port, $url, $saveToFile = 0) {
$server = "$host:$port";
if (empty($host) || empty($port) || !$ftp->SetServer($host, (int) $port)) {
$ftp->quit();
- $lastError = sprintf(lang(79), $server) . '' . lang(78) . ' ';
+ $lastError = sprintf(lang(79), $server);
return FALSE;
} else {
if (!$ftp->connect()) {
$ftp->quit();
- $lastError = sprintf(lang(79), $server) . '' . lang(78) . ' ';
+ $lastError = sprintf(lang(79), $server);
return FALSE;
} else {
if (!$ftp->login()) {
$ftp->quit();
- $lastError = lang(80) . '' . lang(78) . ' ';
+ $lastError = lang(80);
return FALSE;
} else {
echo('');
@@ -74,7 +74,11 @@ function getftpurl($host, $port, $url, $saveToFile = 0) {
$saveToFile = str_replace($filetype, $options['rename_these_filetypes_to'], $saveToFile);
}
- if (file_exists($saveToFile)) $saveToFile = dirname($saveToFile) . PATH_SPLITTER . time() . '_' . basename($saveToFile);
+ if (@file_exists($saveToFile) && $options['bw_save']) {
+ // Skip in audl.
+ if (isset($_GET['audl'])) echo '';
+ html_error(lang(99) . ': ' . link_for_file($saveToFile), 0);
+ } elseif (@file_exists($saveToFile)) $saveToFile = dirname($saveToFile) . PATH_SPLITTER . time() . '_' . basename($saveToFile);
printf(lang(83), basename($saveToFile), bytesToKbOrMbOrGb($fileSize));
echo " ";
require_once(TEMPLATE_DIR . '/transloadui.php');
diff --git a/classes/http.php b/classes/http.php
index ebf470b..9667600 100644
--- a/classes/http.php
+++ b/classes/http.php
@@ -83,25 +83,20 @@ function is_page($lpage) {
function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveToFile = 0, $proxy = 0, $pauth = 0, $auth = 0, $scheme = 'http', $resume_from = 0, $XMLRequest = 0) {
global $nn, $lastError, $Resume, $bytesReceived, $fp, $fs, $force_name, $options;
- $scheme .= '://';
+ $scheme = strtolower($scheme) . '://';
if (($post !== 0) && ($scheme == 'http://' || $scheme == 'https://')) {
$method = 'POST';
$postdata = is_array($post) ? formpostdata($post) : $post;
- $length = strlen($postdata);
- $content_tl = "Content-Type: application/x-www-form-urlencoded$nn" . "Content-Length: $length$nn";
} else {
$method = 'GET';
- $content_tl = $postdata = '';
+ $postdata = '';
}
- $cookies = '';
if (!empty($cookie)) {
- if (is_array ($cookie)) {
- if (count($cookie) > 0) $cookies = 'Cookie: ' . CookiesToStr($cookie) . $nn;
- } else $cookies = 'Cookie: ' . trim($cookie) . $nn;
+ if (is_array($cookie)) $cookies = (count($cookie) > 0) ? CookiesToStr($cookie) : 0;
+ else $cookies = trim($cookie);
}
- $referer = $referer ? "Referer: $referer$nn" : '';
if ($scheme == 'https://') {
$scheme = 'ssl://';
@@ -111,27 +106,33 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
if ($proxy) {
list($proxyHost, $proxyPort) = explode(':', $proxy, 2);
$host = $host . ($port != 80 && ($scheme != 'ssl://' || $port != 443) ? ':' . $port : '');
- $url = $scheme . $host . $url;
+ $url = "$scheme$host$url";
}
if ($scheme != 'ssl://') $scheme = '';
- $http_auth = (!empty($auth)) ? "Authorization: Basic $auth$nn" : '';
- $proxyauth = (!empty($pauth)) ? "Proxy-Authorization: Basic $pauth$nn" : '';
-
$request = array();
$request[] = $method . ' ' . str_replace(' ', '%20', $url) . ' HTTP/1.1';
$request[] = "Host: $host";
- $request[] = 'User-Agent: Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.12';
+ $request[] = 'User-Agent: Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16';
$request[] = 'Accept: */*';
+ if (!empty($referer)) $request[] = "Referer: $referer";
+ if (!empty($cookies)) $request[] = "Cookie: $cookies";
$request[] = 'Accept-Language: en-US;q=0.7,en;q=0.3';
$request[] = 'Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.7';
$request[] = 'Pragma: no-cache';
$request[] = 'Cache-Control: no-cache';
- if ($Resume ['use'] === TRUE) $request[] = 'Range: bytes=' . $Resume ['from'] . '-';
+ if ($Resume['use'] === TRUE) $request[] = 'Range: bytes=' . $Resume['from'] . '-';
+ if (!empty($auth)) $request[] = "Authorization: Basic $auth";
+ if (!empty($pauth)) $request[] = "Proxy-Authorization: Basic $pauth";
+ if ($method == 'POST') {
+ if (!empty($referer) && stripos($referer, "\nContent-Type: ") === false) $request[] = 'Content-Type: application/x-www-form-urlencoded';
+ $request[] = 'Content-Length: ' . strlen($postdata);
+ }
if ($XMLRequest) $request[] = 'X-Requested-With: XMLHttpRequest';
+ $request[] = 'Connection: Close';
- $request = implode($nn, $request) . $nn . $http_auth . $proxyauth . $referer . $cookies . $content_tl . 'Connection: Close' . $nn . $nn . $postdata;
+ $request = implode($nn, $request). $nn . $nn . $postdata;
$errno = 0;
$errstr = '';
@@ -141,6 +142,7 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
if (!$fp) {
+ if (!function_exists('stream_socket_client')) html_error('[ERROR] stream_socket_client() is disabled.');
$dis_host = !empty($proxyHost) ? $proxyHost : $host;
$dis_port = !empty($proxyPort) ? $proxyPort : $port;
html_error(sprintf(lang(88), $dis_host, $dis_port));
@@ -174,6 +176,8 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
$len = strlen($header);
if (!$header || $len == $llen) {
$lastError = lang(91);
+ stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
+ fclose($fp);
return false;
}
$llen = $len;
@@ -192,18 +196,23 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
} else $chkref = false;
$found = false;
if ($chkhost || $chkref) foreach ($GLOBALS['host'] as $site => $file) {
- if ($chkhost && host_matches($site, $cbhost)) $found = true;
- elseif ($chkref && host_matches($site, $cbrefhost)) $found = true;
+ if ($chkhost && host_matches($site, $cbhost)) {
+ $found = true;
+ break;
+ } elseif ($chkref && host_matches($site, $cbrefhost)) {
+ $found = true;
+ break;
+ }
+ }
if ($found) {
require_once(HOST_DIR . 'DownloadClass.php');
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) || !method_exists($class, 'CheckBack')) break; // is_callable(array($class , 'CheckBack'))
+ if (class_exists($class) && method_exists($class, 'CheckBack')) { // is_callable(array($class , 'CheckBack'))
$hostClass = new $class(false);
$hostClass->CheckBack($header);
- break;
}
}
unset($cbhost, $cbrefhost, $chkhost, $chkref, $found);
@@ -243,17 +252,15 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
return FALSE;
}
- if ($force_name) {
- $FileName = $force_name;
- $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $FileName;
- } else {
+ if ($force_name) $FileName = $force_name;
+ else {
$ContentDisposition = trim(cut_str($header, "\nContent-Disposition: ", "\n")) . "\n";
if ($ContentDisposition && stripos($ContentDisposition, 'filename=') !== false) {
$FileName = trim(trim(trim(trim(trim(cut_str($ContentDisposition, 'filename=', "\n")), '='), '?'), ';'), '"');
- if (strpos($FileName, '/') !== false) $FileName = basename($FileName);
- $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $FileName;
- }
+ } else $FileName = $saveToFile;
}
+ $FileName = str_replace(array_merge(range(chr(0), chr(31)), str_split("<>:\"/|?*\x5C\x7F")), '', basename(trim($FileName)));
+ $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $FileName;
if (!empty($options['rename_prefix'])) {
$File_Name = $options['rename_prefix'] . '_' . basename($saveToFile);
@@ -308,14 +315,14 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
$fileSize = bytesToKbOrMbOrGb($fileSize);
} else $fileSize = bytesToKbOrMbOrGb($bytesTotal);
$chunkSize = GetChunkSize($bytesTotal);
- echo(lang(104) . ' ' . basename($saveToFile) . ' , ' . lang(56) . ' ' . $fileSize . ' ... ');
+ echo(lang(104) . ' ' . basename($saveToFile) . ' , ' . lang(56) . " $fileSize ... ");
//$scriptStarted = false;
require_once(TEMPLATE_DIR . '/transloadui.php');
if ($Resume['use'] === TRUE) {
$received = bytesToKbOrMbOrGb(filesize($saveToFile));
$percent = round($Resume['from'] / ($bytesTotal + $Resume['from']) * 100, 2);
- echo '";
+ echo "";
//$scriptStarted = true;
flush();
}
@@ -331,7 +338,7 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
$bytesReceived += $bytesSaved;
} else {
$lastError = sprintf(lang(105), basename($saveToFile));
- unlink($saveToFile);
+ // unlink($saveToFile);
return false;
}
if ($bytesReceived >= $bytesTotal) $percent = 100;
@@ -340,29 +347,27 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
$received = bytesToKbOrMbOrGb($bytesReceived + $Resume['from']);
$time = getmicrotime() - $timeStart;
$chunkTime = $time - $lastChunkTime;
- $chunkTime = $chunkTime ? $chunkTime : 1;
+ $chunkTime = (!($chunkTime < 0) && $chunkTime > 0) ? $chunkTime : 1;
$lastChunkTime = $time;
- $speed = @round($chunkSize / 1024 / $chunkTime, 2);
- /*if (!$scriptStarted) {
- echo('";
+ $speed = @round(($bytesReceived - $last) /*$chunkSize*/ / 1024 / $chunkTime, 2);
+ echo "";
$last = $bytesReceived;
}
+ if (!empty($bytesTotal) && ($bytesReceived + $chunkSize) > $bytesTotal) $chunkSize = $bytesTotal - $bytesReceived;
} else $page .= $data;
- } while (strlen($data) > 0);
- //echo('');
+ } while (!feof($fp) && strlen($data) > 0);
if ($saveToFile) {
flock($fs, LOCK_UN);
fclose($fs);
if ($bytesReceived <= 0) {
$lastError = lang(106);
+ stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
fclose($fp);
return FALSE;
}
}
+ stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
fclose($fp);
if ($saveToFile) {
return array('time' => sec2time(round($time)), 'speed' => @round($bytesTotal / 1024 / (getmicrotime() - $timeStart), 2), 'received' => true, 'size' => $fileSize, 'bytesReceived' => ($bytesReceived + $Resume['from']), 'bytesTotal' => ($bytesTotal + $Resume ['from']), 'file' => $saveToFile);
@@ -379,6 +384,7 @@ function geturl($host, $port, $url, $referer = 0, $cookie = 0, $post = 0, $saveT
function cURL($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $opts = 0) {
global $pauth;
+ static $ch;
if (empty($link) || !is_string($link)) html_error(lang(24));
if (!extension_loaded('curl') || !function_exists('curl_init') || !function_exists('curl_exec')) html_error('cURL isn\'t enabled or cURL\'s functions are disabled');
$arr = explode("\r\n", $referer);
@@ -388,16 +394,18 @@ function cURL($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $opts = 0)
unset($arr[0]);
$header = array_filter(array_map('trim', $arr));
}
+ $link = str_replace(array(' ', "\r", "\n"), array('%20'), $link);
$opt = array(CURLOPT_HEADER => 1, CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FOLLOWLOCATION => 0, CURLOPT_FAILONERROR => 0,
- CURLOPT_FORBID_REUSE => 1, CURLOPT_FRESH_CONNECT => 1,
- CURLINFO_HEADER_OUT => 1, CURLOPT_USERAGENT => 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.12');
+ CURLOPT_FORBID_REUSE => 0, CURLOPT_FRESH_CONNECT => 0,
+ CURLINFO_HEADER_OUT => 1, CURLOPT_URL => $link,
+ CURLOPT_USERAGENT => 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16');
if (!empty($referer)) $opt[CURLOPT_REFERER] = $referer;
if (!empty($cookie)) $opt[CURLOPT_COOKIE] = (is_array($cookie) ? CookiesToStr($cookie) : trim($cookie));
// Send more headers...
- $headers = array('Accept-Language: en-US;q=0.7,en;q=0.3', 'Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.7', 'Pragma: no-cache', 'Cache-Control: no-cache', 'Connection: Close');
+ $headers = array('Accept-Language: en-US;q=0.7,en;q=0.3', 'Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.7', 'Pragma: no-cache', 'Cache-Control: no-cache', 'Connection: Keep-Alive');
if (count($header) > 0) $headers = array_merge($headers, $header);
$opt[CURLOPT_HTTPHEADER] = $headers;
@@ -409,7 +417,6 @@ function cURL($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $opts = 0)
$opt[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;
$opt[CURLOPT_USERPWD] = base64_decode($auth);
}
-
if (isset($_GET['useproxy']) && !empty($_GET['proxy'])) {
$opt[CURLOPT_HTTPPROXYTUNNEL] = false;
$opt[CURLOPT_PROXY] = $_GET['proxy'];
@@ -418,16 +425,16 @@ function cURL($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $opts = 0)
$opt[CURLOPT_CONNECTTIMEOUT] = $opt[CURLOPT_TIMEOUT] = 120;
if (is_array($opts) && count($opts) > 0) foreach ($opts as $O => $V) $opt[$O] = $V;
- $link = str_replace(array(' ', "\r", "\n"), array('%20'), $link);
- $ch = curl_init($link);
+ if (!isset($ch)) $ch = curl_init();
+
foreach ($opt as $O => $V) curl_setopt($ch, $O, $V); // Using this instead of 'curl_setopt_array'
$page = curl_exec($ch);
$info = curl_getinfo($ch);
$errz = curl_errno($ch);
$errz2 = curl_error($ch);
- curl_close($ch);
+ // curl_close($ch);
- if (substr($page, 9, 3) == '100') $page = preg_replace("@^HTTP/1\.1 100 Continue\r\n\r\n(HTTP/1\.1 \d+ [^\r|\n]+)@i", "$1", $page, 1); // The "100 Continue" can break some functions in plugins, lets remove it...
+ if (substr($page, 9, 3) == '100' || !empty($opt[CURLOPT_HTTPPROXYTUNNEL])) $page = preg_replace("@^HTTP/1\.[01] \d{3}(?:\s[^\r\n]+)?\r\n\r\n(HTTP/1\.[01] \d+ [^\r\n]+)@i", "$1", $page, 1); // The "100 Continue" or "200 Connection established" can break some functions in plugins, lets remove it...
if ($errz != 0) html_error("[cURL:$errz] $errz2");
return $page;
@@ -470,19 +477,25 @@ function GetCookies($content) {
* Function to get cookies & converted into array
* @param string The content you want to get the cookie from
* @param array Array of cookies to be updated [optional]
- * @param bool Options to remove temporary cookie (usually it named as 'deleted') [optional]
+ * @param bool Options to remove "deleted" or expired cookies (usually it named as 'deleted') [optional]
* @param mixed The default name for temporary cookie, values are accepted in an array [optional]
*/
function GetCookiesArr($content, $cookie=array(), $del=true, $dval=array('','deleted')) {
if (!is_array($cookie)) $cookie = array();
if (($hpos = strpos($content, "\r\n\r\n")) > 0) $content = substr($content, 0, $hpos); // We need only the headers
- if (empty($content) || stripos($content, "\nSet-Cookie: ") === false || !preg_match_all ('/\nSet-Cookie: (.*)(;|\r\n)/U', $content, $temp)) return $cookie;
+ if (empty($content) || stripos($content, "\nSet-Cookie: ") === false || !preg_match_all ('/\nSet-Cookie: ([^\r\n]+)/', $content, $temp)) return $cookie;
foreach ($temp[1] as $v) {
+ if (strpos($v, ';') !== false) list($v, $p) = explode(';', $v, 2);
+ else $p = false;
$v = explode('=', $v, 2);
$cookie[$v[0]] = $v[1];
if ($del) {
if (!is_array($dval)) $dval = array($dval);
if (in_array($v[1], $dval)) unset($cookie[$v[0]]);
+ elseif (!empty($p)) {
+ if (stripos($p, 'Max-Age=') !== false && preg_match('/[ \;]?Max-Age=(-?\d+)/i', $p, $P) && (int)$P[1] < 1) unset($cookie[$v[0]]);
+ elseif (stripos($p, 'expires=') !== false && preg_match('/[ \;]?expires=([a-zA-Z]{3}, \d{1,2} [a-zA-Z]{3} \d{4} \d{1,2}:\d{1,2}:\d{1,2} GMT)/i', $p, $P) && ($P = strtotime($P[1])) !== false && $P <= time()) unset($cookie[$v[0]]);
+ }
}
}
return $cookie;
@@ -511,6 +524,8 @@ function StrToCookies($cookies, $cookie=array(), $del=true, $dval=array('','dele
}
function GetChunkSize($fsize) {
+ if ($fsize <= 0) return 4096;
+ if ($fsize < 4096) return (int)$fsize;
if ($fsize <= 1024 * 1024) return 4096;
if ($fsize <= 1024 * 1024 * 10) return 4096 * 10;
if ($fsize <= 1024 * 1024 * 40) return 4096 * 30;
@@ -527,9 +542,9 @@ function GetChunkSize($fsize) {
}
function upfile($host, $port, $url, $referer, $cookie, $post, $file, $filename, $fieldname, $field2name = '', $proxy = 0, $pauth = 0, $upagent = 0, $scheme = 'http') {
- global $nn, $lastError, $sleep_time, $sleep_count;
+ global $nn, $lastError, $sleep_time, $sleep_count, $fp, $fs;
- if (empty($upagent)) $upagent = 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.12';
+ if (empty($upagent)) $upagent = 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16';
$scheme .= '://';
$bound = '--------' . md5(microtime());
@@ -577,7 +592,7 @@ function upfile($host, $port, $url, $referer, $cookie, $post, $file, $filename,
if ($proxy) {
list($proxyHost, $proxyPort) = explode(':', $proxy, 2);
$host = $host . ($port != 80 && ($scheme != 'ssl://' || $port != 443) ? ':' . $port : '');
- $url = $scheme . $host . $url;
+ $url = "$scheme$host$url";
}
if ($scheme != 'ssl://') $scheme = '';
@@ -661,10 +676,11 @@ function upfile($host, $port, $url, $referer, $cookie, $post, $file, $filename,
$time = getmicrotime() - $timeStart;
$chunkTime = $time - $lastChunkTime;
$chunkTime = $chunkTime ? $chunkTime : 1;
+ $chunkTime = (!($chunkTime < 0) && $chunkTime > 0) ? $chunkTime : 1;
$lastChunkTime = $time;
$speed = round($sendbyte / 1024 / $chunkTime, 2);
$percent = round($totalsend / $fileSize * 100, 2);
- echo '\n";
+ echo "\n";
flush();
}
//echo('');
diff --git a/classes/js.js b/classes/js.js
index 0c852d4..dbac167 100644
--- a/classes/js.js
+++ b/classes/js.js
@@ -9,10 +9,10 @@ if (top != self) {
function new_transload_window() {
var tmp = (new Date()).getTime();
- $('form[name="transload"]').attr('target', 'rapidleech_' + tmp);
+ $('form[name=transload]').attr('target', 'rapidleech_' + tmp);
var options = 'width=700,height=320,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no';
window.open('', 'rapidleech_' + tmp, options);
- window.setTimeout('$(\'form[name="transload"]\').submit();', 200);
+ window.setTimeout('$(\'form[name=transload]\').submit();', 200);
}
function table_filelist_refresh_headers() {
@@ -70,7 +70,7 @@ function deleteCookie(name, path, domain) {
}
function clearSettings() {
- clear('domail', 'email', 'split', 'method', 'partSize', 'useproxy', 'proxy', 'saveto', 'path', 'savesettings');
+ clear('domail', 'email', 'saveto', 'path', 'useproxy', 'proxy', 'proxyuser', 'proxypass', 'split', 'partSize', 'savesettings', 'clearsettings', 'premium_acc', 'premium_user', 'premium_pass');
$('#domail, #splitchkbox, #useproxy, #premium_acc, #saveto, #savesettings').prop('checked', false);
$('#email, #proxyproxy, #proxyuser, #proxypass, #premium_user, #premium_pass').val('');
$('#emailtd, #splittd, #methodtd, #proxy, #premiumblock, #path, #clearsettings').hide();
@@ -78,7 +78,7 @@ function clearSettings() {
}
function clear() {
- for (var i = 0; i < arguments.length; i++) document.cookie = arguments[i] + ' = ' + '; expires=Thu, 01-Jan-70 00:00:01 GMT';
+ for (var i = 0; i < arguments.length; i++) document.cookie = arguments[i] + ' = ; expires=Thu, 01-Jan-70 00:00:01 GMT';
}
//Match text
@@ -172,11 +172,8 @@ function changeStatus(file, size) {
}
function checkFile(id) {
- if (document.getElementById('files' + id).checked == true) {
- document.getElementById('files' + id).checked = false;
- } else {
- document.getElementById('files' + id).checked = true;
- }
+ if (document.getElementById('files' + id).checked == true) document.getElementById('files' + id).checked = false;
+ else document.getElementById('files' + id).checked = true;
return false;
}
@@ -199,8 +196,8 @@ function startLinkCheck() {
data: ({
submit: 'Check Links',
links: $('#links').val(),
- k: ($('#chk_k').is(':checked')) ? 1 : 0,
- d: ($('#chk_d').is(':checked')) ? 1 : 0
+ k: ($('#chk_k').prop('checked')) ? 1 : 0,
+ d: ($('#chk_d').prop('checked')) ? 1 : 0
}),
beforeSend: function () {
$('#linkchecker-results').hide();
diff --git a/classes/main.php b/classes/main.php
index 501ffb4..1df0634 100644
--- a/classes/main.php
+++ b/classes/main.php
@@ -3,6 +3,10 @@
require('../deny.php');
exit;
}
+
+// Load template functions
+require_once(TEMPLATE_DIR . 'functions.php');
+
// Render the main screen
include(TEMPLATE_DIR.'header.php');
include(TEMPLATE_DIR.'main.php');
diff --git a/classes/options.php b/classes/options.php
index da19a78..e42840e 100644
--- a/classes/options.php
+++ b/classes/options.php
@@ -69,11 +69,23 @@
break;
case 'md5' :
- if (!empty($options['disable_md5'])) break;
+ if (!empty($options['disable_hashing'])) break;
require(CLASS_DIR . 'options/md5.php');
rl_md5();
break;
+ case 'crc32' :
+ if (!empty($options['disable_hashing'])) break;
+ require(CLASS_DIR . 'options/crc32.php');
+ rl_crc32();
+ break;
+
+ case 'sha1' :
+ if (!empty($options['disable_hashing'])) break;
+ require(CLASS_DIR . 'options/sha1.php');
+ rl_sha1();
+ break;
+
case 'md5_change' :
if (!empty($options['disable_md5_change'])) break;
require(CLASS_DIR . 'options/md5change.php');
diff --git a/classes/options/.htaccess b/classes/options/.htaccess
index e30ae10..c468487 100644
--- a/classes/options/.htaccess
+++ b/classes/options/.htaccess
@@ -1,9 +1,2 @@
order deny,allow
-
-
deny from all
-
-
-
-deny from all
-
\ No newline at end of file
diff --git a/classes/options/crc32.php b/classes/options/crc32.php
new file mode 100644
index 0000000..05b3958
--- /dev/null
+++ b/classes/options/crc32.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+ CRC32
+
+';
+ elseif (preg_match('@\[([a-fA-F0-9]{8})\]@', $name, $fcrc) || preg_match('@_([a-fA-F0-9]{8})_@', $name, $fcrc) || preg_match('@\(([a-fA-F0-9]{8})\)@', $name, $fcrc) || preg_match('@\{([a-fA-F0-9]{8})\}@', $name, $fcrc)) {
+ $tstyle = ((!empty($fcrc[2]) || strtoupper($fcrc[1]) == $crc) ? ' style="color: green" title="'.lang(391).'">' : ' style="color: red" title="'.sprintf(lang(392),$fcrc[1]).'">');
+ } else $tstyle = '>';
+?>
+
+
+
+
+
+\n ";
+}
+?>
\ No newline at end of file
diff --git a/classes/options/md5.php b/classes/options/md5.php
index 7d6e5b8..c1ae979 100644
--- a/classes/options/md5.php
+++ b/classes/options/md5.php
@@ -1,29 +1,26 @@
-
-
-
- MD5
-
+
+
+
+ MD5
+
$v) {
- $file = $list[$v];
- if (file_exists($file["name"])) {
+ foreach ($_GET['files'] as $v) {
+ $file = $list[$v];
+ if (file_exists($file['name'])) {
?>
-
-
-
-
-
-
-
-
+
+
+
+
+
\n ";
}
?>
\ No newline at end of file
diff --git a/classes/options/merge.php b/classes/options/merge.php
index e3fbcb7..3b7a025 100644
--- a/classes/options/merge.php
+++ b/classes/options/merge.php
@@ -79,7 +79,7 @@ function merge_go() {
}
fclose ( $fs );
}
- $path = realpath ( DOWNLOAD_DIR ) . '/';
+ $path = realpath ( DOWNLOAD_DIR ) . PATH_SPLITTER;
$filename = basename ( $data ['filename'] );
$partfiles = array ();
$partsSize = 0;
diff --git a/classes/options/sha1.php b/classes/options/sha1.php
new file mode 100644
index 0000000..035ee5f
--- /dev/null
+++ b/classes/options/sha1.php
@@ -0,0 +1,26 @@
+
+
+
+
+
+ SHA1
+
+
+
+
+
+
+
+\n ";
+}
+?>
\ No newline at end of file
diff --git a/classes/options/split.php b/classes/options/split.php
index be94f83..69569af 100644
--- a/classes/options/split.php
+++ b/classes/options/split.php
@@ -9,12 +9,12 @@ function rl_split() {
- " />
+
@@ -28,7 +28,7 @@ function rl_split() {
?>
:
+ value="" />
CRC32 generation mode:
Use hash_file (Recommended)
+ if (function_exists('hash_file')) {
+?> Use hash_file (Recommended)
Read file to memory
- /> Fake
+ /> Fake
crc
@@ -77,91 +70,83 @@ function rl_split() {
function split_go() {
global $list, $options;
- for($i = 0; $i < count ( $_POST ["files"] ); $i ++) {
+ for ($i = 0; $i < count($_POST['files']); $i++) {
$split_ok = true;
- $file = $list [$_POST ["files"] [$i]];
- $partSize = round ( ($_POST ["partSize"] [$i]) * 1024 * 1024 );
- $saveTo = ($options['download_dir_is_changeable'] ? stripslashes ( $_POST ["saveTo"] [$i] ) : realpath ( $options['download_dir'] )) . '/';
- $dest_name = basename ( $file ["name"] );
- $fileSize = filesize ( $file ["name"] );
- $totalParts = ceil ( $fileSize / $partSize );
- $crc = ($_POST ['crc_mode'] [$i] == 'file_read') ? dechex ( crc32 ( read_file ( $file ["name"] ) ) ) : (($_POST ['crc_mode'] [$i] == 'hash_file' && function_exists ( 'hash_file' )) ? hash_file ( 'crc32b', $file ["name"] ) : '111111');
- $crc = str_repeat ( "0", 8 - strlen ( $crc ) ) . strtoupper ( $crc );
- echo "Started to split file " . basename ( $file ["name"] ) . " parts of " . bytesToKbOrMbOrGb ( $partSize ) . ", Using Method - Total Commander... ";
- echo "Total Parts: " . $totalParts . " ";
- for($j = 1; $j <= $totalParts; $j ++) {
- if (file_exists ( $saveTo . $dest_name . '.' . sprintf ( "%03d", $j ) )) {
- echo "It is not possible to split the file. A piece already exists" . $dest_name . '.' . sprintf ( "%03d", $j ) . " ! ";
+ $file = $list[$_POST['files'][$i]];
+ $partSize = round(($_POST['partSize'][$i]) * 1024 * 1024);
+ $saveTo = ($options['download_dir_is_changeable'] ? stripslashes($_POST['saveTo'][$i]) : realpath(DOWNLOAD_DIR) . '/');
+ if (substr($saveTo, -1) != '/') $saveTo .= '/';
+ $dest_name = basename($file['name']);
+ $fileSize = filesize($file['name']);
+ $totalParts = ceil($fileSize / $partSize);
+ $crc = ($_POST['crc_mode'][$i] == 'file_read') ? dechex(crc32(read_file($file['name']))) : (($_POST['crc_mode'][$i] == 'hash_file' && function_exists('hash_file')) ? hash_file('crc32b', $file['name']) : '111111');
+ $crc = str_repeat('0', 8 - strlen($crc)) . strtoupper($crc);
+ echo "Started to split file $dest_name parts of " . bytesToKbOrMbOrGb($partSize) . ", Using Method - Total Commander... ";
+ echo "Total Parts: $totalParts ";
+ for($j = 1; $j <= $totalParts; $j++) {
+ if (file_exists("$saveTo$dest_name." . sprintf('%03d', $j))) {
+ echo "It is not possible to split the file. A piece already exists $dest_name." . sprintf('%03d', $j) . ' ! ';
continue 2;
}
}
- if (file_exists ( $saveTo . $dest_name . '.crc' )) {
- echo "It is not possible to split the file. CRC file already exists" . $dest_name . '.crc' . " ! ";
- } elseif (! is_file ( $file ["name"] )) {
- echo "It is not possible to split the file. Source file not found" . $file ["name"] . " ! ";
- } elseif (! is_dir ( $saveTo )) {
- echo "It is not possible to split the file. Directory doesn't exist" . $saveTo . " ! ";
- } elseif (! @write_file ( $saveTo . $dest_name . ".crc", "filename=" . $dest_name . "\r\n" . "size=" . $fileSize . "\r\n" . "crc32=" . $crc . "\r\n" )) {
- echo "It is not possible to split the file. CRC Error" . $dest_name . ".crc" . " ! ";
- } else {
- $time = filemtime ( $saveTo . $dest_name . '.crc' );
- while ( isset ( $list [$time] ) ) {
- $time ++;
- }
- $list [$time] = array ("name" => $saveTo . $dest_name . '.crc', "size" => bytesToKbOrMbOrGb ( filesize ( $saveTo . $dest_name . '.crc' ) ), "date" => $time );
+ if (file_exists("$saveTo$dest_name.crc")) echo "It is not possible to split the file. CRC file already exists $dest_name.crc ! ";
+ elseif (!is_file($file['name'])) echo "It is not possible to split the file. Source file not found {$file['name']} ! ";
+ elseif (!is_dir($saveTo)) echo "It is not possible to split the file. Directory doesn't exist$saveTo ! ";
+ elseif (!@write_file("$saveTo$dest_name.crc", "filename=$dest_name\r\nsize=$fileSize\r\ncrc32=$crc\r\n")) echo "It is not possible to split the file. CRC Error$dest_name.crc" . " ! ";
+ else {
+ $time = filemtime("$saveTo$dest_name.crc");
+ while (isset($list[$time])) $time++;
+ $list[$time] = array('name' => realpath("$saveTo$dest_name.crc"), 'size' => bytesToKbOrMbOrGb(filesize("$saveTo$dest_name.crc")), 'date' => $time);
$split_buffer_size = 2 * 1024 * 1024;
- $split_source = @fopen ( $file ["name"], "rb" );
- if (! $split_source) {
- echo "It is not possible to open source file " . $file ["name"] . " ! ";
+ $split_source = @fopen($file['name'], 'rb');
+ if (!$split_source) {
+ echo "It is not possible to open source file {$file['name']} ! ";
continue;
}
- for($j = 1; $j <= $totalParts; $j ++) {
- $split_dest = @fopen ( $saveTo . $dest_name . '.' . sprintf ( "%03d", $j ), "wb" );
- if (! $split_dest) {
- echo "Error openning file " . $dest_name . '.' . sprintf ( "%03d", $j ) . " ! ";
+ for($j = 1; $j <= $totalParts; $j++) {
+ $part = sprintf('%03d', $j);
+ $part_name = "$dest_name.$part";
+ $dest_file = $saveTo . $part_name;
+ $split_dest = @fopen($dest_file, 'wb');
+ if (!$split_dest) {
+ echo "Error openning file $part_name ! ";
$split_ok = false;
break;
}
- $split_write_times = floor ( $partSize / $split_buffer_size );
- for($k = 0; $k < $split_write_times; $k ++) {
- $split_buffer = fread ( $split_source, $split_buffer_size );
- if (fwrite ( $split_dest, $split_buffer ) === false) {
- echo "Error writing the file " . $dest_name . '.' . sprintf ( "%03d", $j ) . " ! ";
+ $split_write_times = floor($partSize / $split_buffer_size);
+ for($k = 0; $k < $split_write_times; $k++) {
+ $split_buffer = fread($split_source, $split_buffer_size);
+ $split_written = fwrite($split_dest, $split_buffer);
+ if ($split_written === false || $split_written != strlen($split_buffer)) {
+ echo "Error writing the file $part_name ! ";
$split_ok = false;
break;
}
}
$split_rest = $partSize - ($split_write_times * $split_buffer_size);
if ($split_ok && $split_rest > 0) {
- $split_buffer = fread ( $split_source, $split_rest );
- if (fwrite ( $split_dest, $split_buffer ) === false) {
- echo "Error writing the file " . $dest_name . '.' . sprintf ( "%03d", $j ) . " ! ";
+ $split_buffer = fread($split_source, $split_rest);
+ $split_written = fwrite($split_dest, $split_buffer);
+ if ($split_written === false || $split_written != strlen($split_buffer)) {
+ echo "Error writing the file $part_name ! ";
$split_ok = false;
}
}
- fclose ( $split_dest );
+ fclose($split_dest);
if ($split_ok) {
- $time = filemtime ( $saveTo . $dest_name . '.' . sprintf ( "%03d", $j ) );
- while ( isset ( $list [$time] ) ) {
- $time ++;
- }
- $list [$time] = array ("name" => $saveTo . $dest_name . '.' . sprintf ( "%03d", $j ), "size" => bytesToKbOrMbOrGb ( filesize ( $saveTo . $dest_name . '.' . sprintf ( "%03d", $j ) ) ), "date" => $time );
- }
- }
- fclose ( $split_source );
- if ($split_ok) {
- if ($_POST["del_ok"] && !$options['disable_deleting']) {
- if (@unlink ( $file ["name"] )) {
- unset ( $list [$_POST ["files"] [$i]] );
- echo "Source file deleted. ";
- } else {
- echo "Source file isnot deleted! ";
- }
+ $time = filemtime($dest_file);
+ while (isset($list[$time])) $time++;
+ $list[$time] = array('name' => realpath($dest_file), 'size' => bytesToKbOrMbOrGb(filesize($dest_file)), 'date' => $time);
}
}
- if (! updateListInFile ( $list )) {
- echo "Couldn't update file list. Problem writing to file! ";
+ fclose($split_source);
+ if ($split_ok && $_POST['del_ok'] && !$options['disable_deleting']) {
+ if (@unlink($file['name'])) {
+ unset($list[$_POST['files'][$i]]);
+ echo 'Source file deleted. ';
+ } else echo 'Source file isnot deleted! ';
}
+ if (!updateListInFile($list)) echo "Couldn't update file list. Problem writing to file! ";
}
}
}
diff --git a/classes/other.php b/classes/other.php
index a7b7404..b939fd5 100644
--- a/classes/other.php
+++ b/classes/other.php
@@ -32,12 +32,14 @@ function login_check() {
if ($options['login']) {
function logged_user($ul) {
foreach ($ul as $user => $pass) {
- if ($_SERVER['PHP_AUTH_USER'] == $user && $_SERVER['PHP_AUTH_PW'] == $pass) return true;
+ if ($_SERVER['PHP_AUTH_USER'] == $user && isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] == $pass) return true;
}
return false;
}
- if ($options['login_cgi']) {
- list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = @explode(':', base64_decode(substr((isset($_SERVER['HTTP_AUTHORIZATION']) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION']), 6)), 2);
+ if (empty($_SERVER['PHP_AUTH_USER']) && (!empty($_SERVER['HTTP_AUTHORIZATION']) || !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))) {
+ $auth = !empty($_SERVER['HTTP_AUTHORIZATION']) ? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
+ if (stripos($auth, 'Basic ') === 0 && strpos(($auth = base64_decode(substr($auth, 6))), ':') > 0) list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', $auth, 2);
+ unset($auth);
}
if (empty($_SERVER['PHP_AUTH_USER']) || !logged_user($options['users'])) {
header('WWW-Authenticate: Basic realm="RAPIDLEECH PLUGMOD"');
@@ -79,12 +81,16 @@ function insert_location($inputs, $action = 0) {
}
}
-function pause_download() {
- global $pathWithName, $PHP_SELF, $_GET, $nn, $bytesReceived, $fs, $fp;
- $status = connection_status();
- if (($status == 2 || $status == 3) && $pathWithName && $bytesReceived > -1) {
+function pause_download() { // To make sure that the files pointers and streams are closed and unlocked.
+ global $PHP_SELF, $fs, $fp, $file, $pathWithName;
+ if (!empty($fs) && is_resource($fs)) {
flock($fs, LOCK_UN);
+ if (get_resource_type($fs) == 'stream') stream_socket_shutdown($fs, STREAM_SHUT_RDWR);
fclose($fs);
+ }
+ if (!empty($fp) && is_resource($fp)) {
+ flock($fp, LOCK_UN);
+ if (get_resource_type($fp) == 'stream') stream_socket_shutdown($fp, STREAM_SHUT_RDWR);
fclose($fp);
}
}
@@ -149,6 +155,7 @@ function html_error($msg, $head = 1) {
else echo ''.lang(13).' ';
echo '';
}
+ pause_download();
include(TEMPLATE_DIR.'footer.php');
exit();
}
@@ -274,7 +281,7 @@ function getfilesize($f) {
global $max_4gb;
if ($max_4gb === false) {
- $tmp_ = trim(@shell_exec(' ls -Ll ' . @escapeshellarg($f)));
+ $tmp_ = trim(@shell_exec('ls -Ll ' . @escapeshellarg($f)));
while(strstr($tmp_, ' ')) $tmp_ = @str_replace(' ', ' ', $tmp_);
$r = @explode(' ', $tmp_);
$size_ = $r[4];
@@ -304,7 +311,7 @@ function getSize($file) {
$size = filesize($file);
if ($size < 0) {
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
- $size = @escapeshellarg($file);
+ $file = @escapeshellarg($file);
$size = trim(`stat -c%s $file`);
} else {
$fsobj = new COM('Scripting.FileSystemObject');
@@ -371,10 +378,10 @@ function link_for_file($filename, $only_link = FALSE, $style = '') {
$Path = FALSE;
if ($only_link) return '';
}
- $basename = htmlentities(basename($filename));
- $Path = htmlentities($Path).'/'.rawurlencode(basename($filename));
+ $basename = htmlspecialchars(basename($filename));
+ $Path = htmlspecialchars($Path).'/'.rawurlencode(basename($filename));
if ($only_link) return 'http://'.urldecode($_SERVER['HTTP_HOST']).$Path;
- elseif ($Path === FALSE) return ''.$basename.' ';
+ elseif ($Path === FALSE) return "$basename ";
else return ''.$basename.' ';
}
@@ -389,7 +396,7 @@ function lang($id) {
#need to keep premium account cookies safe!
function encrypt($string) {
global $secretkey;
- if (!$secretkey) return html_error('Value for $secretkey is empty, please create a random one (56 chars max) in accounts.php!');
+ if (!$secretkey) return html_error('Value for $secretkey is empty, please create a random one (56 chars max) in config.php!');
require_once 'class.pcrypt.php';
/*
@@ -407,7 +414,7 @@ function encrypt($string) {
function decrypt($string) {
global $secretkey;
- if (!$secretkey) return html_error('Value for $secretkey is empty, please create a random one (56 chars max) in accounts.php!');
+ if (!$secretkey) return html_error('Value for $secretkey is empty, please create a random one (56 chars max) in config.php!');
require_once 'class.pcrypt.php';
/*
@@ -429,19 +436,19 @@ function decrypt($string) {
* @param int Column for variable display
* @param int Rows for variable display
* @param bool Options to continue or not process
- * @param string Charset encoding for htmlentities
+ * @param string Charset encoding for htmlspecialchars
*/
function textarea($var, $cols = 100, $rows = 30, $stop = false, $char = 'UTF-8') {
$cols = ($cols == 0) ? 100 : $cols;
$rows = ($rows == 0) ? 30 : $rows;
if ($char === false) $char = 'ISO-8859-1';
echo "\n \n";
if ($stop) exit;
@@ -515,9 +522,7 @@ function is_hex($hex) {
function host_matches($site, $host) {
if (empty($site) || empty($host)) return false;
if (strtolower($site) == strtolower($host)) return true;
- $slen = strlen($site);
- $hlen = strlen($host);
- if (($pos = strripos($host, $site)) !== false && ($pos + $slen == $hlen) && $pos > 1 && substr($host, $pos - 1, 1) == '.') return true;
+ if (($pos = strripos($host, $site)) !== false && ($pos + strlen($site) == strlen($host)) && $pos > 1 && substr($host, $pos - 1, 1) == '.') return true;
return false;
}
@@ -534,7 +539,7 @@ function GetDefaultParams() {
if (isset($_GET['audl'])) $DParam['audl'] = 'doum';
if ($options['download_dir_is_changeable'] && !empty($_GET['path'])) $DParam['saveto'] = urlencode($_GET['path']);
$params = array('add_comment', 'domail', 'comment', 'email', 'split', 'partSize', 'method', 'uploadlater', 'uploadtohost');
- foreach ($params as $key) if (!empty($_GET[$key])) $DParam[$key] = $_GET [$key];
+ foreach ($params as $key) if (!empty($_GET[$key])) $DParam[$key] = $_GET[$key];
return $DParam;
}
diff --git a/classes/sinfo.php b/classes/sinfo.php
index dc84da7..3e52fb1 100644
--- a/classes/sinfo.php
+++ b/classes/sinfo.php
@@ -41,8 +41,9 @@ function checkos() {
}
function winosname() {
$wUnameB = php_uname ( "v" );
- $wUnameBM = php_uname ( "r" );
- $wUnameB = preg_replace ( "@build @i", "", $wUnameB );
+ $wUnameBM = trim( php_uname ( "r" ) );
+ if (preg_match ("@build (\d+)@i", $wUnameB, $build)) $wUnameB = $build[1];
+
if ($wUnameBM == "5.0" && ($wUnameB == "2195")) {
$wVer = "Windows 2000";
}
@@ -52,10 +53,10 @@ function winosname() {
if ($wUnameBM == "5.2" && ($wUnameB == "3790")) {
$wVer = "Windows Server 2003";
}
- if ($wUnameBM == "6.0" && (php_uname ( "v" ) == "build 6000")) {
+ if ($wUnameBM == "6.0" && ($wUnameB == "6000")) {
$wVer = "Windows Vista";
}
- if ($wUnameBM == "6.0" && (php_uname ( "v" ) == "build 6001")) {
+ if ($wUnameBM == "6.0" && ($wUnameB == "6001")) {
$wVer = "Windows Vista SP1";
}
return $wVer;
@@ -93,10 +94,13 @@ function ZahlenFormatieren($Wert) {
$wmi = new COM ( "Winmgmts://" );
$cpus = $wmi->execquery ( "SELECT * FROM Win32_Processor" );
$cpu_string = lang(136).':';
+ $cpu_load = 0;
foreach ( $cpus as $cpu ) {
+ $cpu_load += $cpu->loadpercentage;
$cpu_string .= "" . $cpu->loadpercentage;
}
- $cpu_string .= '% ';
+ $cpu_load /= count($cpus);
+ $cpu_string .= '% ';
} elseif ($os == "linux") {
function getStat($_statPath) {
if (trim ( $_statPath ) == '') {
diff --git a/classes/sorttable.js b/classes/sorttable.js
index f5c64ad..40a922f 100644
--- a/classes/sorttable.js
+++ b/classes/sorttable.js
@@ -27,6 +27,7 @@ sorttable = {
},
makeSortable: function(table) {
+ if (!table) { return; }
if (table.getElementsByTagName('thead').length === 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
diff --git a/configs/.htaccess b/configs/.htaccess
index e30ae10..48bcf38 100644
--- a/configs/.htaccess
+++ b/configs/.htaccess
@@ -1,9 +1,6 @@
order deny,allow
-
-
deny from all
-
-
-deny from all
-
\ No newline at end of file
+
+allow from all
+
diff --git a/configs/accounts.php b/configs/accounts.php
index 7c4f0bf..c1f06c9 100644
--- a/configs/accounts.php
+++ b/configs/accounts.php
@@ -77,9 +77,4 @@
###Auto Download Premium Account###
//$premium_acc["au_dl"] = array('user' => 'your username', 'pass' => 'your password'); # Remove '//' from the beginning and enter your username and password for rapidshare.de premium account
-#Secret key for cookie encryption
-#Make up a random one to protect your premium cookies (max length: 56). Example: 'secretkey' = 'UijSY5wjP1Ii'; - DO NOT use this example 'secretkey', or your premium accounts/cookies could be stolen!!
-#IF THIS IS NOT SET BEFORE YOU USE PREMIUM SERVICES, YOU WILL BE WARNED BY THE RAPIDLEECH SCRIPT. OTHERWISE YOUR PREMIUM ACCOUNTS AND/OR COOKIES COULD BE COMPROMISED!
-$secretkey = '';
-
?>
\ No newline at end of file
diff --git a/configs/default.php b/configs/default.php
index e5d7b8d..9474a54 100644
--- a/configs/default.php
+++ b/configs/default.php
@@ -22,7 +22,6 @@
//Authorization
'login' => false, # false - Authorization mode is off, true - on
'users' => array('test' => 'test'), # false - Authorization mode is off, enter the username and password in the given way
-'login_cgi' => false, # true - Will try to workaround CGI authorization
//Presentation
'template_used' => 'plugmod',
'default_language' => 'en',
@@ -51,19 +50,19 @@
'disable_unzip' => false,
'disable_rar' => false,
'disable_unrar' => false,
-'disable_md5' => false,
+'disable_hashing' => false,
'disable_md5_change' => false,
'disable_list' => false,
//Advanced
+'use_curl' => true, # true - Will use curl instead stream socket client(especially in ssl connection), disable this if filehost refuse data sended by curl. Need curl exec/extension enable in your server
+'redir' => true, # true - Redirect passive method
+'no_cache' => true, # true - Prohibition by Browser; otherwise allowed
+'ref_check' => true, # true - Disallow downloads from external referers. In some hosts this check may give false positives, disable if it doesn't let you download.
'2gb_fix' => true, # true - Try to list files bigger than 2gb on 32 bit o.s.
'forbidden_filetypes' => array('.htaccess', '.htpasswd', '.php', '.php3', '.php4', '.php5', '.phtml', '.asp', '.aspx', '.cgi'), # Enter the forbidden filetypes in the given way
'forbidden_filetypes_block' => false, # false - rename forbidden_filetypes, true - completely block them
'rename_these_filetypes_to' => '.xxx', # If forbidden_filetypes_block = false then rename those filetypes to this
'check_these_before_unzipping' => true, # true - Don't allow extraction/creation of these filetypes from file actions
-'no_cache' => true, # true - Prohibition by Browser; otherwise allowed
-'images_via_php' => false, # true - RapidShare images are downloaded through the script, but it requires ssl support; turn it off if you can't see the image.
-'use_curl' => false, # true - Will use curl instead stream socket client(especially in ssl connection), disable this if filehost refuse data sended by curl. Need curl exec/extension enable in your server
-'redir' => true, # true - Redirect passive method
'fgc' => 0
);
/*Default Options End*/
diff --git a/configs/setup.php b/configs/setup.php
index f759b70..708fc3d 100644
--- a/configs/setup.php
+++ b/configs/setup.php
@@ -21,6 +21,12 @@
if (count($options) == count($default_options)) return;
}
+// Avoid setup page to be cached
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: ' . gmdate ("D, d M Y H:i:s") . 'GMT');
+header('Cache-Control: no-cache, must-revalidate');
+header('Pragma: no-cache');
+
define('TEMPLATE_DIR', 'templates/plugmod/');
//$options['default_language'] = "en";
require_once('classes/other.php');
@@ -29,27 +35,30 @@
Rapidleech Setup
-
+
-
+
@@ -156,42 +160,42 @@ function save_config() {
#opt_login_table thead td { padding-bottom: 5px; }
#opt_login_table td { text-align: center; }
.div_error {
- font-weight: bold; font-size: large; text-align: center; color:#FF0000;
+ font-weight: bold; font-size: large; text-align: center; color:#FF0000;
}
.div_opt {
- text-align: left;
- padding-bottom: 5px;
+ text-align: left;
+ padding-bottom: 5px;
}
.table_cat {
- min-width: 300px;
+ min-width: 300px;
}
.table_opt {
- width: 100%;
+ width: 100%;
}
.div_main {
- text-align: center;
- border: 1px white ridge;
- padding: 5px;
- margin-top:5px;
+ text-align: center;
+ border: 1px white ridge;
+ padding: 5px;
+ margin-top:5px;
}
.div_message {
- color: #FFB000;
- font-weight: bold;
- font-size: larger;
- text-align: center;
- margin: 10px;
+ color: #FFB000;
+ font-weight: bold;
+ font-size: larger;
+ text-align: center;
+ margin: 10px;
}
.div_setup {
- color: #FF7700;
- font-weight: bold;
- font-size: large;
- text-align: center;
+ color: #FF7700;
+ font-weight: bold;
+ font-size: large;
+ text-align: center;
}
.div_title {
- color: #FFB000;
- font-size: larger;
- font-weight: bold;
- margin-bottom: 5px;
+ color: #FFB000;
+ font-size: larger;
+ font-weight: bold;
+ margin-bottom: 5px;
}
-->
@@ -201,72 +205,66 @@ function save_config() {
This page won't work without JavaScript, please enable JavaScript and refresh the page.
$v) { if (!array_key_exists($k, $options)) { $options[$k] = $v; } }
-
- foreach($default_options as $k => $v) {
- if (is_array($default_options[$k])) { continue; }
- if (is_bool($default_options[$k])) {
- $options[$k] = (isset($_POST['opt_'.$k]) && $_POST['opt_'.$k] ? true : false);
- }
- elseif (is_numeric($default_options[$k])) {
- $options[$k] = (isset($_POST['opt_'.$k]) && $_POST['opt_'.$k] ? floor($_POST['opt_'.$k]) : 0);
- }
- else {
- $options[$k] = (isset($_POST['opt_'.$k]) && $_POST['opt_'.$k] ? stripslashes($_POST['opt_'.$k]) : '');
- }
- }
-
- function array_trim(&$v) { $v = trim($v); }
- $tmp = (isset($_POST['opt_forbidden_filetypes']) ? stripslashes($_POST['opt_forbidden_filetypes']) : '');
- $tmp = explode(',', $tmp);
- array_walk($tmp, 'array_trim');
- $tmp = (count($tmp) > 0 && strlen(trim($tmp[0])) > 0 ? $tmp : array());
- $options['forbidden_filetypes'] = $tmp;
-
- $tmp = "\r\n\r\n\r\nRewriteEngine on\r\nRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]\r\n ";
- $htacess = @file_get_contents('.htaccess');
- if (empty($htacess)) { echo 'It was not possible to read .htacess file '; }
- elseif (isset($_POST['opt_login_cgi']) && $_POST['opt_login_cgi']) {
- if (strpos($htacess, $tmp) === false) { if (!@write_file(".htaccess", $htacess.$tmp, 1)) {
- echo 'It was not possible to edit .htacess file to enable CGI authorization fix ';
- $options['login_cgi'] = false;
- }
- }
- }
- else {
- if (strpos($htacess, $tmp) !== false) { if (!@write_file(".htaccess", str_replace($tmp, '', $htacess))) {
- echo 'It was not possible to write .htacess file to completely disable CGI authorization fix ';
- } }
- }
-
- $options['users'] = array();
- if (isset($_POST['users']) && isset($_POST['passwords']) &&
- count($_POST['users']) > 0 && count($_POST['users']) == count($_POST['passwords'])) {
- foreach ($_POST['users'] as $k => $u) {
- $u = stripslashes($u); $p = stripslashes($_POST['passwords'][$k]);
- if ($u == '' && $p == '') { continue; }
- $options['users'][$u] = $p;
- }
- }
- else { echo 'There was a problem with users and passwords '; }
-
- $opt = var_export($options, true);
- $opt = (strpos($opt, "\r\n") === false ? str_replace(array("\r", "\n"), "\r\n", $opt) : $opt);
- $opt = "";
- if (!@write_file(CONFIG_DIR."config.php", $opt, 1)) { echo 'It was not possible to write the configuration Set permissions of "configs" folder to 0777 and try again
'; }
- else {
- if (is_file(CONFIG_DIR.'config_old.php')) { if (@!unlink(CONFIG_DIR.'config_old.php') && is_file(CONFIG_DIR.'config_old.php')) { 'It was not possible to delete the old configuration. Manually delete "configs/config_old.php"
'; } }
- echo 'Configuration saved! Click
here to continue to rapidleech
';
- }
-?>
- $v) if (!array_key_exists($k, $options)) $options[$k] = $v;
+
+ foreach($default_options as $k => $v) {
+ if (is_array($default_options[$k])) continue;
+ if (is_bool($default_options[$k])) $options[$k] = (isset($_POST['opt_'.$k]) && $_POST['opt_'.$k] ? true : false);
+ elseif (is_numeric($default_options[$k])) $options[$k] = (isset($_POST['opt_'.$k]) && $_POST['opt_'.$k] ? floor($_POST['opt_'.$k]) : 0);
+ else $options[$k] = (isset($_POST['opt_'.$k]) && $_POST['opt_'.$k] ? stripslashes($_POST['opt_'.$k]) : '');
+ }
+
+ $tmp = (isset($_POST['opt_forbidden_filetypes']) ? stripslashes($_POST['opt_forbidden_filetypes']) : '');
+ $tmp = array_filter(array_map('trim', explode(',', $tmp)), 'strlen');
+ $options['forbidden_filetypes'] = $tmp;
+
+ $options['users'] = array();
+ if (isset($_POST['users']) && isset($_POST['passwords']) && is_array($_POST['users']) && is_array($_POST['passwords']) && count($_POST['users']) > 0 && count($_POST['users']) == count($_POST['passwords'])) {
+ foreach (array_intersect_key($_POST['users'], $_POST['passwords']) as $k => $u) {
+ if (($u = stripslashes($u)) == '') continue;
+ $p = stripslashes($_POST['passwords'][$k]);
+ $options['users'][$u] = $p;
+ }
+ } else echo 'There was a problem with users and passwords ';
+
+ // Secretkey checks
+ if (empty($options['secretkey'])) {
+ // secure_rand() function from: http://www.zimuel.it/en/strong-cryptography-in-php/
+ function secure_rand($length) {
+ if (function_exists('openssl_random_pseudo_bytes')) {
+ $rnd = openssl_random_pseudo_bytes($length, $strong);
+ if ($strong === TRUE) return $rnd;
+ }
+ $sha = $rnd = '';
+ if (file_exists('/dev/urandom')) {
+ $fp = fopen('/dev/urandom', 'rb');
+ if ($fp) {
+ if (function_exists('stream_set_read_buffer')) stream_set_read_buffer($fp, 0);
+ $sha = fread($fp, $length);
+ fclose($fp);
+ }
+ }
+ for ($i = 0; $i < $length; $i++) {
+ $sha = hash('sha256', $sha.mt_rand(), true);
+ $rnd .= $sha[mt_rand(0, 31)];
+ }
+ return $rnd;
+ }
+ $options['secretkey'] = base64_encode(secure_rand(42));
+ } elseif (strlen($options['secretkey']) > 56) $options['secretkey'] = base64_encode(sha1($options['secretkey']));
+
+ $opt = var_export($options, true);
+ $opt = (strpos($opt, "\r\n") === false ? str_replace(array("\r", "\n"), "\r\n", $opt) : $opt);
+ $opt = "";
+ if (!@write_file(CONFIG_DIR."config.php", $opt, 1)) echo 'It was not possible to write the configuration Set permissions of "configs" folder to 0777 and try again
';
+ else {
+ if (is_file(CONFIG_DIR.'config_old.php')) { if (@!unlink(CONFIG_DIR.'config_old.php') && is_file(CONFIG_DIR.'config_old.php')) { 'It was not possible to delete the old configuration. Manually delete "configs/config_old.php"
'; } }
+ echo 'Configuration saved! Click
here to continue to rapidleech
';
+ }
+} else {
?>
Rapidleech Setup
@@ -274,216 +272,211 @@ function array_trim(&$v) { $v = trim($v); }
-
-
\ No newline at end of file
+
+exit("