TorrentFlux.com Hey, OppTupacShakur, you have 11 messages, 0 are new.
06-27-2007, 12:42:22
Home Help Search Profile Logout donate chat
News:


+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.1 Hacks
| | |-+  unRAR Hack
« previous next »
Pages: 1 2 [All] Go Down Reply Notify of replies Send this topic Print
Author Topic: unRAR Hack  (Read 5995 times)
Bandi
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 87



View Profile Email Personal Message (Offline)
« on: 04-10-2006, 09:23:13 » Reply with quote

Hello,

This is my old v2.0 Hack for unRARing Files directly on your Box! I've tested it on 2 Systems and it is also working with Version v2.1 It works like the SFV Check hack! It will still unRAR your files when you close the Window!

First step is to download unRAR from http://www.rarlabs.com/ to you Box! If you have trouble with older OS and the newest Version use an older one Tongue

Write this in dir.php where you want the unRAR Button to appear
Code:
if(false !== ($rar = unRAR($dirName.$entry)))
{
echo '<a href="javascript:unRAR(\''.
$rar[dir] . '\',\''.$rar[rar].'\')"><img '.
'src="images/rar_enabled.gif" border="0" '.
'width=16 height=16 alt="unrar files"></a>';
} else {
echo '<img src="images/rar_disabled.gif" border="0" width=16 height=16 alt="no rar found">';
}

In functions.php right after the <?
Code:
//**************************************************************************
// unRAR()
// This method Builds and displays the Torrent Section of the Index Page
function unRAR($dirName)
{
$rar = false;
$d = dir($dirName);
while (false !== ($entry = $d->read()))
{
    if($entry != '.' && $entry != '..' && !empty($entry) )
    {
    if(is_file($dirName.'/'.$entry) && substr($entry, -4, 4) == '.rar')
    {
    $rar[dir] = $dirName;
$rar[rar] = $dirName.'/'.$entry;
    }
    }
}
$d->close();
return $rar;
}

The Rest comes after the <META> Tag at the start of DisplayHead in functions.php
Code:
<script type="text/javascript">
 function unRAR(dir,file) {
     var width = screen.width/2-300;
     var height = screen.height/2-300;
     var InfoWin = window.open("unRAR.php?dir="+dir+"&file="+file, "unRAR",
"status=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,width=500,height=300,left="+width+",top="+height);

}
</script>

That's all

Then download the unrar.php and the two Pictures - Both attached Wink
Don't forget to edit the Path to your unrar File in your unrar.php
This sould be all! Make sure that your unrar File is executable!

MfG Bandi


* rar_disabled.gif (0.54 KB, 16x16 - viewed 843 times.)

* rar_enabled.gif (0.65 KB, 16x16 - viewed 834 times.)
* unRAR.php (0.77 KB - downloaded 147 times.)
« Last Edit: 04-10-2006, 09:31:14 by Bandi » Report to moderator   Logged
kanchke
Newbie
*
Offline Offline

Posts: 24




View Profile Personal Message (Offline)
« Reply #1 on: 04-13-2006, 06:17:06 » Reply with quote

 Huh? Huh? Huh?

Could you give some more details please on howto install this hack ?

Quote
Write this in dir.php where you want the unRAR Button to appear

  ... their like 514 lines of code (seems to be written all in chinese to me) and I have no clue where to copy/paste this code, where did you put it ?

Quote
In functions.php right after the <?
  this is even worse, 2568 lines with a lot of <? first comes best served ?

Quote
The Rest comes after the <META> Tag at the start of DisplayHead in functions.php
  Ok, this is clear to me Wink

thanx,
k.
Report to moderator   Logged

P3 733 | FreeBSD6.0 | 128MB RAM

Lighttpd 1.4.11 | PHP 5.1.2 (cgi-fcgi) | Postgres8.1 | Python 2.3.4

