Commit a7a1edb6 authored by Gabor Hudiczius's avatar Gabor Hudiczius
Browse files

rtwi-0.2.3-080131

parent 49fafb4c
requirements:
-rtorrent 0.7.8, compiled with "--with-xmlrpc-c"
-rtorrent 0.8.0, compiled with "--with-xmlrpc-c"
-xmlrpc >= 1.07
-some webserver
-php5, with the following extensions:
......@@ -24,18 +24,18 @@ follow the next steps, as root (this step is not needed, if you're upgrading fro
to install libtorrent, follow the next steps, as root:
mkdir /usr/src/libtorrent
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.11.9.tar.gz
tar xvf libtorrent-0.11.9.tar.gz
cd /usr/src/libtorrent-0.11.9
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.0.tar.gz
tar xvf libtorrent-0.12.0.tar.gz
cd /usr/src/libtorrent-0.12.0
./configure
make
make install
to install rtorrent, follow the next steps, as root:
mkdir /usr/src/rtorrent
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.7.9.tar.gz
tar xvf rtorrent-0.7.9.tar.gz
cd /usr/src/rtorrent-0.7.9
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.0.tar.gz
tar xvf rtorrent-0.8.0.tar.gz
cd /usr/src/rtorrent-0.8.0
./configure --with-xmlrpc-c
make
make install
......
<?php
class xmlrpc_handler {
var $socket;
var $host;
var $port;
var $timeout;
var $request;
var $response;
var $calls;
var $mcalls;
var $times;
var $mtimes;
function __construct( $xmlrpc_array ) {
if ( isset( $xmlrpc_array["socket"] ) ) {
$this->socket = $xmlrpc_array["socket"];
} else {
$this->host = $xmlrpc_array["host"];
$this->port = $xmlrpc_array["port"];
}
$this->timeout = $xmlrpc_array["timeout"];
$this->request = null;
$this->response = null;
$this->calls = 0;
$this->mcalls = 0;
}
function setmrequest( $methods, $params = array() ) {
$this->request = array();
foreach ( $methods as $methodkey => $methodval ) {
$this->request[] = array( "methodName" => $methodval, "params" => $params );
}
$this->request = xmlrpc_encode_request( "system.multicall", array( $this->request ) );
}
function setrequest( $method, $attributes ) {
$this->request = xmlrpc_encode_request( $method, $attributes );
}
function call() {
$st = getmicrotime();
$len = strlen( $this->request );
$headers = "CONTENT_LENGTH\0{$len}\0";
$headers .= "SCGI\01\0";
$len = strlen( $headers );
$out = "{$len}:{$headers},{$this->request}";
if ( isset( $this->socket ) ) {
$fp = fsockopen( "unix://{$this->socket}", $this->port, $errno, $errstr, $this->timeout );
} else {
$fp = fsockopen( $this->host, $this->port, $errno, $errstr, $this->timeout );
}
if ( $fp ) {
fwrite( $fp, $out );
do {
$line = fgets( $fp );
} while ( trim( $line ) != "" );
if ( ( $this->response = stream_get_contents( $fp ) ) !== false ) {
$tt = getmicrotime();
$this->calls++;
$this->times = $this->times + $tt - $st;
return true;
} else {
$tt = getmicrotime();
$this->calls++;
$this->times = $this->times + $tt - $st;
return false;
}
} else {
$tt = getmicrotime();
$this->calls++;
$this->times = $this->times + $tt - $st;
return false;
}
}
function parse() {
$this->response = preg_replace( "/i8|ex\.i8/", "string", $this->response );
if ( ( $this->response = xmlrpc_decode( $this->response ) ) !== false ) {
return true;
} else {
return false;
}
}
function mfetch( $methods ) {
$r = -1;
$responses = array();
//print_r( $this->response );
foreach ( $methods as $methodkey => $methodval ) {
if ( $methodval[1] == "." ) {
$prefix = substr( $methodval, 0, 1 );
$methodval = substr( $methodval, 5 );
$methodval = "{$prefix}{$methodval}";
} elseif ( strlen( $methodval ) > 6 && $methodval[6] == "." ) {
$prefix = substr( $methodval, 0, 1 );
$methodval = substr( $methodval, 7 );
$methodval = "{$methodval}";
} elseif ( $methodval == "view_list" ) {
} elseif ( substr( $methodval, 0, 3 ) == "dht" ) {
} else {
$methodval = substr( $methodval, 4 );
}
$r++;
if ( isset( $this->response[$r]["faultCode"] ) && isset( $this->response[$r]["faultString"] ) ) {
print "(Error: {$response[$r]["faultCode"]} {$this->response[$r]["faultString"]})<br />\r\n";
} else {
if ( $methodval == "dht_statistics" ) {
foreach ( $this->response[$r][0] as $dkey => $dval ) {
$responses["{$methodval}_{$dkey}"] = $dval;
}
} else {
$responses[$methodval] = $this->response[$r][0];
}
}
}
return $responses;
}
function fetch() {
return $this->response;
}
}
?>
......@@ -36,14 +36,14 @@ $users = array(
* other settings
*******************************/
// do a directory tree - set to false (witouth the quotes), if your webserver is running on a slow machine, and you have torrents with a lots of files (a few hundreds)
// do a directory tree - set to "false" (witouth the quotes), if your webserver is running on a slow machine, and you have torrents with a lots of files (a few hundreds)
$config["dodirtree"] = true;
// true if ajax is allowed
$config["allow"]["ajax"] = true;
// true if dht is enabled
$config["allow"]["dht"] = true;
$config["allow"]["dht"] = false;
// true if users are allowed to download finished files from the webui
$config["allow"]["download"] = true;
......@@ -54,6 +54,9 @@ $config["allow"]["erase"] = true;
// true if hiding the filelist is allowed
$config["allow"]["hidedirtree"] = true;
// true if users are allowed to set the language of the web interface
$config["allow"]["language"] = true;
// true if users are allowed to set a meta-refresh interval
$config["allow"]["refresh"] = true;
......
......@@ -38,8 +38,12 @@ $message = array(
"nopriorityfound" => "No priority was given",
"badpriorityfound" => "Bad priority was given",
"noviewtype" => "No view was given",
"badviewtype" => "Bad view was given",
"norefreshrate" => "No refresh rate was given",
"badrefreshrate" => "Bad refresh rate was given",
"nolanguage" => "No language was given",
"badlanguage" => "Bad language was given (no translation is available for this language)",
"succtorrentload" => "Torrent loaded",
"succtorrentstart" => "Torrent started",
......@@ -63,6 +67,7 @@ $message = array(
"succtrackerenabledchange" => "Tracker availablity changed",
"succviewchange" => "View changed",
"succrefreshchange" => "Refresh rate changed",
"succlanguagechange" => "Language changed",
"succdhtstart" => "DHT server started",
"succdhtstop" => "DHT server stopped",
......@@ -71,15 +76,6 @@ $message = array(
"refreshnotallowed" => "You are not allowed to set a meta-refresh interval",
"throttlenotallowed" => "You are not allowed to set throttle",
"viewtype_main" => "Main",
"viewtype_name" => "Name",
"viewtype_started" => "Started",
"viewtype_stopped" => "Stopped",
"viewtype_complete" => "Complete",
"viewtype_incomplete" => "Incomplete",
"viewtype_hashing" => "Hashing",
"viewtype_seeding" => "Seeding",
"no" => "No",
"yes" => "Yes",
"disabled" => "Disabled",
......@@ -112,45 +108,67 @@ $message = array(
"d_priority_3" => "High",
"d_state_0" => "Stopped",
"d_state_1" => "Started",
"f_is_open_0" => "Closed",
"f_is_open_1" => "Open",
"f_open_0" => "Closed",
"f_open_1" => "Open",
"f_priority_0" => "Off",
"f_priority_1" => "Normal",
"f_priority_2" => "High",
"p_encrypted_0" => "Plain",
"p_encrypted_1" => "Encrypted",
"p_incoming_0" => "Outgoing",
"p_incoming_1" => "Incoming",
"t_enabled_0" => "Disabled",
"t_enabled_1" => "Enabled",
"t_open_0" => "Closed",
"t_open_1" => "Open",
"t_type_1" => "TCP",
"t_type_2" => "UDP",
"dht_0" => "Stopped",
"dht_1" => "Started",
"bind_0000" => "All IP addresses",
"ip_0000" => "Not set",
"proxy_address_0000" => "Not set",
);
$refresh = array(
$viewtypes = array(
"viewtype_main" => "Main",
"viewtype_default" => "Default",
"viewtype_name" => "Name",
"viewtype_started" => "Started",
"viewtype_stopped" => "Stopped",
"viewtype_complete" => "Complete",
"viewtype_incomplete" => "Incomplete",
"viewtype_hashing" => "Hashing",
"viewtype_seeding" => "Seeding",
"viewtype_scheduler" => "Scheduler",
);
$refreshrates = array(
"refreshrate_0" => "Off",
"refreshrate_60" => "1 minute",
"refreshrate_120" => "2 minutes",
"refreshrate_180" => "3 minutes",
"refreshrate_300" => "5 minutes",
"refreshrate_600" => "10 minutes",
"refreshrate_420" => "7 minutes",
"refreshrate_900" => "15 minutes",
"refreshrate_1200" => "20 minutes",
"refreshrate_1500" => "25 minutes",
);
$languages = array(
"en" => "English",
"hu" => "Hungarian",
);
$label = array(
// html head
"title" => "rTWi - The rTorrent Web interface",
"description" => "rTWi - The rTorrent Web interface",
"keywords" => "rTWi - The rTorrent Web interface",
"author" => "Gabor Hudiczius",
"mailto" => "ghudiczius@gmail.com?subject=rTWi - The rTorrent Web interface",
// login
"username" => "Username",
"password" => "Password",
"rememberme" => "Remember me",
"login" => "Login",
// menu
......@@ -179,10 +197,16 @@ $label = array(
"selectviewtype" => "Select view type",
"refresh" => "Refresh",
"selectrefreshrate" => "Select refresh rate",
"language" => "Language",
"selectlanguage" => "Select language",
"areyousure" => "Are you sure?",
"areyousureerase" => "Are you sure? All downloaded data will be erased.",
"homepage" => "rTWi project homepage",
"highest" => "highest",
// add torrent
"openfrom" => "Open from",
"fileupload" => "File upload",
......@@ -292,6 +316,9 @@ $label = array(
"freediskspace" => "Free diskspace",
"connectiontype" => "Connection type",
"trackers" => "Trackers",
"peersconnected" => "Peers connected",
"dmaxpeers" => "Maximum",
"dminpeers" => "Minimum",
"leechers" => "Leechers",
"seeders" => "Seeders",
"pexenabled" => "PEX enabled",
......@@ -307,11 +334,13 @@ $label = array(
"downloaddirectory" => "Download directory",
"sessiondirectory" => "Session directory",
"hostname" => "Hostname",
"pid" => "PID",
"listeningipaddress" => "Listening IP address",
"reportedipaddress" => "IP address reported to the tracker",
"portopened" => "Port opened",
"randomport" => "Random port",
"portrange" => "Port range",
"udptrackers" => "Use UDP trackers",
"changedhtstatus" => "Start/stop DHT server",
"dht" => "DHT server",
"dhtport" => "DHT port",
......@@ -334,6 +363,17 @@ $label = array(
"sendbuffer" => "Send buffer",
"receivebuffer" => "Receive buffer",
// peer list page
"address" => "Address",
"port" => "Port",
"up_rate" => "Up",
"down_rate" => "Down",
"peer_rate" => "Peer",
"pdone" => "Done",
"encrypted" => "Encrypted",
"incoming" => "Connection",
"pclientversion" => "Client version",
// tracker list page
"focus" => "Focus",
"enabled" => "Enabled",
......
......@@ -38,8 +38,12 @@ $message = array(
"nopriorityfound" => "Nincs prioritás megadva",
"badpriorityfound" => "Hibás prioritás",
"noviewtype" => "Nincs megadva nézet",
"badviewtype" => "Hibás nézet",
"norefreshrate" => "Nincs megadva intervallum",
"badrefreshrate" => "Hibás frissítési intervallum",
"nolanguage" => "Nincs megadva nyelv",
"badlanguage" => "Nincs ilyen nyelvi file",
"succtorrentload" => "Torrent betöltve",
"succtorrentstart" => "Torrent elindítva",
......@@ -63,6 +67,7 @@ $message = array(
"succtrackerenabledchange" => "Tracker elérhetősége beállítva",
"succviewchange" => "Nézet beállítva",
"succrefreshchange" => "Frissítés beállítva",
"succlanguagechange" => "Nyelv beállítva",
"succdhtstart" => "DHT szerver elindítva",
"succdhtstop" => "DHT szerver leállítva",
......@@ -71,15 +76,6 @@ $message = array(
"refreshnotallowed" => "Nem vagy jogosult frissítés beállítására",
"throttlenotallowed" => "Nem vagy jogosult sebességkorlát beállítására",
"viewtype_main" => "Alapértelmezett",
"viewtype_name" => "Név szerint",
"viewtype_started" => "Elindított torrentek",
"viewtype_stopped" => "Leállított torrentek",
"viewtype_complete" => "Befejezett torrentek",
"viewtype_incomplete" => "Befejezetlen torrentek",
"viewtype_hashing" => "Ellenőrzés alatt álló torrentek",
"viewtype_seeding" => "Feltöltések",
"no" => "Nem",
"yes" => "Igen",
"disabled" => "Letiltva",
......@@ -112,45 +108,67 @@ $message = array(
"d_priority_3" => "Magas",
"d_state_0" => "Leállítva",
"d_state_1" => "Elindítva",
"f_is_open_0" => "Zárva",
"f_is_open_1" => "Nyitva",
"f_open_0" => "Zárva",
"f_open_1" => "Nyitva",
"f_priority_0" => "Leállítva",
"f_priority_1" => "Normál",
"f_priority_2" => "Magas",
"p_encrypted_0" => "Sima",
"p_encrypted_1" => "Titkosított",
"p_incoming_0" => "Kimenő",
"p_incoming_1" => "Bejövő",
"t_enabled_0" => "Letiltva",
"t_enabled_1" => "Engedélyezve",
"t_open_0" => "Zárva",
"t_open_1" => "Nyitva",
"t_type_1" => "TCP",
"t_type_2" => "UDP",
"dht_0" => "Leállítva",
"dht_1" => "Elindítva",
"bind_0000" => "Minden IP cím",
"ip_0000" => "Nincs beállítva",
"proxy_address_0000" => "Nincs beállítva",
);
$refresh = array(
$viewtypes = array(
"viewtype_main" => "Fő nézet",
"viewtype_default" => "Alapértelmezett",
"viewtype_name" => "Név szerint",
"viewtype_started" => "Elindított torrentek",
"viewtype_stopped" => "Leállított torrentek",
"viewtype_complete" => "Befejezett torrentek",
"viewtype_incomplete" => "Befejezetlen torrentek",
"viewtype_hashing" => "Ellenőrzés alatt álló torrentek",
"viewtype_seeding" => "Feltöltések",
"viewtype_scheduler" => "A nemlétező ütemező",
);
$refreshrates = array(
"refreshrate_0" => "Letiltva",
"refreshrate_60" => "1 perc",
"refreshrate_120" => "2 perc",
"refreshrate_180" => "3 perc",
"refreshrate_300" => "5 perc",
"refreshrate_600" => "10 perc",
"refreshrate_420" => "7 perc",
"refreshrate_900" => "15 perc",
"refreshrate_1200" => "20 perc",
"refreshrate_1500" => "25 perc",
);
$languages = array(
"en" => "Angol",
"hu" => "Magyar",
);
$label = array(
// html head
"title" => "rTWi - Az rTorrent Web interfész",
"description" => "rTWi - Az rTorrent Web interfész",
"keywords" => "rTWi - Az rTorrent Web interfész",
"author" => "Hudiczius Gábor",
"mailto" => "ghudiczius@gmail.com?subject=rTWi - Az rTorrent Web interfész",
// login
"username" => "Felhasználó",
"password" => "Jelszó",
"rememberme" => "Jegyezz meg",
"login" => "Belépés",
// menu
......@@ -179,10 +197,16 @@ $label = array(
"selectviewtype" => "Válassz megjelenítést",
"refresh" => "Frissítés",
"selectrefreshrate" => "Válassz frissítési időközt",
"language" => "Nyelv",
"selectlanguage" => "Válassz nyelvet",
"areyousure" => "Biztosan törlöd?",
"areyousureerase" => "Biztosan törlöd? Minden letöltött adat törlésre kerül.",
"homepage" => "rTWi honlap",
"highest" => "legmagasabb",
// add torrent
"openfrom" => "Megnyitás",
"fileupload" => "Fájlfeltöltéssel",
......@@ -292,6 +316,9 @@ $label = array(
"freediskspace" => "Szabad lemezterület",
"connectiontype" => "Kapcsolat tipusa",
"trackers" => "Trackerek száma",
"peersconnected" => "Kapcsolódott peer-ek",
"dmaxpeers" => "Maximum",
"dminpeers" => "Minimum",
"leechers" => "Letöltők száma",
"seeders" => "Feltöltők száma",
"pexenabled" => "PEX engedélyezve",
......@@ -307,11 +334,13 @@ $label = array(
"downloaddirectory" => "Letöltési könyvtár",
"sessiondirectory" => "Munkamenet könyvtár",
"hostname" => "Hosztnév",
"pid" => "PID",
"listeningipaddress" => "Kapcsolatot fogadó IP cím",
"reportedipaddress" => "Tracker felé jelentett IP cím",
"portopened" => "Nyitott port",
"randomport" => "Véletlen port",
"portrange" => "Porttartomány",
"udptrackers" => "UDP tracker-ek használata",
"changedhtstatus" => "DHT szerver elindítása/leállítása",
"dht" => "DHT szerver",
"dhtport" => "DHT port",
......@@ -334,6 +363,17 @@ $label = array(
"sendbuffer" => "Kimeneti puffer",
"receivebuffer" => "Bejövő puffer",
// peer list page
"address" => "IP cím",
"port" => "Port",
"up_rate" => "Fel",
"down_rate" => "Le",
"peer_rate" => "Peer",
"pdone" => "Kész",
"encrypted" => "Titkosítás",
"incoming" => "Kapcsolat",
"pclientversion" => "Kliens verziószám",
// tracker list page
"focus" => "Fókusz",
"enabled" => "Engedélyezve",
......
This diff is collapsed.
......@@ -57,10 +57,12 @@ if ( isset( $_REQUEST["hash"] ) ) {
$hash = "";
}
if ( ( !isset( $_SESSION["rtwi_auth"] ) || $_SESSION["rtwi_auth"] !== 1 ) && $_REQUEST["mod"] != "login" ) {
header( "location: {$url["index"]}" );
exit;
} elseif ( $_REQUEST["mod"] != "login" ) {
if ( ( !isset( $_SESSION["rtwi_auth"] ) || $_SESSION["rtwi_auth"] !== 1 ) ) {
if ( $_REQUEST["mod"] != "login" && $_REQUEST["mod"] != "changelanguage" ) {
header( "location: {$url["index"]}" );
exit;
}
} else {
$xmlrpc_array["port"] = $users[$_SESSION["rtwi_nick"]]["port"];
}
......@@ -83,6 +85,11 @@ switch ( $_REQUEST["mod"] ) {
$xmlrpc_array["port"] = $users[$_SESSION["rtwi_nick"]]["port"];
if ( isset( $_REQUEST["rememberme"] ) && $_REQUEST["rememberme"] == "on" ) {
setcookie( "rtwi_auth", 1, time() + 60 * 60 * 24 * 365 );
setcookie( "rtwi_nick", $_REQUEST["loginname"], time() + 60 * 60 * 24 * 365 );
}
$_SESSION["rtwi_err"] = "succlogin";
header( "location: {$url["index"]}" );
exit;
......@@ -100,12 +107,17 @@ switch ( $_REQUEST["mod"] ) {
$_SESSION["rtwi_port"] = 0;
$_SESSION["rtwi_view"] = "";
$_SESSION["rtwi_refresh"] = 0;
$_SESSION["rtwi_language"] = "";
unset( $_SESSION["rtwi_auth"] );
unset( $_SESSION["rtwi_nick"] );
unset( $_SESSION["rtwi_port"] );
unset( $_SESSION["rtwi_view"] );
unset( $_SESSION["rtwi_refresh"] );
unset( $_SESSION["rtwi_language"] );
setcookie( "rtwi_auth", 0 );
setcookie( "rtwi_nick", "" );
$_SESSION["rtwi_err"] = "succlogout";
header( "location: {$url["index"]}" );
......@@ -115,39 +127,17 @@ switch ( $_REQUEST["mod"] ) {
}
case "changeview" : { // change view
if ( isset( $_REQUEST["viewtype"] ) && $_REQUEST["viewtype"] != "" ) {
switch ( $_REQUEST["viewtype"] ) {
case "name" : {
$_SESSION["rtwi_view"] = "name";
break;
}
case "started" : {
$_SESSION["rtwi_view"] = "started";
break;
}
case "stopped" : {
$_SESSION["rtwi_view"] = "stopped";
break;
}
case "complete" : {
$_SESSION["rtwi_view"] = "complete";
break;
}
case "incomplete" : {
$_SESSION["rtwi_view"] = "incomplete";
break;
}
case "hashing" : {
$_SESSION["rtwi_view"] = "hashing";
break;
}
case "seeding" : {
$_SESSION["rtwi_view"] = "seeding";
break;
}
default : {
$_SESSION["rtwi_view"] = "default";
break;
}
$request = xmlrpc_encode_request( "view_list", array() );
$response = xmlrpc_call( $xmlrpc_array, $request, $callnum,