TF 2.1 w/ AJAX on indexpage| MRTG statistics
Paczesiowa
Full Member
***
Offline Offline

TF Base: Linux 2.x
Posts: 177



View Profile Email Personal Message (Offline)
« Reply #2 on: 04-13-2006, 10:06:34 » Reply with quote

check this hack: http://www.torrentflux.com/forum/index.php/topic,603.0.html
Report to moderator   Logged

deags
Full Member
***
Offline Offline

Posts: 118



View Profile Personal Message (Offline)
« Reply #3 on: 04-13-2006, 13:03:19 » Reply with quote

thanks mate it is all working Smiley
Report to moderator   Logged
lysip
Jr. Member
**
Offline Offline

Posts: 53


lysip92

View Profile Email Personal Message (Offline)
« Reply #4 on: 04-15-2006, 03:18:23 » Reply with quote

Does my unrar hack work well still in 2.1? there might be some changes in where you place code but who knows.
Report to moderator   Logged

CentOS 4.2 (kernel: 2.6.9-22.ELsmp)
TorrentFlux version - 2.1
Python version - 2.4.1
PHP Version - 4.3.9
Webserver software and version - Apache 2.0
Add-ons/Hacks - rememberme, multiup
ridewitme
Newbie
*
Offline Offline

Posts: 27


God of English





View Profile Personal Message (Offline)
« Reply #5 on: 04-15-2006, 07:41:41 » Reply with quote

Does my unrar hack work well still in 2.1? there might be some changes in where you place code but who knows.

Nope, works fine in 2.1 without changing the place of code, just have to modify the 2.1 dir.php with your code, can't use a previous dir.php from 2.0
Report to moderator   Logged
kahfau
Newbie
*
Offline Offline

Posts: 5



View Profile Personal Message (Offline)
« Reply #6 on: 04-15-2006, 15:03:32 » Reply with quote

hi all Smiley

first of all: great software, great hacks, great forum Shocked

i have a feature request for the unrar hack. is there any possibility to add a specific target dir? would be cool to press the unrar button, then in the pop-up-window you can enter a target dir and press a go button or something.

unfortunately i'm not firm in php, so any advice would be nice.

regards
-kahfau
Report to moderator   Logged
Bandi
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 87



View Profile Email Personal Message (Offline)
« Reply #7 on: 04-17-2006, 06:15:39 » Reply with quote

Maybe comming in a newer Version...
Report to moderator   Logged
lysip
Jr. Member
**
Offline Offline

Posts: 53


lysip92

View Profile Email Personal Message (Offline)
« Reply #8 on: 04-17-2006, 20:01:01 » Reply with quote

Yes, thats easily possible except its not really worth it to do... Mine atm is probley the most robust solution.

http://www.torrentflux.com/forum/index.php/topic,603.0.html

it still works, i havnt had a reason to look into it again... a better way of exacuting a command from php would be prefrable.
Report to moderator   Logged

CentOS 4.2 (kernel: 2.6.9-22.ELsmp)
TorrentFlux version - 2.1
Python version - 2.4.1
PHP Version - 4.3.9
Webserver software and version - Apache 2.0
Add-ons/Hacks - rememberme, multiup
kahfau
Newbie
*
Offline Offline

Posts: 5



View Profile Personal Message (Offline)
« Reply #9 on: 04-22-2006, 03:04:24 » Reply with quote

@lysip

this didn't solve my prob. it still extracts the rar/zip into the flux-dir, not asking me for a specific extracting path (like the specific save path)  Huh?

-kahfau
Report to moderator   Logged
Bandi
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 87



View Profile Email Personal Message (Offline)
« Reply #10 on: 04-22-2006, 13:41:29 » Reply with quote

Nobody said, that the other hack does!
Report to moderator   Logged
olhoore
Newbie
*
Offline Offline

Posts: 1



View Profile Personal Message (Offline)
« Reply #11 on: 04-23-2006, 10:57:29 » Reply with quote

I got the message when trying to view directory:

Fatal error: Call to a member function on a non-object in $PATH of flux/functions.php on line 74

Line 74 is part of the new code

Code:
//**************************************************************************
// unRAR()
// This method Builds and displays the Torrent Section of the Index Page
function unRAR($dirName)
{
$rar = false;
$d = dir($dirName);
while (false !== ($entry = $d->read()))
{
    if($entry != '.' && $entry != '..' && !empty($entry) )
    {
    if(is_file($dirName.'/'.$entry) && substr($entry, -4, 4) == '.rar')
    {
    $rar[dir] = $dirName;
$rar[rar] = $dirName.'/'.$entry;
    }
    }
}
$d->close();
return $rar;
}

in detail the line: while (false !== ($entry = $d->read()))

Can anybody help me please? Sad

Maybe I misplaced the code? I added it at the functions area in the functions.php, I don't know what <? is meant by the original poster...

Report to moderator   Logged
kahfau
Newbie
*
Offline Offline

Posts: 5



View Profile Personal Message (Offline)
« Reply #12 on: 04-24-2006, 02:36:54 » Reply with quote

Nobody said, that the other hack does!

sry, I misunderstood lysip's post...
Report to moderator   Logged
Bandi
Jr. Member
**
Offline Offline

TF Base: Linux 2.x
Posts: 87



View Profile Email Personal Message (Offline)
« Reply #13 on: 04-24-2006, 10:21:36 » Reply with quote

Maybe I misplaced the code? I added it at the functions area in the functions.php, I don't know what <? is meant by the original poster...

<? shows the Start of a PHP Code! You must set this Code right after this one or between 2 other one! Actually you can't miss it Wink
Report to moderator   Logged
skks
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 5



View Profile Personal Message (Offline)
« Reply #14 on: 04-24-2006, 13:11:48 » Reply with quote

Does my unrar hack work well still in 2.1?

Works but stops TF from responding for using other functions (like browsing the directory, adding torrents etc.) while it's extracting an archive. This was normal in 2.0, you could only do one thing at a time - but in 2.1 it's no longer so.

However, the unrar function saves a lot of time and I'd rather have it this way than not working at all. Great work regardless.
Report to moderator   Logged
lysip
Jr. Member
**
Offline Offline

Posts: 53


lysip92

View Profile Email Personal Message (Offline)
« Reply #15 on: 04-30-2006, 20:44:59 » Reply with quote

Well im not sure how tf does it but i suspect they place a link in a dir for you to directly download from. yet again im not sure tho.  i beleave the reason it hangs atm is because my hack creates a thread inside apaches process, yet again this is just my hunch, i havnt researched it at all.
Report to moderator   Logged

CentOS 4.2 (kernel: 2.6.9-22.ELsmp)
TorrentFlux version - 2.1
Python version - 2.4.1
PHP Version - 4.3.9
Webserver software and version - Apache 2.0
Add-ons/Hacks - rememberme, multiup
xyster
Newbie
*
Offline Offline

Posts: 27



View Profile Personal Message (Offline)
« Reply #16 on: 05-02-2006, 09:09:50 » Reply with quote

Thnx to dergs, i was havving trouble with this.

he made it work, woohoo, i love him Cheesy

in a non gay way Cheesy
Report to moderator   Logged
puttyman
Jr. Member
**
Offline Offline

Posts: 59



View Profile Personal Message (Offline)
« Reply #17 on: 05-15-2006, 00:33:22 » Reply with quote

Is there a way to rar a downloaded directory/file instead of unraring ?

I need an inverse of this hax  Huh?  ..
« Last Edit: 05-15-2006, 14:34:25 by puttyman » Report to moderator   Logged
MeneM
Newbie
*
Offline Offline

Posts: 1



View Profile Personal Message (Offline)
« Reply #18 on: 05-20-2006, 18:05:39 » Reply with quote

Hi,

I tried this hack as well, but I'm getting stuck at adding the function. I've tried a few places inside the fucntions.php file, but I always get the same error:
Code:
Fatal error: Call to a member function read() on a non-object in /usr/share/torrentflux/www/functions.ph

I know what
Code:
<?php ?>
does, but where exactly do I need to add ar append to already existing tags?

Thanks,
Mark
Report to moderator   Logged
gardar
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 9

seed whore



View Profile Personal Message (Offline)
« Reply #19 on: 08-21-2006, 17:56:46 » Reply with quote

I was trying this out and obviously doing something wrong because if I open a directory that includes rar files it seems to be empty  Roll Eyes
I guess I'm placing this code at the wrong place
Code:
if(false !== ($rar = unRAR($dirName.$entry)))
{
echo '<a href="javascript:unRAR(\''.
$rar[dir] . '\',\''.$rar[rar].'\')"><img '.
'src="images/rar_enabled.gif" border="0" '.
'width=16 height=16 alt="unrar files"></a>';
} else {
echo '<img src="images/rar_disabled.gif" border="0" width=16 height=16 alt="no rar found">';
}
Where do you recommend I should place it?
Report to moderator   Logged

RedHat Linux
TorrentFlux 2.1
1gbit up/down
outsider
Newbie
*
Offline Offline

TF Base: Linux 2.x
Posts: 4



View Profile Personal Message (Offline)
« Reply #20 on: 09-18-2006, 20:54:46 » Reply with quote

The Rest comes after the <META> Tag at the start of DisplayHead in functions.php
Code:
<script type="text/javascript">
 function unRAR(dir,file) {
     var width = screen.width/2-300;
     var height = screen.height/2-300;
     var InfoWin = window.open("unRAR.php?dir="+dir+"&file="+file, "unRAR",
"status=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,width=500,height=300,left="+width+",top="+height);

}
</script>
I can't find any <META> or DisplayHeader in functions.php
Am I missing something?
Report to moderator   Logged
Beowulf
Newbie
*
Offline Offline

Posts: 28



View Profile Email Personal Message (Offline)
« Reply #21 on: 02-09-2007, 19:48:02 » Reply with quote

Is there a solution for this fault?

I got the message when trying to view directory:

Fatal error: Call to a member function on a non-object in $PATH of flux/functions.php on line 74

Line 74 is part of the new code

Code:
//**************************************************************************
// unRAR()
// This method Builds and displays the Torrent Section of the Index Page
function unRAR($dirName)
{
$rar = false;
$d = dir($dirName);
while (false !== ($entry = $d->read()))
{
    if($entry != '.' && $entry != '..' && !empty($entry) )
    {
    if(is_file($dirName.'/'.$entry) && substr($entry, -4, 4) == '.rar')
    {
    $rar[dir] = $dirName;
$rar[rar] = $dirName.'/'.$entry;
    }
    }
}
$d->close();
return $rar;
}

in detail the line: while (false !== ($entry = $d->read()))

Can anybody help me please? Sad

Maybe I misplaced the code? I added it at the functions area in the functions.php, I don't know what <? is meant by the original poster...



I think the failure occures in connection with $d but as far as I am not proffesional with php I cannot get out the fault on my own.
Report to moderator   Logged
martijn
Newbie
*
Offline Offline

Posts: 1



View Profile Personal Message (Offline)
« Reply #22 on: 05-22-2007, 07:24:19 » Reply with quote

Does this work with 2.3 as well?
Report to moderator   Logged
ares0027
Newbie
*
Offline Offline

Posts: 10



View Profile Email Personal Message (Offline)
« Reply #23 on: 06-09-2007, 19:11:43 » Reply with quote

if you can make unrar hack i think you can make a rar hack too right?

i need to rar/zip and split my files and save them to my ftp.is  that possible?
Report to moderator   Logged
deags
Full Member
***
Offline Offline

Posts: 118



View Profile Personal Message (Offline)
« Reply #24 on: 06-10-2007, 07:59:44 » Reply with quote

i'll have a poke around and see if i can make anything for ya bud. Simple parameters like size and bytes to split them into... new or old naming system?
Report to moderator   Logged
ares0027
Newbie
*
Offline Offline

Posts: 10



View Profile Email Personal Message (Offline)
« Reply #25 on: 06-10-2007, 08:40:59 » Reply with quote

old i think
Report to moderator   Logged
deags
Full Member
***
Offline Offline

Posts: 118



View Profile Personal Message (Offline)
« Reply #26 on: 06-10-2007, 09:45:40 » Reply with quote

okay here it is 100% stolen code Cheesy


find this in functions.php
Code:
// ***************************************************************************
// ***************************************************************************
// Display the header portion of admin views
function DisplayHead($subTopic, $showButtons=true, $refresh="", $percentdone="")
{
    global $cfg;
    ?>

    <html>
    <HEAD>
        <TITLE><?php echo $percentdone.$cfg["pagetitle"] ?></TITLE>
        <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
        <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
        <LINK REL="StyleSheet" HREF="themes/<?php echo $cfg["theme"] ?>/style.css" TYPE="text/css">
        <META HTTP-EQUIV="Pragma" CONTENT="no-cache" charset="<?php echo _CHARSET ?>">
Now add this underneath
Code:
<script type="text/javascript">
 function RAR(dir,file) {
     var width = screen.width/2-300;
     var height = screen.height/2-300;
     var InfoWin = window.open("RARget.php?dir="+dir+"&file="+file, "RAR",
"status=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,width=550,height=400,left="+width+",top="+height);

}
</script>

In dir.php find this
Code:
                if ($cfg["enable_file_download"])
                {
                    // Yes, let them download
                    echo "<a href=\"dir.php?down=".urlencode($dir.$entry)."\" >";
                    echo "<img src=\"".$image."\" width=\"16\" height=\"16\" alt=\"".$entry."\" border=\"0\"></a>";
                    echo "<a href=\"dir.php?down=".urlencode($dir.$entry)."\" >".$entry."</a>";
                }
                else
                {
                    // No, just show the name
                    echo "<img src=\"".$image."\" width=\"16\" height=\"16\" alt=\"".$entry."\" border=\"0\">";
                    echo $entry;
                }
replace it with
Code:
                if ($cfg["enable_file_download"])
                {
                    // Yes, let them download
                    echo "<a href=\"dir.php?down=".urlencode($dir.$entry)."\" >";
                    echo "<img src=\"".$image."\" width=\"16\" height=\"16\" alt=\"".$entry."\" border=\"0\"></a>";
                    echo "<a href=\"dir.php?down=".urlencode($dir.$entry)."\" >".$entry."</a>";
                    echo ' <a href="javascript:RAR(\''.
$dirName.''.$entry . '\',\''.$dirName.''.$entry.'\')"><font color="red">RAR</font></a>';
                }
                else
                {
                    // No, just show the name
                    echo "<img src=\"".$image."\" width=\"16\" height=\"16\" alt=\"".$entry."\" border=\"0\">";
                    echo $entry;
                                        echo ' <a href="javascript:RAR(\''.
$dirName.''.$entry . '\',\''.$dirName.''.$entry.'\')"><font color="red">RAR</font></a>';
                }

Now just download this file and place it in the same directory as dir.php
http://home.graffiti.net/biglou/TF/RARget.php

Change the $path_to_rar variable in RARget.php to suite your server.

Possibly add some more sizes.



Here is RAR(if needed)
http://home.graffiti.net/biglou/TF/f4m0700a.zip
« Last Edit: 06-10-2007, 09:47:36 by deags » Report to moderator   Logged
Pages: 1 2 [All] Go Up Reply Notify of replies Send this topic Print 
« previous next »
Jump to:  


Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP