summaryrefslogtreecommitdiffstats
path: root/plugins/webinterface
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/webinterface')
-rw-r--r--plugins/webinterface/Makefile.am34
-rw-r--r--plugins/webinterface/httpclienthandler.cpp237
-rw-r--r--plugins/webinterface/httpclienthandler.h87
-rw-r--r--plugins/webinterface/httpresponseheader.cpp78
-rw-r--r--plugins/webinterface/httpresponseheader.h51
-rw-r--r--plugins/webinterface/httpserver.cpp561
-rw-r--r--plugins/webinterface/httpserver.h105
-rw-r--r--plugins/webinterface/ktwebinterfaceplugin.desktop22
-rw-r--r--plugins/webinterface/ktwebinterfaceplugin.kcfg41
-rw-r--r--plugins/webinterface/php_handler.cpp128
-rw-r--r--plugins/webinterface/php_handler.h61
-rw-r--r--plugins/webinterface/php_interface.cpp486
-rw-r--r--plugins/webinterface/php_interface.h68
-rw-r--r--plugins/webinterface/webinterfaceplugin.cpp128
-rw-r--r--plugins/webinterface/webinterfaceplugin.h55
-rw-r--r--plugins/webinterface/webinterfacepluginsettings.kcfgc7
-rw-r--r--plugins/webinterface/webinterfacepref.ui254
-rw-r--r--plugins/webinterface/webinterfaceprefpage.cpp60
-rw-r--r--plugins/webinterface/webinterfaceprefpage.h55
-rw-r--r--plugins/webinterface/webinterfaceprefwidget.cpp137
-rw-r--r--plugins/webinterface/webinterfaceprefwidget.h42
-rw-r--r--plugins/webinterface/www/Makefile.am5
-rw-r--r--plugins/webinterface/www/coldmilk/Makefile.am8
-rw-r--r--plugins/webinterface/www/coldmilk/favicon.icobin1406 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icon.pngbin24064 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/edit_user.pngbin954 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/high_priority.pngbin217 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/low_priority.pngbin215 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/normal_priority.pngbin195 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/only_seed.pngbin212 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/exit.pngbin1397 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/ktstart_all.pngbin1400 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/ktstop_all.pngbin1130 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/remove.pngbin1522 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/start.pngbin1221 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/stop.pngbin963 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/configure.pngbin1510 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/extender_opened.pngbin1310 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/fileopen.pngbin1861 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/folder1.pngbin2275 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/48x48/exit.pngbin2935 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/48x48/switchuser.pngbin3109 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/down.pngbin5413 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/folder1_man.pngbin5452 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.pngbin5467 -> 0 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/Makefile.am1
-rw-r--r--plugins/webinterface/www/coldmilk/interface.js44
-rw-r--r--plugins/webinterface/www/coldmilk/interface.php251
-rw-r--r--plugins/webinterface/www/coldmilk/login.html55
-rw-r--r--plugins/webinterface/www/coldmilk/page_update.js429
-rw-r--r--plugins/webinterface/www/coldmilk/rest.php265
-rw-r--r--plugins/webinterface/www/coldmilk/shutdown.php21
-rw-r--r--plugins/webinterface/www/coldmilk/style.css212
-rw-r--r--plugins/webinterface/www/default/Makefile.am9
-rw-r--r--plugins/webinterface/www/default/details.php89
-rw-r--r--plugins/webinterface/www/default/favicon.icobin1406 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/grad1.jpgbin367 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/grad2.jpgbin362 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/header_tile.pngbin167 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/high_priority.pngbin217 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/icon.pngbin24064 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/interface.php152
-rw-r--r--plugins/webinterface/www/default/ktorrentwebinterfacelogo.pngbin90590 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/login.html29
-rw-r--r--plugins/webinterface/www/default/low_priority.pngbin215 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/menu_bg.pngbin249 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/normal_priority.pngbin195 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/only_seed.pngbin212 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/remove.pngbin1040 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/shutdown.php13
-rw-r--r--plugins/webinterface/www/default/start.pngbin869 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/stop.pngbin710 -> 0 bytes
-rw-r--r--plugins/webinterface/www/default/style.css13
-rw-r--r--plugins/webinterface/www/default/stylen.css164
-rw-r--r--plugins/webinterface/www/default/wz_tooltip.js509
-rw-r--r--plugins/webinterface/www/mobile/Makefile.am8
-rw-r--r--plugins/webinterface/www/mobile/favicon.icobin1406 -> 0 bytes
-rw-r--r--plugins/webinterface/www/mobile/interface.php113
-rw-r--r--plugins/webinterface/www/mobile/ktorrentwebinterfacelogo.pngbin90590 -> 0 bytes
-rw-r--r--plugins/webinterface/www/mobile/login.html24
-rw-r--r--plugins/webinterface/www/mobile/remove.pngbin1040 -> 0 bytes
-rw-r--r--plugins/webinterface/www/mobile/settings.php44
-rw-r--r--plugins/webinterface/www/mobile/start.pngbin869 -> 0 bytes
-rw-r--r--plugins/webinterface/www/mobile/stop.pngbin710 -> 0 bytes
-rw-r--r--plugins/webinterface/www/mobile/torrent.php91
90 files changed, 0 insertions, 5276 deletions
diff --git a/plugins/webinterface/Makefile.am b/plugins/webinterface/Makefile.am
deleted file mode 100644
index 6626957..0000000
--- a/plugins/webinterface/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-INCLUDES = -I$(top_srcdir)/libktorrent -I$(top_builddir)/libktorrent $(all_includes)
-
-METASOURCES = AUTO
-kde_module_LTLIBRARIES = ktwebinterfaceplugin.la
-noinst_HEADERS = webinterfaceplugin.h httpserver.h php_handler.h \
- php_interface.h webinterfaceprefwidget.h webinterfaceprefpage.h httpclienthandler.h \
- httpresponseheader.h
-ktwebinterfaceplugin_la_SOURCES = webinterfaceplugin.cpp httpserver.cpp \
- php_handler.cpp php_interface.cpp webinterfacepref.ui \
- webinterfacepluginsettings.kcfgc webinterfaceprefwidget.cpp webinterfaceprefpage.cpp \
- httpclienthandler.cpp httpresponseheader.cpp
-# Libs needed by the plugin
-ktwebinterfaceplugin_la_LIBADD = ../../libktorrent/libktorrent.la \
- $(LIB_TDEHTML) $(LIB_TDEPARTS) $(LIB_TQT) \
- $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_TDEFILE)
-
-# LD flags for the plugin
-# -module says: this is a module, i.e. something you're going to dlopen
-# so e.g. it has no version number like a normal shared lib would have.
-ktwebinterfaceplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
-
-# rc file containing the GUI for the plugin
-# pluginsdir = $(kde_datadir)/ktsearchplugin
-# plugins_DATA = ktsearchpluginui.rc
-
-# Install the desktop file needed to detect the plugin
-kde_services_DATA = ktwebinterfaceplugin.desktop
-
-kde_kcfg_DATA = ktwebinterfaceplugin.kcfg
-
-ktdatadir = $(kde_datadir)/ktorrent/www
-
-SUBDIRS = www
-KDE_CXXFLAGS = $(USE_EXCEPTIONS) $(USE_RTTI)
diff --git a/plugins/webinterface/httpclienthandler.cpp b/plugins/webinterface/httpclienthandler.cpp
deleted file mode 100644
index bc2a4f6..0000000
--- a/plugins/webinterface/httpclienthandler.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <tqsocket.h>
-#include <tqhttp.h>
-#include <util/log.h>
-#include <util/mmapfile.h>
-#include "httpserver.h"
-#include "httpclienthandler.h"
-#include "httpresponseheader.h"
-#include "php_handler.h"
-
-using namespace bt;
-
-namespace kt
-{
-
- HttpClientHandler::HttpClientHandler(HttpServer* srv,TQSocket* sock) : srv(srv),client(sock),php_response_hdr(200)
- {
- state = WAITING_FOR_REQUEST;
- bytes_read = 0;
- php = 0;
- }
-
-
- HttpClientHandler::~HttpClientHandler()
- {
- delete client;
- delete php;
- }
-
- void HttpClientHandler::readyToRead()
- {
- if (state == WAITING_FOR_REQUEST)
- {
- while (client->canReadLine())
- {
- TQString line = client->readLine();
- header_data += line;
- if (header_data.endsWith("\r\n\r\n"))
- {
- // We have got the header, so lets parse it
- handleRequest();
- break;
- }
- }
- }
- else if (state == WAITING_FOR_CONTENT)
- {
- Uint32 ba = client->bytesAvailable();
- if (ba + bytes_read < header.contentLength())
- {
- client->readBlock((char*)request_data.data() + bytes_read,ba);
- bytes_read += ba;
- }
- else
- {
- Uint32 left = header.contentLength() - bytes_read;
- client->readBlock((char*)request_data.data() + bytes_read,left);
- bytes_read += left;
- srv->handlePost(this,header,request_data);
-
- header_data = "";
- request_data.resize(0);
- state = WAITING_FOR_REQUEST;
- if (client->bytesAvailable() > 0)
- readyToRead();
- }
- }
- }
-
- void HttpClientHandler::handleRequest()
- {
- header = TQHttpRequestHeader(header_data);
- // Out(SYS_WEB|LOG_DEBUG) << "Parsing request : " << header.toString() << endl;
- if (header.method() == "POST")
- {
- if (header.hasContentLength())
- {
- request_data.resize(header.contentLength());
- state = WAITING_FOR_CONTENT;
- bytes_read = 0;
- if (client->bytesAvailable() > 0)
- readyToRead();
- }
- }
- else if (header.method() == "GET")
- {
- srv->handleGet(this,header);
- header_data = "";
- request_data.resize(0);
- }
- else
- {
- srv->handleUnsupportedMethod(this);
- }
- }
-
- bool HttpClientHandler::sendFile(HttpResponseHeader & hdr,const TQString & full_path)
- {
- // Out(SYS_WEB|LOG_DEBUG) << "Sending file " << full_path << endl;
- // first look in cache
- MMapFile* c = srv->cacheLookup(full_path);
-
- if (!c)
- {
- // not in cache so load it
- c = new MMapFile();
- if (!c->open(full_path,MMapFile::READ))
- {
- delete c;
- Out(SYS_WEB|LOG_DEBUG) << "Failed to open file " << full_path << endl;
- return false;
- }
- srv->insertIntoCache(full_path,c);
- }
-
- hdr.setValue("Content-Length",TQString::number(c->getSize()));
-
- // Out(SYS_WEB|LOG_DEBUG) << "HTTP header : " << endl;
- // Out(SYS_WEB|LOG_DEBUG) << hdr.toString() << endl;
-
- TQCString d = hdr.toString().utf8();
- client->writeBlock(d.data(),d.length());
-
- Uint32 written = 0;
- Uint32 total = c->getSize();
- const char* data = (const char*)c->getDataPointer();
- while (written < total)
- {
- Uint32 w = client->writeBlock(data + written,total - written);
- written += w;
- }
- client->flush();
- // Out(SYS_WEB|LOG_DEBUG) << "Finished sending " << full_path << " (" << written << " bytes)" << endl;
- return true;
- }
-
-#define HTTP_404_ERROR "<html><head><title>404 Not Found</title></head><body>The requested file was not found !</body></html>"
-#define HTTP_500_ERROR "<html><head><title>HTTP/1.1 500 Internal Server Error</title></head><body>HTTP/1.1 Internal Server Error<br>%1</body></html>"
-
-
- void HttpClientHandler::send404(HttpResponseHeader & hdr,const TQString & path)
- {
- // Out(SYS_WEB|LOG_DEBUG) << "Sending 404 " << path << endl;
- TQString data = HTTP_404_ERROR;
- hdr.setValue("Content-Length",TQString::number(data.length()));
-
- TQTextStream os(client);
- os.setEncoding( TQTextStream::UnicodeUTF8 );
- os << hdr.toString();
- os << data;
- }
-
- void HttpClientHandler::send500(HttpResponseHeader & hdr)
- {
- // Out(SYS_WEB|LOG_DEBUG) << "Sending 500 " << endl;
- TQString data = TQString(HTTP_500_ERROR).arg("An internal server error occured !");
- hdr.setValue("Content-Length",TQString::number(data.length()));
-
- TQTextStream os(client);
- os.setEncoding( TQTextStream::UnicodeUTF8 );
- os << hdr.toString();
- os << data;
- }
-
- void HttpClientHandler::sendResponse(const HttpResponseHeader & hdr)
- {
- // Out(SYS_WEB|LOG_DEBUG) << "Sending response " << hdr.toString() << endl;
- TQTextStream os(client);
- os.setEncoding( TQTextStream::UnicodeUTF8 );
- os << hdr.toString();
- }
-
- void HttpClientHandler::executePHPScript(
- PhpInterface* php_iface,
- HttpResponseHeader & hdr,
- const TQString & php_exe,
- const TQString & php_file,
- const TQMap<TQString,TQString> & args)
- {
- // Out(SYS_WEB|LOG_DEBUG) << "Launching PHP script " << php_file << endl;
- php = new PhpHandler(php_exe,php_iface);
- if (!php->executeScript(php_file,args))
- {
- TQString data = TQString(HTTP_500_ERROR).arg("Failed to launch PHP executable !");
- hdr.setResponseCode(500);
- hdr.setValue("Content-Length",TQString::number(data.utf8().length()));
-
- TQTextStream os(client);
- os.setEncoding( TQTextStream::UnicodeUTF8 );
- os << hdr.toString();
- os << data;
- state = WAITING_FOR_REQUEST;
- }
- else
- {
- php_response_hdr = hdr;
- connect(php,TQ_SIGNAL(finished()),this,TQ_SLOT(onPHPFinished()));
- state = PROCESSING_PHP;
- }
- }
-
- void HttpClientHandler::onPHPFinished()
- {
- const TQByteArray & output = php->getOutput();
- php_response_hdr.setValue("Content-Length",TQString::number(output.size()));
-
- TQTextStream os(client);
- os.setEncoding( TQTextStream::UnicodeUTF8 );
- os << php_response_hdr.toString();
- os.writeRawBytes(output.data(),output.size());
-
- php->deleteLater();
- php = 0;
- state = WAITING_FOR_REQUEST;
- }
-}
-
-#include "httpclienthandler.moc"
-
diff --git a/plugins/webinterface/httpclienthandler.h b/plugins/webinterface/httpclienthandler.h
deleted file mode 100644
index 8afbc39..0000000
--- a/plugins/webinterface/httpclienthandler.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef KTHTTPCLIENTHANDLER_H
-#define KTHTTPCLIENTHANDLER_H
-
-
-#include <tqhttp.h>
-#include <tqobject.h>
-#include <util/constants.h>
-#include "httpresponseheader.h"
-
-class TQSocket;
-
-
-namespace kt
-{
- class HttpServer;
- class PhpHandler;
- class PhpInterface;
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class HttpClientHandler : public TQObject
- {
- TQ_OBJECT
-
- enum State
- {
- WAITING_FOR_REQUEST,
- WAITING_FOR_CONTENT,
- PROCESSING_PHP
- };
- public:
- HttpClientHandler(HttpServer* srv,TQSocket* sock);
- virtual ~HttpClientHandler();
-
- void readyToRead();
- bool sendFile(HttpResponseHeader & hdr,const TQString & full_path);
- void sendResponse(const HttpResponseHeader & hdr);
- void send404(HttpResponseHeader & hdr,const TQString & path);
- void send500(HttpResponseHeader & hdr);
-
- void executePHPScript(PhpInterface* php_iface,
- HttpResponseHeader & hdr,
- const TQString & php_exe,
- const TQString & php_file,
- const TQMap<TQString,TQString> & args);
-
- private:
- void handleRequest();
-
- private slots:
- void onPHPFinished();
-
- private:
- HttpServer* srv;
- TQSocket* client;
- State state;
- TQHttpRequestHeader header;
- TQString header_data;
- TQByteArray request_data;
- bt::Uint32 bytes_read;
- PhpHandler* php;
- HttpResponseHeader php_response_hdr;
- };
-
-}
-
-#endif
diff --git a/plugins/webinterface/httpresponseheader.cpp b/plugins/webinterface/httpresponseheader.cpp
deleted file mode 100644
index 3056f79..0000000
--- a/plugins/webinterface/httpresponseheader.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include "httpresponseheader.h"
-
-namespace kt
-{
- static TQString ResponseCodeToString(int r)
- {
- switch (r)
- {
- case 200: return "OK";
- case 301: return "Moved Permanently";
- case 304: return "Not Modified";
- case 404: return "Not Found";
- }
- return TQString();
- }
-
- HttpResponseHeader::HttpResponseHeader(int response_code)
- : response_code(response_code)
- {
- }
-
- HttpResponseHeader::HttpResponseHeader(const HttpResponseHeader & hdr)
- {
- response_code = hdr.response_code;
- fields = hdr.fields;
- }
-
- HttpResponseHeader::~HttpResponseHeader()
- {
- }
-
- void HttpResponseHeader::setResponseCode(int rc)
- {
- response_code = rc;
- }
-
- void HttpResponseHeader::setValue(const TQString & key,const TQString & value)
- {
- fields[key] = value;
- }
-
- TQString HttpResponseHeader::toString() const
- {
- TQString str;
- str += TQString("HTTP/1.1 %1 %2\r\n").arg(response_code).arg(ResponseCodeToString(response_code));
-
- TQMap<TQString,TQString>::const_iterator itr = fields.begin();
- while (itr != fields.end())
- {
- str += TQString("%1: %2\r\n").arg(itr.key()).arg(itr.data());
- itr++;
- }
- str += "\r\n";
- return str;
- }
-
-
-
-}
diff --git a/plugins/webinterface/httpresponseheader.h b/plugins/webinterface/httpresponseheader.h
deleted file mode 100644
index 417fe6b..0000000
--- a/plugins/webinterface/httpresponseheader.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Joris Guisson *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef KTHTTPRESPONSEHEADER_H
-#define KTHTTPRESPONSEHEADER_H
-
-
-#include <tqmap.h>
-#include <tqstring.h>
-
-namespace kt
-{
-
- /**
- @author Joris Guisson <[email protected]>
- */
- class HttpResponseHeader
- {
- int response_code;
- TQMap<TQString,TQString> fields;
- public:
- HttpResponseHeader(int response_code);
- HttpResponseHeader(const HttpResponseHeader & hdr);
- virtual ~HttpResponseHeader();
-
- void setResponseCode(int response_code);
- void setValue(const TQString & key,const TQString & value);
-
- TQString toString() const;
- };
-
-
-}
-
-#endif
diff --git a/plugins/webinterface/httpserver.cpp b/plugins/webinterface/httpserver.cpp
deleted file mode 100644
index 0860903..0000000
--- a/plugins/webinterface/httpserver.cpp
+++ /dev/null
@@ -1,561 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <tqtimer.h>
-#include <tqcstring.h>
-#include <tqdatetime.h>
-#include <tdeapplication.h>
-#include <kgenericfactory.h>
-#include <tdeglobal.h>
-#include <tdestandarddirs.h>
-#include <kmdcodec.h>
-#include <tdetempfile.h>
-
-#include <tqfileinfo.h>
-#include <tqsocket.h>
-#include <tqstringlist.h>
-
-#include <interfaces/coreinterface.h>
-#include <interfaces/torrentinterface.h>
-
-#include <util/log.h>
-#include <util/fileops.h>
-#include <util/functions.h>
-#include <util/mmapfile.h>
-#include "ktversion.h"
-#include "httpserver.h"
-#include "httpclienthandler.h"
-#include "httpresponseheader.h"
-#include "php_handler.h"
-#include "php_interface.h"
-#include "webinterfacepluginsettings.h"
-
-using namespace bt;
-
-namespace kt
-{
-
-
-
- HttpServer::HttpServer(CoreInterface *core, int port) : TQServerSocket(port, 5),core(core),cache(10,23)
- {
- php_i = new PhpInterface(core);
- clients.setAutoDelete(true);
-
- TQStringList dirList = TDEGlobal::instance()->dirs()->findDirs("data", "ktorrent/www");
- rootDir = *(dirList.begin());
- Out(SYS_WEB|LOG_DEBUG) << "WWW Root Directory "<< rootDir <<endl;
- session.logged_in = false;
- cache.setAutoDelete(true);
- }
-
- HttpServer::~HttpServer()
- {
- delete php_i;
- }
-
- void HttpServer::newConnection(int s)
- {
- TQSocket* socket = new TQSocket(this);
- socket->setSocket(s);
-
- connect(socket, TQ_SIGNAL(readyRead()), this, TQ_SLOT(slotSocketReadyToRead()));
- connect(socket, TQ_SIGNAL(delayedCloseFinished()), this, TQ_SLOT(slotConnectionClosed()));
- connect(socket, TQ_SIGNAL(connectionClosed()), this, TQ_SLOT(slotConnectionClosed()));
-
- HttpClientHandler* handler = new HttpClientHandler(this,socket);
- clients.insert(socket,handler);
- Out(SYS_WEB|LOG_NOTICE) << "connection from "<< TQString(socket->peerAddress().toString()) << endl;
- }
-
-
- void HttpServer::slotSocketReadyToRead()
- {
- TQSocket* client = (TQSocket*)sender();
- HttpClientHandler* handler = clients.find(client);
- if (!handler)
- {
- client->deleteLater();
- return;
- }
-
- handler->readyToRead();
- }
-
- static int DecodeEscapedChar(TQString & password,int idx)
- {
- TQChar a = password[idx + 1].lower();
- TQChar b = password[idx + 2].lower();
- if (!a.isNumber() && !(a.latin1() >= 'a' && a.latin1() <= 'f'))
- return idx + 2; // not a valid hex digit
-
- if (!b.isNumber() && !(b.latin1() >= 'a' && b.latin1() <= 'f'))
- return idx + 2; // not a valid hex digit
-
- // calculate high and low nibble
- Uint8 h = (a.latin1() - (a.isNumber() ? '0' : 'a')) << 4;
- Uint8 l = (b.latin1() - (b.isNumber() ? '0' : 'a'));
- char r = (char) h | l; // combine them and cast to a char
- password.replace(idx,3,r);
- return idx + 1;
- }
-
- bool HttpServer::checkLogin(const TQHttpRequestHeader & hdr,const TQByteArray & data)
- {
- if (hdr.contentType() != "application/x-www-form-urlencoded")
- return false;
-
- TQString username;
- TQString password;
- TQStringList params = TQStringList::split("&",TQString(data));
- for (TQStringList::iterator i = params.begin();i != params.end();i++)
- {
- TQString t = *i;
- if (t.section("=",0,0) == "username")
- username = t.section("=",1,1);
- else if (t.section("=",0,0) == "password")
- password = t.section("=",1,1);
-
- // check for passwords with url encoded stuff in them and decode them if necessary
- int idx = 0;
- while ((idx = password.find('%',idx)) > 0)
- {
- if (idx + 2 < password.length())
- {
- idx = DecodeEscapedChar(password,idx);
- }
- else
- break;
- }
- }
-
- if (!username.isNull() && !password.isNull())
- {
- KMD5 context(password.utf8());
-
- if(username == WebInterfacePluginSettings::username() &&
- context.hexDigest().data() == WebInterfacePluginSettings::password())
- {
- session.logged_in = true;
- session.sessionId=rand();
- session.last_access=TQTime::currentTime();
- Out(SYS_WEB|LOG_NOTICE) << "Webgui login succesfull !" << endl;
- return true;
- }
- }
-
- return false;
- }
-
- bool HttpServer::checkSession(const TQHttpRequestHeader & hdr)
- {
- // check session in cookie
- int session_id = 0;
- if (hdr.hasKey("Cookie"))
- {
- TQString cookie = hdr.value("Cookie");
- int idx = cookie.find("KT_SESSID=");
- if (idx == -1)
- return false;
-
- TQString number;
- idx += TQString("KT_SESSID=").length();
- while (idx < cookie.length())
- {
- if (cookie[idx] >= '0' && cookie[idx] <= '9')
- number += cookie[idx];
- else
- break;
-
- idx++;
- }
-
- session_id = number.toInt();
- }
-
-
- if (session_id == session.sessionId)
- {
- // check if the session hasn't expired yet
- if(session.last_access.secsTo(TQTime::currentTime())<WebInterfacePluginSettings::sessionTTL())
- {
- session.last_access=TQTime::currentTime();
- }
- else
- {
- return false;
- }
- }
- else
- return false;
-
- return true;
- }
-
- static TQString ExtensionToContentType(const TQString & ext)
- {
- if (ext == "html")
- return "text/html";
- else if (ext == "css")
- return "text/css";
- else if (ext == "js")
- return "text/javascript";
- else if (ext == "gif" || ext == "png" || ext == "ico")
- return "image/" + ext;
- else
- return TQString();
- }
-
- // HTTP needs non translated dates
- static TQString days[] = {
- "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
- };
-
- static TQString months[] = {
- "Jan","Feb","Mar","Apr",
- "May","Jun","Jul","Aug",
- "Sep","Oct","Nov","Dec"
- };
-
- static TQString DateTimeToString(const TQDateTime & now,bool cookie)
- {
- if (!cookie)
- return now.toString("%1, dd %2 yyyy hh:mm:ss UTC")
- .arg(days[now.date().dayOfWeek() - 1])
- .arg(months[now.date().month() - 1]);
- else
- return now.toString("%1, dd-%2-yyyy hh:mm:ss GMT")
- .arg(days[now.date().dayOfWeek() - 1])
- .arg(months[now.date().month() - 1]);
- }
-
- void HttpServer::setDefaultResponseHeaders(HttpResponseHeader & hdr,const TQString & content_type,bool with_session_info)
- {
- hdr.setValue("Server","KTorrent/" KT_VERSION_MACRO);
- hdr.setValue("Date",DateTimeToString(TQDateTime::currentDateTime(TQt::UTC),false));
- hdr.setValue("Content-Type",content_type);
- hdr.setValue("Connection","keep-alive");
- if (with_session_info && session.sessionId && session.logged_in)
- {
- hdr.setValue("Set-Cookie",TQString("KT_SESSID=%1").arg(session.sessionId));
- }
- }
-
- void HttpServer::redirectToLoginPage(HttpClientHandler* hdlr)
- {
- HttpResponseHeader rhdr(301);
- setDefaultResponseHeaders(rhdr,"text/html",false);
- rhdr.setValue("Location","/login.html");
- TQString path = rootDir + bt::DirSeparator() + WebInterfacePluginSettings::skin() + "/login.html";
- if (!hdlr->sendFile(rhdr,path))
- {
- HttpResponseHeader nhdr(404);
- setDefaultResponseHeaders(nhdr,"text/html",false);
- hdlr->send404(nhdr,path);
- }
- Out(SYS_WEB|LOG_NOTICE) << "Redirecting to /login.html" << endl;
- }
-
- void HttpServer::handleGet(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,bool do_not_check_session)
- {
- TQString file = hdr.path();
- if (file == "/")
- file = "/login.html";
-
- //Out(SYS_WEB|LOG_DEBUG) << "GET " << hdr.path() << endl;
-
- KURL url;
- url.setEncodedPathAndQuery(file);
-
- TQString path = rootDir + bt::DirSeparator() + WebInterfacePluginSettings::skin() + url.path();
- // first check if the file exists (if not send 404)
- if (!bt::Exists(path))
- {
- HttpResponseHeader rhdr(404);
- setDefaultResponseHeaders(rhdr,"text/html",false);
- hdlr->send404(rhdr,path);
- return;
- }
-
- TQFileInfo fi(path);
- TQString ext = fi.extension();
-
- // if it is the login page send that
- if (file == "/login.html" || file == "/")
- {
- session.logged_in = false;
- ext = "html";
- path = rootDir + bt::DirSeparator() + WebInterfacePluginSettings::skin() + "/login.html";
- }
- else if (!session.logged_in && (ext == "html" || ext == "php"))
- {
- // for any html or php page, a login is necessary
- redirectToLoginPage(hdlr);
- return;
- }
- else if (session.logged_in && !do_not_check_session && (ext == "html" || ext == "php"))
- {
- // if we are logged in and it's a html or php page, check the session id
- if (!checkSession(hdr))
- {
- session.logged_in = false;
- // redirect to login page
- redirectToLoginPage(hdlr);
- return;
- }
- }
-
- if (ext == "html")
- {
- HttpResponseHeader rhdr(200);
- setDefaultResponseHeaders(rhdr,"text/html",true);
- if (path.endsWith("login.html"))
- {
- // clear cookie in case of login page
- TQDateTime dt = TQDateTime::currentDateTime().addDays(-1);
- TQString cookie = TQString("KT_SESSID=666; expires=%1 +0000").arg(DateTimeToString(dt,true));
- rhdr.setValue("Set-Cookie",cookie);
- }
-
- if (!hdlr->sendFile(rhdr,path))
- {
- HttpResponseHeader nhdr(404);
- setDefaultResponseHeaders(nhdr,"text/html",false);
- hdlr->send404(nhdr,path);
- }
- }
- else if (ext == "css" || ext == "js" || ext == "png" || ext == "ico" || ext == "gif" || ext == "jpg")
- {
- if (hdr.hasKey("If-Modified-Since"))
- {
- TQDateTime dt = parseDate(hdr.value("If-Modified-Since"));
- if (dt.isValid() && dt < fi.lastModified())
- {
- HttpResponseHeader rhdr(304);
- setDefaultResponseHeaders(rhdr,"text/html",true);
- rhdr.setValue("Cache-Control","max-age=0");
- rhdr.setValue("Last-Modified",DateTimeToString(fi.lastModified(),false));
- rhdr.setValue("Expires",DateTimeToString(TQDateTime::currentDateTime(TQt::UTC).addSecs(3600),false));
- hdlr->sendResponse(rhdr);
- return;
- }
- }
-
-
- HttpResponseHeader rhdr(200);
- setDefaultResponseHeaders(rhdr,ExtensionToContentType(ext),true);
- rhdr.setValue("Last-Modified",DateTimeToString(fi.lastModified(),false));
- rhdr.setValue("Expires",DateTimeToString(TQDateTime::currentDateTime(TQt::UTC).addSecs(3600),false));
- rhdr.setValue("Cache-Control","private");
- if (!hdlr->sendFile(rhdr,path))
- {
- HttpResponseHeader nhdr(404);
- setDefaultResponseHeaders(nhdr,"text/html",false);
- hdlr->send404(nhdr,path);
- }
- }
- else if (ext == "php")
- {
- bool redirect = false;
- bool shutdown = false;
- if (url.queryItems().count() > 0 && session.logged_in)
- redirect = php_i->exec(url,shutdown);
-
- if (shutdown)
- {
- // first send back login page
- redirectToLoginPage(hdlr);
- TQTimer::singleShot(1000,tdeApp,TQ_SLOT(quit()));
- }
- else if (redirect)
- {
- HttpResponseHeader rhdr(301);
- setDefaultResponseHeaders(rhdr,"text/html",true);
- rhdr.setValue("Location",url.encodedPathAndQuery());
-
- hdlr->executePHPScript(php_i,rhdr,WebInterfacePluginSettings::phpExecutablePath(),
- path,url.queryItems());
- }
- else
- {
- HttpResponseHeader rhdr(200);
- setDefaultResponseHeaders(rhdr,"text/html",true);
-
- hdlr->executePHPScript(php_i,rhdr,WebInterfacePluginSettings::phpExecutablePath(),
- path,url.queryItems());
- }
- }
- else
- {
- HttpResponseHeader rhdr(404);
- setDefaultResponseHeaders(rhdr,"text/html",false);
- hdlr->send404(rhdr,path);
- }
- }
-
- void HttpServer::handlePost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data)
- {
- // this is either a file or a login
- if (hdr.value("Content-Type").startsWith("multipart/form-data"))
- {
- handleTorrentPost(hdlr,hdr,data);
- }
- else if (!checkLogin(hdr,data))
- {
- TQHttpRequestHeader tmp = hdr;
- tmp.setRequest("GET","/login.html",1,1);
- handleGet(hdlr,tmp);
- }
- else
- {
- handleGet(hdlr,hdr,true);
- }
- }
-
- void HttpServer::handleTorrentPost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data)
- {
- const char* ptr = data.data();
- Uint32 len = data.size();
- int pos = TQString(data).find("\r\n\r\n");
-
- if (!session.logged_in || !checkSession(hdr))
- {
- // You can't post torrents if you are not logged in
- // or the session is not OK
- redirectToLoginPage(hdlr);
- return;
- }
-
- if (pos == -1 || pos + 4 >= len || ptr[pos + 4] != 'd')
- {
- HttpResponseHeader rhdr(500);
- setDefaultResponseHeaders(rhdr,"text/html",false);
- hdlr->send500(rhdr);
- return;
- }
-
- // save torrent to a temporary file
- KTempFile tmp_file(locateLocal("tmp", "ktwebgui-"), ".torrent");
- TQDataStream* out = tmp_file.dataStream();
- if (!out)
- {
- HttpResponseHeader rhdr(500);
- setDefaultResponseHeaders(rhdr,"text/html",false);
- hdlr->send500(rhdr);
- return;
- }
-
- out->writeRawBytes(ptr + (pos + 4),len - (pos + 4));
- tmp_file.sync();
- tmp_file.setAutoDelete(true);
-
- Out(SYS_WEB|LOG_NOTICE) << "Loading file " << tmp_file.name() << endl;
- core->loadSilently(KURL::fromPathOrURL(tmp_file.name()));
-
- handleGet(hdlr,hdr);
- }
-
- void HttpServer::handleUnsupportedMethod(HttpClientHandler* hdlr)
- {
- HttpResponseHeader rhdr(500);
- setDefaultResponseHeaders(rhdr,"text/html",false);
- hdlr->send500(rhdr);
- }
-
- void HttpServer::slotConnectionClosed()
- {
- TQSocket* socket= (TQSocket*)sender();
- clients.erase(socket);
- }
-
- TQDateTime HttpServer::parseDate(const TQString & str)
- {
- /*
- Potential date formats :
- Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
- Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
- Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
- */
- TQStringList sl = TQStringList::split(" ",str);
- if (sl.count() == 6)
- {
- // RFC 1123 format
- TQDate d;
- TQString month = sl[2];
- int m = -1;
- for (int i = 1;i <= 12 && m < 0;i++)
- if (TQDate::shortMonthName(i) == month)
- m = i;
-
- d.setYMD(sl[3].toInt(),m,sl[1].toInt());
-
- TQTime t = TQTime::fromString(sl[4],TQt::ISODate);
- return TQDateTime(d,t);
- }
- else if (sl.count() == 4)
- {
- // RFC 1036
- TQStringList dl = TQStringList::split("-",sl[1]);
- if (dl.count() != 3)
- return TQDateTime();
-
- TQDate d;
- TQString month = dl[1];
- int m = -1;
- for (int i = 1;i <= 12 && m < 0;i++)
- if (TQDate::shortMonthName(i) == month)
- m = i;
-
- d.setYMD(2000 + dl[2].toInt(),m,dl[0].toInt());
-
- TQTime t = TQTime::fromString(sl[2],TQt::ISODate);
- return TQDateTime(d,t);
- }
- else if (sl.count() == 5)
- {
- // ANSI C
- TQDate d;
- TQString month = sl[1];
- int m = -1;
- for (int i = 1;i <= 12 && m < 0;i++)
- if (TQDate::shortMonthName(i) == month)
- m = i;
-
- d.setYMD(sl[4].toInt(),m,sl[2].toInt());
-
- TQTime t = TQTime::fromString(sl[3],TQt::ISODate);
- return TQDateTime(d,t);
- }
- else
- return TQDateTime();
- }
-
- bt::MMapFile* HttpServer::cacheLookup(const TQString & name)
- {
- return cache.find(name);
- }
-
- void HttpServer::insertIntoCache(const TQString & name,bt::MMapFile* file)
- {
- cache.insert(name,file);
- }
-
-}
-
-#include "httpserver.moc"
diff --git a/plugins/webinterface/httpserver.h b/plugins/webinterface/httpserver.h
deleted file mode 100644
index 33eeddf..0000000
--- a/plugins/webinterface/httpserver.h
+++ /dev/null
@@ -1,105 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef HTTPSERVER_H
-#define HTTPSERVER_H
-
-#include <tqcache.h>
-#include <tqhttp.h>
-#include <tqdatetime.h>
-#include <tqserversocket.h>
-#include <util/ptrmap.h>
-
-class TQSocket;
-
-namespace bt
-{
- class MMapFile;
-}
-
-namespace kt
-{
- class CoreInterface;
-
- /**
- * @author Diego R. Brogna
- */
- struct Session
- {
- bool logged_in;
- TQTime last_access;
- int sessionId;
- };
-
- struct HeaderField
- {
- bool gzip;
- bool keepAlive;
- int sessionId;
- bool ifModifiedSince;
- };
-
- class PhpHandler;
- class PhpInterface;
- class HttpClientHandler;
- class HttpResponseHeader;
-
-
-
- class HttpServer : public TQServerSocket
- {
- TQ_OBJECT
-
- public:
- HttpServer(CoreInterface *core, int port);
- virtual ~HttpServer();
-
- void newConnection(int s);
-
- void handleGet(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,bool do_not_check_session = false);
- void handlePost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data);
- void handleUnsupportedMethod(HttpClientHandler* hdlr);
- bt::MMapFile* cacheLookup(const TQString & name);
- void insertIntoCache(const TQString & name,bt::MMapFile* file);
-
- protected slots:
- void slotSocketReadyToRead();
- void slotConnectionClosed();
-
- private:
- bool checkSession(const TQHttpRequestHeader & hdr);
- bool checkLogin(const TQHttpRequestHeader & hdr,const TQByteArray & data);
- void setDefaultResponseHeaders(HttpResponseHeader & hdr,const TQString & content_type,bool with_session_info);
- void handleTorrentPost(HttpClientHandler* hdlr,const TQHttpRequestHeader & hdr,const TQByteArray & data);
- TQDateTime parseDate(const TQString & str);
- void redirectToLoginPage(HttpClientHandler* hdlr);
-
- private:
- TQString rootDir;
- int sessionTTL;
- PhpInterface *php_i;
- Session session;
- bt::PtrMap<TQSocket*,HttpClientHandler> clients;
- CoreInterface *core;
- TQCache<bt::MMapFile> cache;
- };
-
-
-}
-#endif // HTTPSERVER_H
diff --git a/plugins/webinterface/ktwebinterfaceplugin.desktop b/plugins/webinterface/ktwebinterfaceplugin.desktop
deleted file mode 100644
index aa2dfa5..0000000
--- a/plugins/webinterface/ktwebinterfaceplugin.desktop
+++ /dev/null
@@ -1,22 +0,0 @@
-[Desktop Entry]
-Name=WebInterface
-Name[bg]=Уеб интерфейс
-Name[da]=Web-grænseflade
-Name[de]=Web-Schnittstelle
-Name[et]=Veebiliides
-Name[it]=Interfaccia Web
-Name[nb]=Internettgrensesnitt
-Name[nds]=Nettkoppelsteed
-Name[nl]=Webinterface
-Name[pl]=Interfejs WWW
-Name[pt]=Interface Web
-Name[sr]=Веб интерфејс
-Name[sr@Latn]=Veb interfejs
-Name[sv]=Webb-gränssnitt
-Name[tr]=Ağ Arayüzü
-Name[uk]=Веб-інтерфейс
-Name[xx]=xxWebInterfacexx
-Name[zh_CN]=Web 界面
-X-TDE-ServiceTypes=KTorrent/Plugin
-Type=Service
-X-TDE-Library=ktwebinterfaceplugin
diff --git a/plugins/webinterface/ktwebinterfaceplugin.kcfg b/plugins/webinterface/ktwebinterfaceplugin.kcfg
deleted file mode 100644
index cbfd5e7..0000000
--- a/plugins/webinterface/ktwebinterfaceplugin.kcfg
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
- http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
-
- <kcfgfile name="ktwebinterfacepluginrc"/>
- <group name="general">
- <entry name="port" type="Int">
- <label>Port number</label>
- <default>8080</default>
- </entry>
-
- <entry name="forward" type="Bool">
- <label>forward Port</label>
- <default>false</default>
- </entry>
-
- <entry name="sessionTTL" type ="Int">
- <label>Session time to live</label>
- <default>3600</default>
- </entry>
- <entry name="skin" type ="String">
- <label>interface skin</label>
- <default>default</default>
- </entry>
- <entry name="phpExecutablePath" type ="String">
- <label>php executable path</label>
- <default></default>
- </entry>
-
- <entry name="username" type ="String">
- <label>username</label>
- <default></default>
- </entry>
- <entry name="password" type ="String">
- <label>password</label>
- <default></default>
- </entry>
- </group>
-</kcfg>
diff --git a/plugins/webinterface/php_handler.cpp b/plugins/webinterface/php_handler.cpp
deleted file mode 100644
index 6586f7e..0000000
--- a/plugins/webinterface/php_handler.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include "php_handler.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <util/log.h>
-#include "php_interface.h"
-
-
-using namespace kt;
-using namespace bt;
-
-namespace kt
-{
- TQMap<TQString,TQByteArray> PhpHandler::scripts;
-
- PhpHandler::PhpHandler(const TQString & php_exe,PhpInterface *php) : TQProcess(php_exe),php_i(php)
- {
- connect(this,TQ_SIGNAL(readyReadStdout()),this,TQ_SLOT(onReadyReadStdout()));
- connect(this,TQ_SIGNAL(processExited()),this,TQ_SLOT(onExited()));
- }
-
- PhpHandler::~PhpHandler()
- {
- }
-
- bool PhpHandler::executeScript(const TQString & path,const TQMap<TQString,TQString> & args)
- {
- TQByteArray php_s;
- if (!scripts.contains(path))
- {
- TQFile fptr(path);
- if (!fptr.open(IO_ReadOnly))
- {
- Out(SYS_WEB|LOG_DEBUG) << "Failed to open " << path << endl;
- return false;
- }
- php_s = fptr.readAll();
- scripts.insert(path,php_s);
- }
- else
- {
- php_s = scripts[path];
- }
-
- output.resize(0);
-
- int firstphptag = TQCString(php_s).find("<?php");
- if (firstphptag == -1)
- return false;
-
- int off = firstphptag + 6;
- TQByteArray data;
- TQTextStream ts(data,IO_WriteOnly);
- ts.setEncoding( TQTextStream::UnicodeUTF8 );
- ts.writeRawBytes(php_s.data(),off); // first write the opening tag from the script
- php_i->globalInfo(ts);
- php_i->downloadStatus(ts);
-
- TQMap<TQString,TQString>::const_iterator it;
-
- for ( it = args.begin(); it != args.end(); ++it )
- {
- // Check for string delimiters, don't want PHP injection attacks
- if (!containsDelimiters(it.key()) && !containsDelimiters(it.data()))
- ts << TQString("$_REQUEST['%1']=\"%2\";\n").arg(it.key()).arg(it.data());
- }
- ts.writeRawBytes(php_s.data() + off,php_s.size() - off); // the rest of the script
- ts << flush;
-
-#if 0
- TQFile dinges("output.php");
- if (dinges.open(IO_WriteOnly))
- {
- TQTextStream out(&dinges);
- out.writeRawBytes(data.data(),data.size());
- dinges.close();
- }
-#endif
- return launch(data);
- }
-
- bool PhpHandler::containsDelimiters(const TQString & str)
- {
- return str.contains("\"") || str.contains("'");
- }
-
- void PhpHandler::onExited()
- {
- // read remaining data
- onReadyReadStdout();
- finished();
- }
-
- void PhpHandler::onReadyReadStdout()
- {
- TQTextStream out(output,IO_WriteOnly|IO_Append);
- while (canReadLineStdout())
- {
- TQByteArray d = readStdout();
- out.writeRawBytes(d.data(),d.size());
- }
- }
-
-}
-
-#include "php_handler.moc"
diff --git a/plugins/webinterface/php_handler.h b/plugins/webinterface/php_handler.h
deleted file mode 100644
index e817b51..0000000
--- a/plugins/webinterface/php_handler.h
+++ /dev/null
@@ -1,61 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#ifndef PHP_HANDLER_H
-#define PHP_HANDLER_H
-
-#include <tqmap.h>
-#include <kurl.h>
-#include <tqprocess.h>
-
-
-namespace kt
-{
- class PhpInterface;
-
- class PhpHandler : public TQProcess
- {
- TQ_OBJECT
-
- public:
- PhpHandler(const TQString & php_exe,PhpInterface *php);
- virtual ~PhpHandler();
-
- bool executeScript(const TQString & path,const TQMap<TQString,TQString> & args);
- const TQByteArray & getOutput() const {return output;};
-
- public slots:
- void onExited();
- void onReadyReadStdout();
-
- signals:
- void finished();
-
- private:
- bool containsDelimiters(const TQString & str);
-
- private:
- TQByteArray output;
- PhpInterface *php_i;
-
- static TQMap<TQString,TQByteArray> scripts;
- };
-}
-
-#endif
diff --git a/plugins/webinterface/php_interface.cpp b/plugins/webinterface/php_interface.cpp
deleted file mode 100644
index eb42684..0000000
--- a/plugins/webinterface/php_interface.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#include <tdeio/global.h>
-#include <tdeglobal.h>
-#include <tdelocale.h>
-
-#include <net/socketmonitor.h>
-#include <torrent/choker.h>
-#include <torrent/udptrackersocket.h>
-#include <kademlia/dhtbase.h>
-#include <torrent/server.h>
-#include <util/log.h>
-#include <interfaces/functions.h>
-
-#include "php_interface.h"
-
-using namespace bt;
-
-namespace kt
-{
- extern TQString DataDir();
-
- using bt::FIRST_PRIORITY;
- using bt::NORMAL_PRIORITY;
- using bt::LAST_PRIORITY;
- using bt::EXCLUDED;
-
-
- TQString BytesToString2(Uint64 bytes,int precision = 2)
- {
- TDELocale* loc = TDEGlobal::locale();
- if (bytes >= 1024 * 1024 * 1024)
- return TQString("%1 GB").arg(loc->formatNumber(bytes / TO_GIG,precision < 0 ? 2 : precision));
- else if (bytes >= 1024*1024)
- return TQString("%1 MB").arg(loc->formatNumber(bytes / TO_MEG,precision < 0 ? 1 : precision));
- else if (bytes >= 1024)
- return TQString("%1 KB").arg(loc->formatNumber(bytes / TO_KB,precision < 0 ? 1 : precision));
- else
- return TQString("%1 B").arg(bytes);
- }
-
- TQString KBytesPerSecToString2(double speed,int precision = 2)
- {
- TDELocale* loc = TDEGlobal::locale();
- return TQString("%1 KB/s").arg(loc->formatNumber(speed,precision));
- }
-
- /************************
- *PhpCodeGenerator *
- ************************/
- PhpCodeGenerator::PhpCodeGenerator(CoreInterface *c)
- {
- core=c;
- }
-
- /*Generate php code
- * function downloadStatus()
- * {
- * return array( ... );
- * }
- */
- void PhpCodeGenerator::downloadStatus(TQTextStream & out)
- {
- TorrentStats stats;
- //Priority file_priority;
- TQString status;
- out << "function downloadStatus()\n{\nreturn array(";
-
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if (k > 0)
- out << ",\n";
-
- stats=(*i)->getStats();
- out << TQString("\n%1 => array(").arg(k);
-
- out << TQString("\"imported_bytes\" => %1,\n").arg(stats.imported_bytes);
- out << TQString("\"bytes_downloaded\" => \"%1\",\n").arg(BytesToString2(stats.bytes_downloaded));
- out << TQString("\"bytes_uploaded\" => \"%1\",\n").arg(BytesToString2(stats.bytes_uploaded));
- out << TQString("\"bytes_left\" => %1,\n").arg(stats.bytes_left);
- out << TQString("\"bytes_left_to_download\" => %1,\n").arg(stats.bytes_left_to_download);
- out << TQString("\"total_bytes\" => \"%1\",\n").arg(BytesToString2(stats.total_bytes));
- out << TQString("\"total_bytes_to_download\" => %1,\n").arg(stats.total_bytes_to_download);
- out << TQString("\"download_rate\" => \"%1\",\n").arg(KBytesPerSecToString2(stats.download_rate / 1024.0));
- out << TQString("\"upload_rate\" => \"%1\",\n").arg(KBytesPerSecToString2(stats.upload_rate / 1024.0));
- out << TQString("\"num_peers\" => %1,\n").arg(stats.num_peers);
- out << TQString("\"num_chunks_downloading\" => %1,\n").arg(stats.num_chunks_downloading);
- out << TQString("\"total_chunks\" => %1,\n").arg(stats.total_chunks);
- out << TQString("\"num_chunks_downloaded\" => %1,\n").arg(stats.num_chunks_downloaded);
- out << TQString("\"num_chunks_excluded\" => %1,\n").arg(stats.num_chunks_excluded);
- out << TQString("\"chunk_size\" => %1,\n").arg(stats.chunk_size);
- out << TQString("\"seeders_total\" => %1,\n").arg(stats.seeders_total);
- out << TQString("\"seeders_connected_to\" => %1,\n").arg(stats.seeders_connected_to);
- out << TQString("\"leechers_total\" => %1,\n").arg(stats.leechers_total);
- out << TQString("\"leechers_connected_to\" => %1,\n").arg(stats.leechers_connected_to);
- out << TQString("\"status\" => %1,\n").arg(stats.status);
- out << TQString("\"running\" => %1,\n").arg(stats.running);
- out << TQString("\"trackerstatus\" => \"%1\",\n").arg(stats.trackerstatus.replace("\\", "\\\\").replace("\"", "\\\"").replace("$", "\\$"));
- out << TQString("\"session_bytes_downloaded\" => %1,\n").arg(stats.session_bytes_downloaded);
- out << TQString("\"session_bytes_uploaded\" => %1,\n").arg(stats.session_bytes_uploaded);
- out << TQString("\"trk_bytes_downloaded\" => %1,\n").arg(stats.trk_bytes_downloaded);
- out << TQString("\"trk_bytes_uploaded\" => %1,\n").arg(stats.trk_bytes_uploaded);
- out << TQString("\"torrent_name\" => \"%1\",\n").arg(stats.torrent_name.replace("\\", "\\\\").replace("\"", "\\\"").replace("$", "\\$"));
- out << TQString("\"output_path\" => \"%1\",\n").arg(stats.output_path.replace("\\", "\\\\").replace("\"", "\\\"").replace("$", "\\$"));
- out << TQString("\"stopped_by_error\" => \"%1\",\n").arg(stats.stopped_by_error);
- out << TQString("\"completed\" => \"%1\",\n").arg(stats.completed);
- out << TQString("\"user_controlled\" => \"%1\",\n").arg(stats.user_controlled);
- out << TQString("\"max_share_ratio\" => %1,\n").arg(stats.max_share_ratio);
- out << TQString("\"priv_torrent\" => \"%1\",\n").arg(stats.priv_torrent);
- out << TQString("\"num_files\" => \"%1\",\n").arg((*i)->getNumFiles());
- out << TQString("\"files\" => array(");
- out << flush;
- if (stats.multi_file_torrent)
- {
- //for loop to add each file+status to "files" array
- for (Uint32 j = 0;j < (*i)->getNumFiles();j++)
- {
- if (j > 0)
- out << ",\n";
-
- TorrentFileInterface & file = (*i)->getTorrentFile(j);
- out << TQString("\"%1\" => array(\n").arg(j);
- out << TQString("\"name\" => \"%1\",\n").arg(file.getPath());
- out << TQString("\"size\" => \"%1\",\n").arg(TDEIO::convertSize(file.getSize()));
- out << TQString("\"perc_done\" => \"%1\",\n").arg(file.getDownloadPercentage());
- out << TQString("\"status\" => \"%1\"\n").arg(file.getPriority());
- out << TQString(")\n");
- out << flush;
- }
- }
-
- out << ")\n";
- out << ")\n";
- }
-
- out << ");\n}\n";
- }
-
- /*Generate php code
- * function globalStatus()
- * {
- * return array( ... );
- * }
- */
- void PhpCodeGenerator::globalInfo(TQTextStream & out)
- {
- out << "function globalInfo()\n{\nreturn array(";
- CurrentStats stats=core->getStats();
-
- out << TQString("\"download_speed\" => \"%1\",").arg(KBytesPerSecToString2(stats.download_speed / 1024.0));
- out << TQString("\"upload_speed\" => \"%1\",").arg(KBytesPerSecToString2(stats.upload_speed / 1024.0));
- out << TQString("\"bytes_downloaded\" => \"%1\",").arg(stats.bytes_downloaded);
- out << TQString("\"bytes_uploaded\" => \"%1\",").arg(stats.bytes_uploaded);
- out << TQString("\"max_download_speed\" => \"%1\",").arg(core->getMaxDownloadSpeed());
- out << TQString("\"max_upload_speed\" => \"%1\",").arg(core->getMaxUploadSpeed());
- out << TQString("\"max_downloads\" => \"%1\",").arg(Settings::maxDownloads());
- out << TQString("\"max_seeds\"=> \"%1\",").arg(Settings::maxSeeds());
- out << TQString("\"dht_support\" => \"%1\",").arg(Settings::dhtSupport());
- out << TQString("\"use_encryption\" => \"%1\"").arg(Settings::useEncryption());
- out << ");\n}\n";
- }
-
-
- /************************
- *PhpActionExec *
- ************************/
- PhpActionExec::PhpActionExec(CoreInterface *c)
- {
- core=c;
- }
-
- bool PhpActionExec::exec(KURL & url,bool & shutdown)
- {
- bool ret = false;
- shutdown = false;
- int separator_loc;
- TQString parse;
- TQString torrent_num;
- TQString file_num;
- KURL redirected_url;
- redirected_url.setPath(url.path());
-
- const TQMap<TQString, TQString> & params = url.queryItems();
- TQMap<TQString, TQString>::ConstIterator it;
-
- for ( it = params.begin(); it != params.end(); ++it )
- {
- // Out(SYS_WEB| LOG_DEBUG) << "exec " << it.key().latin1() << endl;
- switch(it.key()[0])
- {
- case 'd':
- if(it.key()=="dht")
- {
- if(it.data()=="start")
- {
- Settings::setDhtSupport(true);
- }
- else
- {
- Settings::setDhtSupport(false);
- }
-
- dht::DHTBase & ht = Globals::instance().getDHT();
- if (Settings::dhtSupport() && !ht.isRunning())
- {
- ht.start(kt::DataDir() + "dht_table",kt::DataDir() + "dht_key",Settings::dhtPort());
- ret = true;
- }
- else if (!Settings::dhtSupport() && ht.isRunning())
- {
- ht.stop();
- ret = true;
- }
- else if (Settings::dhtSupport() && ht.getPort() != Settings::dhtPort())
- {
- ht.stop();
- ht.start(kt::DataDir() + "dht_table",kt::DataDir() + "dht_key",Settings::dhtPort());
- ret = true;
- }
- }
- break;
- case 'e':
- if(it.key()=="encription")
- {
- if(it.data()=="start")
- {
- Settings::setUseEncryption(true);
- }
- else
- {
- Settings::setUseEncryption(false);
- }
-
- if (Settings::useEncryption())
- {
- Globals::instance().getServer().enableEncryption(Settings::allowUnencryptedConnections());
- }
- else
- {
- Globals::instance().getServer().disableEncryption();
- }
- ret = true;
- }
- break;
- case 'f':
- //parse argument into torrent number and file number
- separator_loc=it.data().find('-');
- parse=it.data();
- torrent_num.append(parse.left(separator_loc));
- file_num.append(parse.right(parse.length()-(separator_loc+1)));
-
- if(it.key()=="file_lp")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(torrent_num.toInt()==k)
- {
- TorrentFileInterface & file = (*i)->getTorrentFile(file_num.toInt());
- file.setPriority(LAST_PRIORITY);
- ret = true;
- break;
- }
- }
- }
- else if(it.key()=="file_np")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(torrent_num.toInt()==k)
- {
- TorrentFileInterface & file = (*i)->getTorrentFile(file_num.toInt());
- file.setPriority(NORMAL_PRIORITY);
- ret = true;
- break;
- }
- }
- }
- else if(it.key()=="file_hp")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(torrent_num.toInt()==k)
- {
- TorrentFileInterface & file = (*i)->getTorrentFile(file_num.toInt());
- file.setPriority(FIRST_PRIORITY);
- ret = true;
- break;
- }
- }
- }
- else if(it.key()=="file_stop")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(torrent_num.toInt()==k)
- {
- TorrentFileInterface & file = (*i)->getTorrentFile(file_num.toInt());
- file.setPriority(ONLY_SEED_PRIORITY);
- ret = true;
- break;
- }
- }
- }
- break;
- case 'g':
- if(it.key()=="global_connection")
- {
- Settings::setMaxTotalConnections(it.data().toInt());
- PeerManager::setMaxTotalConnections(Settings::maxTotalConnections());
- ret = true;
- }
- break;
- case 'l':
- if(it.key()=="load_torrent" && it.data().length() > 0)
- {
- core->loadSilently(KURL::decode_string(it.data()));
- ret = true;
- }
- break;
- case 'm':
- if(it.key()=="maximum_downloads")
- {
- core->setMaxDownloads(it.data().toInt());
- Settings::setMaxDownloads(it.data().toInt());
- ret = true;
- }
- else if(it.key()=="maximum_seeds")
- {
- core->setMaxSeeds(it.data().toInt());
- Settings::setMaxSeeds(it.data().toInt());
- ret = true;
- }
- else if(it.key()=="maximum_connection_per_torrent")
- {
- PeerManager::setMaxConnections(it.data().toInt());
- Settings::setMaxConnections(it.data().toInt());
- ret = true;
- }
- else if(it.key()=="maximum_upload_rate")
- {
- Settings::setMaxUploadRate(it.data().toInt());
- core->setMaxUploadSpeed(Settings::maxUploadRate());
- net::SocketMonitor::setUploadCap( Settings::maxUploadRate() * 1024);
- ret = true;
- }
- else if(it.key()=="maximum_download_rate")
- {
- Settings::setMaxDownloadRate(it.data().toInt());
- core->setMaxDownloadSpeed(Settings::maxDownloadRate());
- net::SocketMonitor::setDownloadCap(Settings::maxDownloadRate()*1024);
- ret = true;
- }
- else if(it.key()=="maximum_share_ratio")
- {
- Settings::setMaxRatio(it.data().toInt());
- ret = true;
- }
- break;
- case 'n':
- if(it.key()=="number_of_upload_slots")
- {
- Settings::setNumUploadSlots(it.data().toInt());
- Choker::setNumUploadSlots(Settings::numUploadSlots());
- ret = true;
- }
- break;
- case 'p':
- if(it.key()=="port")
- {
- Settings::setPort(it.data().toInt());
- core->changePort(Settings::port());
- }
- else if(it.key()=="port_udp_tracker")
- {
- Settings::setUdpTrackerPort(it.data().toInt());
- UDPTrackerSocket::setPort(Settings::udpTrackerPort());
- ret = true;
- }
- break;
- case 'q':
- if(it.key()=="quit" && !it.data().isEmpty())
- {
- shutdown = true;
- ret = true;
- }
- break;
- case 'r':
- if(it.key()=="remove")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(it.data().toInt()==k)
- {
- core->remove((*i), false);
- ret = true;
- break;
- }
- }
- }
- break;
- case 's':
- if(it.key()=="stopall" && !it.data().isEmpty())
- {
- core->stopAll(3);
- }
- else if(it.key()=="startall" && !it.data().isEmpty())
- {
- core->startAll(3);
- }
- else if(it.key()=="stop")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(it.data().toInt()==k)
- {
- (*i)->stop(true);
- ret = true;
- break;
- }
- }
- }
- else if(it.key()=="start")
- {
- TQPtrList<TorrentInterface>::iterator i= core->getQueueManager()->begin();
- for(int k=0; i != core->getQueueManager()->end(); i++, k++)
- {
- if(it.data().toInt()==k)
- {
- (*i)->start();
- ret = true;
- break;
- }
- }
- }
- break;
-
- default:
- // add unknown query items to the redirected url
- // we don't add the keys above, because if the user presses refresh
- // the same action will be taken again
- redirected_url.addQueryItem(it.key(),it.data());
- break;
- }
- Settings::writeConfig();
- }
-
- if (ret)
- url = redirected_url;
-
- return ret;
- }
-
- /************************
- *PhpInterface *
- ************************/
- PhpInterface::PhpInterface(CoreInterface *c):PhpCodeGenerator(c), PhpActionExec(c)
- {
-
- }
-
-}
diff --git a/plugins/webinterface/php_interface.h b/plugins/webinterface/php_interface.h
deleted file mode 100644
index acfd8c7..0000000
--- a/plugins/webinterface/php_interface.h
+++ /dev/null
@@ -1,68 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#ifndef PHP_INTERFACE_H
-#define PHP_INTERFACE_H
-
-#include <tqstring.h>
-#include <torrent/peermanager.h>
-#include <settings.h>
-#include <torrent/queuemanager.h>
-#include <interfaces/coreinterface.h>
-#include <interfaces/torrentinterface.h>
-#include <interfaces/torrentfileinterface.h>
-
- /**
- * @author Diego R. Brogna
- */
-namespace kt
-{
- class PhpCodeGenerator
- {
- public:
- PhpCodeGenerator(CoreInterface *c);
- virtual ~PhpCodeGenerator(){}
-
- void downloadStatus(TQTextStream & out);
- void globalInfo(TQTextStream & out);
- private:
- CoreInterface *core;
- };
-
- class PhpActionExec
- {
- public:
- PhpActionExec(CoreInterface *c);
- virtual ~PhpActionExec(){};
-
- bool exec(KURL & url,bool & shutdown);
- private:
- CoreInterface *core;
- };
-
- class PhpInterface: public PhpCodeGenerator, public PhpActionExec
- {
- public:
- PhpInterface(CoreInterface *c);
- //~PhpInterface{};
- };
-}
-
-#endif
diff --git a/plugins/webinterface/webinterfaceplugin.cpp b/plugins/webinterface/webinterfaceplugin.cpp
deleted file mode 100644
index fb47d03..0000000
--- a/plugins/webinterface/webinterfaceplugin.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-#include <kgenericfactory.h>
-#include <tdeglobal.h>
-
-#include <util/log.h>
-#include <interfaces/coreinterface.h>
-#include <interfaces/guiinterface.h>
-#include <interfaces/torrentinterface.h>
-#include <torrent/globals.h>
-#include <net/portlist.h>
-#include "webinterfaceprefpage.h"
-#include "webinterfaceplugin.h"
-#include "httpserver.h"
-#include "webinterfacepluginsettings.h"
-
-#define NAME "Web Interface"
-#define AUTHOR "Diego R. Brogna"
-#define EMAIL "[email protected]"
-
-K_EXPORT_COMPONENT_FACTORY(ktwebinterfaceplugin,KGenericFactory<kt::WebInterfacePlugin>("ktwebinterfaceplugin"))
-
-using namespace bt;
-namespace kt
-{
- WebInterfacePlugin::WebInterfacePlugin(TQObject* parent, const char* name, const TQStringList& args)
- : Plugin(parent, name, args,NAME,i18n("Web Interface"),AUTHOR,EMAIL,i18n("Allow to control ktorrent through browser"),"toggle_log")
- {
- http_server = 0;
- pref=0;
- }
-
- WebInterfacePlugin::~WebInterfacePlugin()
- {
-
- }
-
- void WebInterfacePlugin::load()
- {
- initServer();
-
- pref = new WebInterfacePrefPage(this);
- getGUI()->addPrefPage(pref);
-
- }
-
- void WebInterfacePlugin::unload()
- {
- if (http_server)
- {
- bt::Globals::instance().getPortList().removePort(http_server->port(),net::TCP);
- delete http_server;
- http_server = 0;
- }
-
- getGUI()->removePrefPage(pref);
- delete pref;
- pref = 0;
- }
-
- void WebInterfacePlugin::initServer()
- {
- bt::Uint16 port = WebInterfacePluginSettings::port();
- bt::Uint16 i = 0;
-
- while (i < 10)
- {
- http_server = new HttpServer(getCore(),port + i);
- if (!http_server->ok())
- {
- delete http_server;
- http_server = 0;
- }
- else
- break;
- i++;
- }
-
- if (http_server)
- {
- if(WebInterfacePluginSettings::forward())
- bt::Globals::instance().getPortList().addNewPort(http_server->port(),net::TCP,true);
- Out(SYS_WEB|LOG_ALL) << "Web server listen on port "<< http_server->port() << endl;
- }
- else
- {
- Out(SYS_WEB|LOG_ALL) << "Cannot bind to port " << port <<" or the 10 following ports. WebInterface plugin cannot be loaded." << endl;
- return;
- }
- }
-
- void WebInterfacePlugin::preferencesUpdated()
- {
- if( http_server && http_server->port() != WebInterfacePluginSettings::port())
- {
- //stop and delete http server
- bt::Globals::instance().getPortList().removePort(http_server->port(),net::TCP);
- delete http_server;
- http_server = 0;
- // reinitialize server
- initServer();
- }
- }
-
- bool WebInterfacePlugin::versionCheck(const TQString & version) const
- {
- return version == KT_VERSION_MACRO;
- }
-}
-
-#include "webinterfaceplugin.moc"
diff --git a/plugins/webinterface/webinterfaceplugin.h b/plugins/webinterface/webinterfaceplugin.h
deleted file mode 100644
index 0edb5ed..0000000
--- a/plugins/webinterface/webinterfaceplugin.h
+++ /dev/null
@@ -1,55 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#ifndef KTWEBINTERFACEPLUGIN_H
-#define KTWEBINTERFACEPLUGIN_H
-
-#include <interfaces/plugin.h>
-
-namespace kt
-{
- /**
- * @author Diego R. Brogna
- */
- class HttpServer;
-
- class WebInterfacePlugin : public Plugin
- {
- TQ_OBJECT
-
- public:
- WebInterfacePlugin(TQObject* parent, const char* name, const TQStringList& args);
- virtual ~WebInterfacePlugin();
-
- virtual void load();
- virtual void unload();
- virtual bool versionCheck(const TQString& version) const;
-
- void preferencesUpdated();
- private:
- void initServer();
-
- WebInterfacePrefPage* pref;
- HttpServer* http_server;
- };
-
-}
-
-#endif
diff --git a/plugins/webinterface/webinterfacepluginsettings.kcfgc b/plugins/webinterface/webinterfacepluginsettings.kcfgc
deleted file mode 100644
index 1306161..0000000
--- a/plugins/webinterface/webinterfacepluginsettings.kcfgc
+++ /dev/null
@@ -1,7 +0,0 @@
-# Code generation options for tdeconfig_compiler
-File=ktwebinterfaceplugin.kcfg
-ClassName=WebInterfacePluginSettings
-Namespace=kt
-Singleton=true
-Mutators=true
-# will create the necessary code for setting those variables
diff --git a/plugins/webinterface/webinterfacepref.ui b/plugins/webinterface/webinterfacepref.ui
deleted file mode 100644
index 5830b0c..0000000
--- a/plugins/webinterface/webinterfacepref.ui
+++ /dev/null
@@ -1,254 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>WebInterfacePreference</class>
-<widget class="TQWidget">
- <property name="name">
- <cstring>WebInterfacePreference</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>666</width>
- <height>883</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>500</width>
- <height>350</height>
- </size>
- </property>
- <property name="caption">
- <string>Search Preferences</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQButtonGroup" row="0" column="0">
- <property name="name">
- <cstring>buttonGroup1</cstring>
- </property>
- <property name="title">
- <string>Web Server</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout5</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>Port:</string>
- </property>
- </widget>
- <widget class="KIntSpinBox">
- <property name="name">
- <cstring>port</cstring>
- </property>
- <property name="maxValue">
- <number>65535</number>
- </property>
- <property name="minValue">
- <number>1</number>
- </property>
- <property name="value">
- <number>8080</number>
- </property>
- </widget>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>forward</cstring>
- </property>
- <property name="text">
- <string>Forward port</string>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer4</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>54</width>
- <height>21</height>
- </size>
- </property>
- </spacer>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel4</cstring>
- </property>
- <property name="text">
- <string>Session TTL (in sec):</string>
- </property>
- </widget>
- <widget class="KIntSpinBox">
- <property name="name">
- <cstring>sessionTTL</cstring>
- </property>
- <property name="maxValue">
- <number>100000</number>
- </property>
- <property name="minValue">
- <number>1</number>
- </property>
- <property name="lineStep">
- <number>100</number>
- </property>
- <property name="value">
- <number>3600</number>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="TQLayoutWidget" row="1" column="0">
- <property name="name">
- <cstring>layout4</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel1_2</cstring>
- </property>
- <property name="text">
- <string>Select interface:</string>
- </property>
- </widget>
- <widget class="TQComboBox">
- <property name="name">
- <cstring>interfaceSkinBox</cstring>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="TQLayoutWidget" row="3" column="0">
- <property name="name">
- <cstring>layout6</cstring>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout5</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel5</cstring>
- </property>
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- <widget class="KLineEdit">
- <property name="name">
- <cstring>username</cstring>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="TQPushButton" row="0" column="1">
- <property name="name">
- <cstring>btnPassword</cstring>
- </property>
- <property name="text">
- <string>Change password ...</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="TQLayoutWidget" row="2" column="0">
- <property name="name">
- <cstring>layout7</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Php executable path:</string>
- </property>
- </widget>
- <widget class="KURLRequester">
- <property name="name">
- <cstring>phpExecutablePath</cstring>
- </property>
- </widget>
- <widget class="KLed">
- <property name="name">
- <cstring>kled</cstring>
- </property>
- <property name="toolTip" stdset="0">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- </grid>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>btnPassword</sender>
- <signal>clicked()</signal>
- <receiver>WebInterfacePreference</receiver>
- <slot>btnUpdate_clicked()</slot>
- </connection>
- <connection>
- <sender>phpExecutablePath</sender>
- <signal>textChanged(const TQString&amp;)</signal>
- <receiver>WebInterfacePreference</receiver>
- <slot>changeLedState()</slot>
- </connection>
-</connections>
-<slots>
- <slot>btnUpdate_clicked()</slot>
- <slot>changeLedState()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-<includes>
- <include location="global" impldecl="in implementation">kled.h</include>
- <include location="global" impldecl="in implementation">klineedit.h</include>
- <include location="global" impldecl="in implementation">knuminput.h</include>
- <include location="global" impldecl="in implementation">kpushbutton.h</include>
- <include location="global" impldecl="in implementation">kurlrequester.h</include>
-</includes>
-</UI>
diff --git a/plugins/webinterface/webinterfaceprefpage.cpp b/plugins/webinterface/webinterfaceprefpage.cpp
deleted file mode 100644
index ecc7a62..0000000
--- a/plugins/webinterface/webinterfaceprefpage.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#include "webinterfaceprefpage.h"
-#include "webinterfaceplugin.h"
-namespace kt
-{
-
- WebInterfacePrefPage::WebInterfacePrefPage(WebInterfacePlugin* plugin)
- : PrefPageInterface(i18n("WebInterface"), i18n("WebInterface Options"),
- TDEGlobal::iconLoader()->loadIcon("toggle_log",TDEIcon::NoGroup))
- {
- m_widget = 0;
- w_plugin=plugin;
- }
-
-
- WebInterfacePrefPage::~WebInterfacePrefPage()
- {}
-
- bool WebInterfacePrefPage::apply()
- {
- if(m_widget)
- m_widget->apply();
- w_plugin->preferencesUpdated();
- return true;
- }
-
- void WebInterfacePrefPage::createWidget(TQWidget* parent)
- {
- m_widget = new WebInterfacePrefWidget(parent);
- }
-
- void WebInterfacePrefPage::updateData()
- {
- }
-
- void WebInterfacePrefPage::deleteWidget()
- {
- if(m_widget)
- delete m_widget;
- }
-}
diff --git a/plugins/webinterface/webinterfaceprefpage.h b/plugins/webinterface/webinterfaceprefpage.h
deleted file mode 100644
index f05c723..0000000
--- a/plugins/webinterface/webinterfaceprefpage.h
+++ /dev/null
@@ -1,55 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#ifndef WEBINTERFACEPREFPAGE_H
-#define WEBINTERFACEPREFPAGE_H
-#include <interfaces/prefpageinterface.h>
-#include "webinterfaceprefwidget.h"
-
-#include <tdelocale.h>
-#include <tdeglobal.h>
-#include <kiconloader.h>
-namespace kt
-{
-
- /**
- * WebInterface plugin preferences page
- * @author Diego R. Brogna <[email protected]>
- */
- class WebInterfacePlugin;
- class WebInterfacePrefPage : public PrefPageInterface
- {
- public:
- WebInterfacePrefPage(WebInterfacePlugin* plugin);
- virtual ~WebInterfacePrefPage();
-
- virtual bool apply();
- virtual void createWidget(TQWidget* parent);
- virtual void updateData();
- virtual void deleteWidget();
-
- private:
- WebInterfacePrefWidget* m_widget;
- WebInterfacePlugin* w_plugin;
- };
-
-}
-
-#endif
diff --git a/plugins/webinterface/webinterfaceprefwidget.cpp b/plugins/webinterface/webinterfaceprefwidget.cpp
deleted file mode 100644
index 92b983a..0000000
--- a/plugins/webinterface/webinterfaceprefwidget.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#include "webinterfaceprefwidget.h"
-#include "webinterfacepluginsettings.h"
-
-#include <tdelocale.h>
-#include <tdeglobal.h>
-#include <kiconloader.h>
-#include <tdestandarddirs.h>
-
-#include <tqwidget.h>
-#include <tqstring.h>
-#include <tqcheckbox.h>
-#include <tqcombobox.h>
-#include <knuminput.h>
-#include <kurlrequester.h>
-#include <klineedit.h>
-#include <kpassdlg.h>
-#include <kmdcodec.h>
-#include <kled.h>
-#include <tqtooltip.h>
-
-#include <net/portlist.h>
-#include <torrent/globals.h>
-using namespace bt;
-namespace kt
-{
-
-WebInterfacePrefWidget::WebInterfacePrefWidget(TQWidget *parent, const char *name):WebInterfacePreference(parent,name)
-{
- port->setValue(WebInterfacePluginSettings::port());
- forward->setChecked(WebInterfacePluginSettings::forward());
- sessionTTL->setValue(WebInterfacePluginSettings::sessionTTL());
-
- TQStringList dirList=TDEGlobal::instance()->dirs()->findDirs("data", "ktorrent/www");
- TQDir d(*(dirList.begin()));
- TQStringList skinList=d.entryList(TQDir::Dirs);
- for ( TQStringList::Iterator it = skinList.begin(); it != skinList.end(); ++it ){
- if(*it=="." || *it=="..")
- continue;
- interfaceSkinBox->insertItem(*it);
- }
-
- interfaceSkinBox->setCurrentText (WebInterfacePluginSettings::skin());
-
- if(WebInterfacePluginSettings::phpExecutablePath().isEmpty()){
- TQString phpPath=TDEStandardDirs::findExe("php");
- if(phpPath==TQString())
- phpPath=TDEStandardDirs::findExe("php-cli");
-
- if(phpPath==TQString())
- phpExecutablePath->setURL (i18n("Php executable is not in default path, please enter the path manually"));
- else
- phpExecutablePath->setURL (phpPath);
- }
- else
- phpExecutablePath->setURL (WebInterfacePluginSettings::phpExecutablePath());
-
- username->setText(WebInterfacePluginSettings::username());
-}
-
-bool WebInterfacePrefWidget::apply()
-{
- if(WebInterfacePluginSettings::port()==port->value()){
- if(forward->isChecked())
- bt::Globals::instance().getPortList().addNewPort(port->value(),net::TCP,true);
- else
- bt::Globals::instance().getPortList().removePort(port->value(),net::TCP);
- }
- WebInterfacePluginSettings::setPort(port->value () );
- WebInterfacePluginSettings::setForward(forward->isChecked());
- WebInterfacePluginSettings::setSessionTTL(sessionTTL->value () );
- WebInterfacePluginSettings::setSkin(interfaceSkinBox->currentText());
- WebInterfacePluginSettings::setPhpExecutablePath(phpExecutablePath->url () );
- if(!username->text().isEmpty() && !password.isEmpty()){
- WebInterfacePluginSettings::setUsername(username->text() );
- KMD5 context(password.utf8());
- WebInterfacePluginSettings::setPassword(context.hexDigest().data());
- }
-
- WebInterfacePluginSettings::writeConfig();
- return true;
-}
-
-void WebInterfacePrefWidget::btnUpdate_clicked()
-{
- TQString passwd;
- int result = KPasswordDialog::getNewPassword(passwd, i18n("Please enter a new password for the web interface."));
- if (result == KPasswordDialog::Accepted)
- password=passwd;
-
-}
-
-void WebInterfacePrefWidget::changeLedState()
-{
- TQFileInfo fi(phpExecutablePath->url());
- if(fi.isExecutable() && (fi.isFile() || fi.isSymLink())){
- TQToolTip::add( kled, i18n("%1 exists and it is executable").arg(phpExecutablePath->url()));
- kled->setColor(green);
- }
- else if (!fi.exists()){
- TQToolTip::add( kled, i18n("%1 does not exist").arg(phpExecutablePath->url()) );
- kled->setColor(red);
- }
- else if (!fi.isExecutable()){
- TQToolTip::add( kled, i18n("%1 is not executable").arg(phpExecutablePath->url()) );
- kled->setColor(red);
- }
- else if (fi.isDir()){
- TQToolTip::add( kled, i18n("%1 is a directory").arg(phpExecutablePath->url()) );
- kled->setColor(red);
- }
- else{
- TQToolTip::add( kled, i18n("%1 is not php executable path").arg(phpExecutablePath->url()) );
- kled->setColor(red);
- }
-}
-}
-#include "webinterfaceprefwidget.moc"
diff --git a/plugins/webinterface/webinterfaceprefwidget.h b/plugins/webinterface/webinterfaceprefwidget.h
deleted file mode 100644
index 0f227ee..0000000
--- a/plugins/webinterface/webinterfaceprefwidget.h
+++ /dev/null
@@ -1,42 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2006 by Diego R. Brogna *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#ifndef WEBINTERFACEPREFWIDGET_H
-#define WEBINTERFACEPREFWIDGET_H
-
-#include "webinterfacepref.h"
-namespace kt
-{
-
- class WebInterfacePrefWidget:public WebInterfacePreference
- {
- TQ_OBJECT
-
- public:
- WebInterfacePrefWidget(TQWidget *parent = 0, const char *name = 0);
- bool apply();
- TQString password;
- public slots:
- void btnUpdate_clicked();
- void changeLedState();
- };
-
-}
-#endif
diff --git a/plugins/webinterface/www/Makefile.am b/plugins/webinterface/www/Makefile.am
deleted file mode 100644
index 8a92573..0000000
--- a/plugins/webinterface/www/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-METASOURCES = AUTO
-SUBDIRS = default mobile coldmilk
-
-
-
diff --git a/plugins/webinterface/www/coldmilk/Makefile.am b/plugins/webinterface/www/coldmilk/Makefile.am
deleted file mode 100644
index d6a5f08..0000000
--- a/plugins/webinterface/www/coldmilk/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDES = -I$(srcdir)/../../libktorrent $(all_includes)
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/coldmilk
-
-ktdata_DATA = favicon.ico icon.png interface.js interface.php login.html page_update.js rest.php shutdown.php style.css
-
-SUBDIRS= icons
diff --git a/plugins/webinterface/www/coldmilk/favicon.ico b/plugins/webinterface/www/coldmilk/favicon.ico
deleted file mode 100644
index 3213b23..0000000
--- a/plugins/webinterface/www/coldmilk/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icon.png b/plugins/webinterface/www/coldmilk/icon.png
deleted file mode 100644
index fbe2294..0000000
--- a/plugins/webinterface/www/coldmilk/icon.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am b/plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am
deleted file mode 100644
index 7380c25..0000000
--- a/plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/coldmilk/icons/16x16/
-
-ktdata_DATA = edit_user.png high_priority.png low_priority.png normal_priority.png only_seed.png
-
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/edit_user.png b/plugins/webinterface/www/coldmilk/icons/16x16/edit_user.png
deleted file mode 100644
index c8135c8..0000000
--- a/plugins/webinterface/www/coldmilk/icons/16x16/edit_user.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/high_priority.png b/plugins/webinterface/www/coldmilk/icons/16x16/high_priority.png
deleted file mode 100644
index 3bb3d2c..0000000
--- a/plugins/webinterface/www/coldmilk/icons/16x16/high_priority.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/low_priority.png b/plugins/webinterface/www/coldmilk/icons/16x16/low_priority.png
deleted file mode 100644
index e6bea7d..0000000
--- a/plugins/webinterface/www/coldmilk/icons/16x16/low_priority.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/normal_priority.png b/plugins/webinterface/www/coldmilk/icons/16x16/normal_priority.png
deleted file mode 100644
index d4dcb20..0000000
--- a/plugins/webinterface/www/coldmilk/icons/16x16/normal_priority.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/only_seed.png b/plugins/webinterface/www/coldmilk/icons/16x16/only_seed.png
deleted file mode 100644
index fae2635..0000000
--- a/plugins/webinterface/www/coldmilk/icons/16x16/only_seed.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am b/plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am
deleted file mode 100644
index 2bd411f..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/coldmilk/icons/22x22/
-
-ktdata_DATA = exit.png ktstart_all.png ktstop_all.png remove.png start.png stop.png
-
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/exit.png b/plugins/webinterface/www/coldmilk/icons/22x22/exit.png
deleted file mode 100644
index 8c8cbd4..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/exit.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/ktstart_all.png b/plugins/webinterface/www/coldmilk/icons/22x22/ktstart_all.png
deleted file mode 100644
index f46ed84..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/ktstart_all.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/ktstop_all.png b/plugins/webinterface/www/coldmilk/icons/22x22/ktstop_all.png
deleted file mode 100644
index 73b548b..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/ktstop_all.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/remove.png b/plugins/webinterface/www/coldmilk/icons/22x22/remove.png
deleted file mode 100644
index 7df1928..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/remove.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/start.png b/plugins/webinterface/www/coldmilk/icons/22x22/start.png
deleted file mode 100644
index a55e49c..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/start.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/stop.png b/plugins/webinterface/www/coldmilk/icons/22x22/stop.png
deleted file mode 100644
index 9c464de..0000000
--- a/plugins/webinterface/www/coldmilk/icons/22x22/stop.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am b/plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am
deleted file mode 100644
index a2b93df..0000000
--- a/plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/coldmilk/icons/32x32/
-
-ktdata_DATA = configure.png extender_opened.png fileopen.png folder1.png
-
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/configure.png b/plugins/webinterface/www/coldmilk/icons/32x32/configure.png
deleted file mode 100644
index d0e5539..0000000
--- a/plugins/webinterface/www/coldmilk/icons/32x32/configure.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/extender_opened.png b/plugins/webinterface/www/coldmilk/icons/32x32/extender_opened.png
deleted file mode 100644
index 9488d81..0000000
--- a/plugins/webinterface/www/coldmilk/icons/32x32/extender_opened.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/fileopen.png b/plugins/webinterface/www/coldmilk/icons/32x32/fileopen.png
deleted file mode 100644
index 9d19a5a..0000000
--- a/plugins/webinterface/www/coldmilk/icons/32x32/fileopen.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/folder1.png b/plugins/webinterface/www/coldmilk/icons/32x32/folder1.png
deleted file mode 100644
index d719405..0000000
--- a/plugins/webinterface/www/coldmilk/icons/32x32/folder1.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am b/plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am
deleted file mode 100644
index 9318a0c..0000000
--- a/plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/coldmilk/icons/48x48/
-
-ktdata_DATA = exit.png switchuser.png
-
diff --git a/plugins/webinterface/www/coldmilk/icons/48x48/exit.png b/plugins/webinterface/www/coldmilk/icons/48x48/exit.png
deleted file mode 100644
index 1b2e5eb..0000000
--- a/plugins/webinterface/www/coldmilk/icons/48x48/exit.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/48x48/switchuser.png b/plugins/webinterface/www/coldmilk/icons/48x48/switchuser.png
deleted file mode 100644
index a1f5b80..0000000
--- a/plugins/webinterface/www/coldmilk/icons/48x48/switchuser.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am b/plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am
deleted file mode 100644
index 3ff3ae0..0000000
--- a/plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/coldmilk/icons/64x64/
-
-ktdata_DATA = down.png folder1_man.png looknfeel.png
-
diff --git a/plugins/webinterface/www/coldmilk/icons/64x64/down.png b/plugins/webinterface/www/coldmilk/icons/64x64/down.png
deleted file mode 100644
index cb1d047..0000000
--- a/plugins/webinterface/www/coldmilk/icons/64x64/down.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/64x64/folder1_man.png b/plugins/webinterface/www/coldmilk/icons/64x64/folder1_man.png
deleted file mode 100644
index 3861718..0000000
--- a/plugins/webinterface/www/coldmilk/icons/64x64/folder1_man.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.png b/plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.png
deleted file mode 100644
index 51c28fe..0000000
--- a/plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/Makefile.am b/plugins/webinterface/www/coldmilk/icons/Makefile.am
deleted file mode 100644
index cbe7db5..0000000
--- a/plugins/webinterface/www/coldmilk/icons/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS= 16x16 22x22 32x32 48x48 64x64
diff --git a/plugins/webinterface/www/coldmilk/interface.js b/plugins/webinterface/www/coldmilk/interface.js
deleted file mode 100644
index 2f361a5..0000000
--- a/plugins/webinterface/www/coldmilk/interface.js
+++ /dev/null
@@ -1,44 +0,0 @@
- function validate(action)
- {
- var msg;
- if (action == "remove_torrent") {
- msg = "Are you sure that you want remove this torrent?";
- }
- else if (action == "quit_program") {
- msg = "Are you sure you want to quit ktorrent?";
- }
- else {
- msg = "Do it?";
- }
- return confirm(msg);
- };
-
- function show(id)
- {
- var items = new Array();
- items[0] = "torrent_list";
- items[1] = "torrents_details";
- items[2] = "preferences";
- items[3] = "torrent_add";
- items[4] = "action";
-
- hide_divs(items);
-
-
- // Show selected
- var item_show = document.getElementById(id);
- item_show.style.display = "";
-
- };
-
- function hide_divs(items) {
- for (var i in items) {
- var item_hide = document.getElementById(items[i]);
- if (item_hide != null && !item_hide.style.display) { // not means it's showing..
- item_hide.style.display = "none";
- }
- }
- return true;
- }
-
-
diff --git a/plugins/webinterface/www/coldmilk/interface.php b/plugins/webinterface/www/coldmilk/interface.php
deleted file mode 100644
index 246f347..0000000
--- a/plugins/webinterface/www/coldmilk/interface.php
+++ /dev/null
@@ -1,251 +0,0 @@
-<?php
- $refresh_rate = 5;
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <title>ktorrent web interface</title>
- <link rel="stylesheet" href="style.css" type="text/css" />
- <meta name="GENERATOR" content="Quanta Plus" />
- <meta http-equiv="Content-Type" content="text/html"/>
- <script type="text/javascript" src="page_update.js"></script>
- <script type="text/javascript" src="interface.js"></script>
-
-</head>
-<body onload="update_interval(<?php echo $refresh_rate; ?>);">
-
-
-<div id="header">
- <div id="logout">
- <img src="icons/16x16/edit_user.png" alt="logout" /> <a href="login.html">Sign out</a>
- </div>
-
- <a href="interface.php">
- <img src="icon.png" alt="reload" title="reload"
- id="header_icon" />
- </a>
-
- <ul>
- <li>
- <img src="icons/32x32/folder1.png" alt="icon" />
- <a href="javascript:show('torrent_list');">Torrents</a>
- </li>
- <li>
- <img src="icons/32x32/configure.png" alt="icon" />
- <a href="javascript:show('preferences');">Preferences</a>
- </li>
-
- <li>
- <img src="icons/32x32/fileopen.png" alt="icon" />
- <a href="javascript:show('torrent_add');">Add torrent</a>
- </li>
- <li>
- <img src="icons/32x32/extender_opened.png" alt="exit" />
- <a href="javascript:show('action');">Action</a>
- </li>
- </ul>
-
- <div id="status_bar">
- <table id="status_bar_table"><tr><td></td></tr></table>
- </div>
-</div>
-
-
-<!-- Torrents -->
-<div id="torrent_list">
- <table id="torrent_list_table" class="list_table">
- <tr><td></td></tr><!--let's be XHTML valid-->
- </table>
-
- <div id="bottom-menu">
- <ul>
- <li>
- <img src="icons/22x22/ktstart_all.png" alt="" />
- <span>
- <a href="interface.php?startall=true">Start all</a>
- </span>
- </li>
- <li>
- <img src="icons/22x22/ktstop_all.png" alt="" />
- <span>
- <a href="interface.php?stopall=true">Stop all</a>
- </span>
- </li>
- </ul>
-
- </div>
-
-</div>
-<!-- end torrents -->
-
-
-<!-- Torrent's details -->
-<div id="torrents_details" style="display : none;">
- <table id="torrents_details_files" class="list_table">
- <tr><td></td></tr><!--let's be XHTML valid-->
- </table>
-</div>
-<!-- end torrent's details -->
-
-
-<!-- Preferences -->
-<div id="preferences" style="display : none;">
- <h2>Preferences</h2>
- <form action="interface.php" method="get">
- <div class="simple_form">
- <img src="icons/64x64/down.png" alt="" />
-
- <h2>Downloads</h2>
-
- <?php $globalinfo = globalinfo() ?>
- <div class="item" style="margin-top : 0em;">
- Upload speed:
- <div class="option">
- <input type="text" name="maximum_upload_rate"
- value="<?php echo $globalinfo['max_upload_speed']; ?>" />
- </div>
- </div>
-
- <div class="item">
- Download speed:
- <div class="option">
- <input type="text" name="maximum_download_rate"
- value="<?php echo $globalinfo['max_download_speed']; ?>" />
- </div>
- </div>
-
- <div class="item">
- Max downloads:
- <div class="option">
- <input type="text" name="maximum_downloads"
- value="<?php echo $globalinfo['max_downloads']; ?>" />
- </div>
- </div>
-
- <div class="item">
- Max seeds
- <div class="option">
- <div style="display : inline;">
- <input type="text" name="maximum_seeds"
- value="<?php echo $globalinfo['max_seeds']; ?>" />
- </div>
- </div>
- </div>
- </div>
-
- <div class="simple_form" style="margin-top : 1em;" >
- <img src="icons/64x64/looknfeel.png" alt="" />
-
- <h2>Web interface</h2>
-
- <div class="hints">
- Note: Disabled for now. If you insist, change $refresh_rate in the file interface.php
- </div>
-
- <div class="item">
- <?php
- $refresh_options = array(
- '2' => '2 seconds',
- '3' => '3 seconds',
- '5' => '5 seconds',
- '10' => '10 seconds',
- '30' => '30 seconds',
- '0' => 'never'
- );
- echo 'Update rate:';
- echo '<div class="option">';
- echo '<select name="refresh_rate" disabled="disabled">';
- foreach(array_keys($refresh_options) as $value) {
- echo '<option value="'.$value.'"';
- if ($refresh_rate == $value) {
- echo ' selected="selected"';
- }
- echo '>'.$refresh_options[$value].'</option>';
- }
- echo '</select>';
- echo '</div>';
- ?>
- </div>
-
- </div>
-
- <div style="margin-top : 1em; float : left; clear : both;">
- <input type="submit" value="Submit preferences" class="buttons"/>
- </div>
- </form>
-</div>
-<!-- end preferences -->
-
-
-<!-- Add Torrent -->
-<div id="torrent_add" style="display : none;">
- <h2>Add a torrent</h2>
-
- <div class="simple_form">
- <img src="icons/64x64/folder1_man.png" alt="" />
- <h3>Load a torrent</h3>
-
- <form action="interface.php" method="get">
- <div class="item">
- URL:
- <div class="option">
- <input type="text" name="load_torrent" style="width : 240px;" />
- <br /><span>Example: http://ktorrent.org/down/latest.torrent</span>
-
- <div style="margin-top : 1em;">
- <input type="submit" value="Load Torrent" />
- </div>
- </div>
- </div>
- </form>
-
- <h3 style="margin-top : 6em;">Upload a torrent</h3>
-
- <form action="interface.php" method="post" enctype="multipart/form-data">
- <div class="item" style="min-height : 5em;">
- File path:
- <div class="option">
- <div style="display : inline;">
- <input type="file" name="load_torrent" style="width:240px;" />
- </div>
-
- <div style="margin-top : 1em;">
- <input type="submit" name="Upload Torrent" value="Upload Torrent" />
- </div>
- </div>
- </div>
- </form>
- </div>
-</div>
-<!-- end add torrent -->
-
-
-<!-- Action -->
-<div id="action" style="display : none;">
- <h2 style="margin-top : 0; padding-top : 0;">Actions</h2>
- <ul>
- <li>
- <img src="icons/48x48/switchuser.png" alt="sign out" />
- <span style="margin-left : 52px;">
- <a href="login.html">Sign out</a></span>
-
-
- </li>
-
- <li>
- <img src="icons/48x48/exit.png" alt="quit" />
- <span style="margin-left : 52px;">
- <a href="shutdown.php?quit=quit" onclick="return validate('quit_program')">
- Quit program
- </a></span>
- </li>
-
- </ul>
-
-</div>
-<!-- end action -->
-
-
-</body>
-</html>
diff --git a/plugins/webinterface/www/coldmilk/login.html b/plugins/webinterface/www/coldmilk/login.html
deleted file mode 100644
index fa95faf..0000000
--- a/plugins/webinterface/www/coldmilk/login.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <title>ktorrent - web interface</title>
- <link rel="stylesheet" href="style.css" type="text/css" />
- <meta name="GENERATOR" content="Quanta Plus" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <script type="text/javascript">
- function focus_login() {
- document.forms["login_form"].elements["username"].focus();
- }
- </script>
-</head>
-<body onload="focus_login();">
-
-
-
-<form action="interface.php" method="post" id="login_form">
-<div class="simple_form">
-
- <img src="icon.png" alt="logo"
- id="icon_right" />
-
- <h2>Log in</h2>
-
-
- <div class="item" style="margin-top : 0em;">
- Username:
- <div class="option">
- <input type="text" name="username" />
- </div>
- </div>
-
- <div class="item" style="min-height : 6em;">
- Password:
- <div class="option">
- <div style="display : inline;">
- <input type="password" name="password" />
- </div>
-
- <div style="margin-top : 1em;">
- <input type="submit" name="Login" value="Sign in" />
- </div>
- </div>
- </div>
-
-
-
-</div>
-</form>
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/webinterface/www/coldmilk/page_update.js b/plugins/webinterface/www/coldmilk/page_update.js
deleted file mode 100644
index c004456..0000000
--- a/plugins/webinterface/www/coldmilk/page_update.js
+++ /dev/null
@@ -1,429 +0,0 @@
- /***************************************************************************
- * Copyright (C) 2007 by Dagur Valberg Johannsson *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-var details_of_torrent = null; //id of torrent which details are displayed
-
-function update_interval(time) {
- update_all();
- if (!time) {
- return;
- }
- var seconds = time * 1000;
- window.setInterval(update_all, seconds);
-}
-
-function update_all() {
- fetch_xml("rest.php?global_status", new Array("update_status_bar", "update_title"));
- fetch_xml("rest.php?download_status", new Array("update_torrent_table"));
-}
-
-function fetch_xml(url, callback_functions) {
- var request = false;
-
- if (window.XMLHttpRequest) { // most browsers
- request = new XMLHttpRequest();
-// if (request.overrideMimeType) {
-// request.overrideMimeType('text/xml');
-// }
- }
-
- else if (window.ActiveXObject) { //ie
- try {
- request = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch(e) {
- try { request = new ActiveXObject("Microsoft.XMLHTTP"); }
- catch(e) { }
- }
- }
-
- if (!request) {
- // Browser doesn't support XMLHttpRequest
- return false;
- }
- request.onreadystatechange = function() {
- if (request.readyState == 4) {
- if (request.status == 200) {
- //overrideMimeType didn't work in Konqueror,
- //so we'll have to parse the response into XML
- //object ourselfs. responseXML won't work.
- var xmlstring = request.responseText;
- var xmldoc;
- if (window.DOMParser) {
- xmldoc = (new DOMParser())
- .parseFromString(xmlstring, "text/xml");
- }
- else if (window.ActiveXObject) { //ie
- xmldoc = new ActiveXObject("Microsoft.XMLDOM");
- xmldoc.async = false;
- xmldoc.loadXML(xmlstring);
- }
-
- for (var i in callback_functions) {
- eval(callback_functions[i] + "(xmldoc)");
- }
-
- }
- else {
- // could not fetch
- }
- }
- }
-
- request.open('GET', url, true);
- request.send(null);
-}
-
-function update_title(xmldoc) {
- var down = _get_text(xmldoc, 'download_speed').data;
- var up = _get_text(xmldoc, 'upload_speed').data;
- var new_title = "(D: " + down + ") (U: " + up + ") - ktorrent web interface";
- document.title = new_title;
-}
-
-function update_status_bar(xmldoc) {
- var newtable = document.createElement('table');
- newtable.setAttribute('id', 'status_bar_table');
-
-
- //dht and encryption
- {
- var row = newtable.insertRow(0);
- var cell = row.insertCell(0);
- var dht = _get_text_from_attribute(xmldoc, 'dht', 'status').data;
- var encryption = _get_text_from_attribute(xmldoc, 'encryption', 'status').data;
- cell.appendChild(
- document.createTextNode("DHT : " +dht));
- cell = row.insertCell(1);
- cell.appendChild(
- document.createTextNode("Encryption : " + encryption));
- }
- //speed down/up
- {
- var row = newtable.insertRow(1);
- var cell = row.insertCell(0);
- cell.appendChild(
- document.createTextNode("Speed"));
-
- cell = row.insertCell(1);
- var down = _get_text(xmldoc, 'download_speed').data;
- var up = _get_text(xmldoc, 'upload_speed').data;
- cell.appendChild(
- document.createTextNode("down: " + down + " / up: " + up));
- }
- //transferred
- {
- var row = newtable.insertRow(2);
- var cell = row.insertCell(0);
- cell.appendChild(
- document.createTextNode("Transferred"));
-
- cell = row.insertCell(1);
- var down = _get_text(xmldoc, 'downloaded_total').data;
- var up = _get_text(xmldoc, 'uploaded_total').data;
- cell.appendChild(
- document.createTextNode("down: " + down + " / up: " + up));
- }
- var oldtable = document.getElementById('status_bar_table');
- oldtable.parentNode.replaceChild(newtable, oldtable);
-}
-
-function update_torrent_table(xmldoc) {
-
- var newtable = document.createElement('table');
- newtable.setAttribute('id', 'torrent_list_table');
- newtable.className='list_table';
-
- var torrents = xmldoc.getElementsByTagName('torrent');
- var i = 0;
- while (torrents[i]) {
- _torrent_table_row(torrents[i], newtable, i);
- i++;
- }
- _torrent_table_header(newtable.insertRow(0));
-
- var oldtable = document.getElementById('torrent_list_table');
- oldtable.parentNode.replaceChild(newtable, oldtable);
-}
-
-function _torrent_table_row(torrent, table, i) {
- var row = table.insertRow(i);
- var row_color = (i % 2) ?
- "#ffffff" : "#dce4f9";
- row.setAttribute("style", "background-color : " + row_color);
-
- //actions
- {
- var cell = row.insertCell(0);
- var can_start = (_get_text(torrent, 'running').data) ? 0 : 1; //if torrent is running we can't start it
- var can_stop = (can_start==1) ? 0 : 1; //opposite of can_start
- var start_button = _create_action_button('Start', 'start.png', (can_start==1) ? 'start='+i : '');
- var stop_button = _create_action_button('Stop', 'stop.png', (can_stop==1) ? 'stop='+i : '');
- var remove_button = _create_action_button('Remove', 'remove.png', 'remove='+i);
- remove_button.setAttribute("onclick", "return validate('remove_torrent')");
-
- cell.appendChild(start_button);
- cell.appendChild(stop_button);
- cell.appendChild(remove_button);
- }
-
- //file
- {
- var cell = row.insertCell(1);
- var file = document.createElement('a');
- file.setAttribute('href', '#');
- file.appendChild(_get_text(torrent, 'name'));
- file.onclick = function()
- {
- show('torrents_details');
- fetch_xml("rest.php?torrents_details="+i, new Array("get_torrents_details"));
- details_of_torrent = i;
- };
- cell.appendChild(file);
- }
-
- //status
- {
- var cell = row.insertCell(2);
- cell.appendChild(
- _get_text(torrent, 'status'));
- }
-
- //speed
- {
- var cell = row.insertCell(3);
-
- cell.appendChild(
- _get_text(torrent, 'download_rate'));
- cell.appendChild(document.createElement('br'));
- cell.appendChild(
- _get_text(torrent, 'upload_rate'));
- }
-
- //size
- {
- var cell = row.insertCell(4);
- cell.appendChild(
- _get_text(torrent, 'size'));
- }
-
- //peers
- {
- var cell = row.insertCell(5);
- cell.appendChild(
- _get_text(torrent, 'peers'));
- }
-
- //transferred
- {
- var cell = row.insertCell(6);
-
- cell.appendChild(
- _get_text(torrent, 'downloaded'));
- cell.appendChild(document.createElement('br'));
- cell.appendChild(
- _get_text(torrent, 'uploaded'));
- }
-
- //done
- {
- var cell = row.insertCell(7);
- cell.setAttribute("style", "padding-right : 2px;");
-
- var percent_done
- = _get_text_from_attribute(torrent, 'downloaded', 'percent').data;
-
- var bar = document.createElement('div');
- bar.setAttribute("class", "percent_bar");
- bar.setAttribute("style", "width : " + percent_done + "%;");
- cell.appendChild(bar);
-
- var bar_text = document.createElement('div');
- bar_text.appendChild(
- document.createTextNode(percent_done + "%"));
-
- bar.appendChild(bar_text);
- }
-}
-
-//function called after changing file priority to refresh list of files (and priorities)
-function just_refresh_details(xmldoc) {
- if (details_of_torrent!=null)
- fetch_xml("rest.php?torrents_details="+details_of_torrent, new Array("get_torrents_details"));
-}
-
-function get_torrents_details(xmldoc) {
- var newtable = document.createElement('table');
- newtable.setAttribute('id', 'torrents_details_files');
- newtable.className='list_table';
-
- var id = xmldoc.getElementsByTagName('torrents_details')[0].getAttribute('id');
- var files = xmldoc.getElementsByTagName('file');
- for(var i=0; i<files.length; i++)
- {
- var row = newtable.insertRow(i);
- row.style.backgroundColor=(i % 2) ? '#ffffff' : '#dce4f9';
- var cell = row.insertCell(-1);
-
- var file_status = _get_text(files[i], 'status').data;
- var command; //we call ?file_xx - this call is detected by server and priority is being changed
-
- command = (file_status==50)?'':'rest.php?file_hp='+id+'-'+i;
- var high_prior = _create_file_action_button('/icons/16x16/high_priority.png', 'High Priority', command);
- cell.appendChild(high_prior);
-
- command = (file_status==40)?'':'rest.php?file_np='+id+'-'+i;
- var normal_prior = _create_file_action_button('/icons/16x16/normal_priority.png', 'Normal Priority', command);
- cell.appendChild(normal_prior);
-
- command = (file_status==30)?'':'rest.php?file_lp='+id+'-'+i;
- var low_prior = _create_file_action_button('/icons/16x16/low_priority.png', 'Low Priority', command);
- cell.appendChild(low_prior);
-
- command = (file_status==20 || file_status==10)?'':'rest.php?file_stop='+id+'-'+i;
- var dnd = _create_file_action_button('/icons/16x16/only_seed.png', 'Stop downloading (Only Seed Priority)', command);
- cell.appendChild(dnd);
-
- var cell = row.insertCell(-1);
- cell.appendChild(_get_text(files[i], 'name'));
- var cell = row.insertCell(-1);
- cell.appendChild(_get_text(files[i], 'size'));
- var cell = row.insertCell(-1);
-
- if (_get_text(files[i], 'perc_done').data!='')
- cell.appendChild(_get_text(files[i], 'perc_done'));
- else
- cell.appendChild(document.createTextNode("0"));
- cell.appendChild(document.createTextNode("%"));
- var cell = row.insertCell(-1);
-
- cell.appendChild(document.createTextNode(_get_file_status_name(file_status)));
- }
-
- _torrents_details_header(newtable.insertRow(0));
-
- /*var torrents = xmldoc.getElementsByTagName('torrent');
- var i = 0;
- while (torrents[i]) {
- _torrent_table_row(torrents[i], newtable, i);
- i++;
- }
- _torrent_table_header(newtable.insertRow(0));*/
-
- var oldtable = document.getElementById('torrents_details_files');
- oldtable.parentNode.replaceChild(newtable, oldtable);
-}
-
-function _create_action_button(button_name, image_src, command) {
- var image = document.createElement("img");
- image.setAttribute("src", "icons/22x22/" + image_src);
- image.setAttribute("alt", button_name);
- image.setAttribute("title", button_name);
- if (command != '')
- {
- var a = document.createElement("a");
- a.setAttribute("href", "interface.php?" + command);
- a.appendChild(image);
- return a;
- }
- else
- return image;
-}
-
-function _create_file_action_button(img_src, img_alt, command) {
- var image = document.createElement("img");
- image.setAttribute("src", img_src);
- image.setAttribute("alt", img_alt);
- image.setAttribute("title", img_alt);
- if (command != '')
- {
- var a = document.createElement("a");
- a.setAttribute("href", "#");
- a.onclick = function()
- {
- fetch_xml(command, new Array("just_refresh_details"));
- };
- a.appendChild(image);
- return a;
- }
- else
- return image;
-}
-
-// gets element with given tag and crates text node from it
-function _get_text(element, tag) {
- var text_node;
- try {
- text_node = document.createTextNode(
- element.getElementsByTagName(tag)[0].firstChild.data);
- }
- catch (e) {
- text_node = document.createTextNode('');
- }
- return text_node;
-}
-
-function _get_text_from_attribute(element, tag, attribute) {
- var text_node;
- try {
- text_node = document.createTextNode(
- element.getElementsByTagName(tag)[0].getAttribute(attribute));
- }
- catch (e) {
- text_node = document.createTextNode('');
- }
- return text_node;
-}
-
-function _get_file_status_name(status_id)
-{
- if (status_id==60) return 'PREVIEW_PRIORITY';
- else if (status_id==50) return 'Download First';
- else if (status_id==40) return 'Download Normally';
- else if (status_id==30) return 'Download Last';
- else if (status_id==20) return 'Only Seed';
- else if (status_id==10) return 'Do Not Download';
- else return 'Not supported file status';
-}
-
-function _torrents_details_header(row) {
- headers = new Array("Actions", "File", "Size", "Perc done", "Status");
- for (var i in headers) {
- var header = document.createElement("th");
- header.appendChild(document.createTextNode(headers[i]));
- row.appendChild(header);
- }
- return row;
-}
-
-function _torrent_table_header(row) {
- headers = new Array(
- "Actions", "File", "Status",
- "Speed", "Size", "Peers",
- "Transferred", "% done"
- );
-
- for (var i in headers) {
- var header = document.createElement("th");
- header.appendChild(
- document.createTextNode(headers[i]));
- row.appendChild(header);
- }
- return row;
-}
diff --git a/plugins/webinterface/www/coldmilk/rest.php b/plugins/webinterface/www/coldmilk/rest.php
deleted file mode 100644
index bab7e68..0000000
--- a/plugins/webinterface/www/coldmilk/rest.php
+++ /dev/null
@@ -1,265 +0,0 @@
-<?php
-
- /***************************************************************************
- * Copyright (C) 2007 by Dagur Valberg Johannsson *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-/**
- * Simple REST interface.
- */
-
-$rest_commands = array(
- "global_status",
- "download_status",
- "torrents_details"
-);
-
-if (!array_keys($_REQUEST)) {
- header("Content-Type: text/html");
- print "<html><body>
- Usage: rest.php?command<br />
- Available commands: ";
- foreach ($rest_commands as $command)
- print "$command ";
-
- print "</body></html>";
-}
-
-else {
- header("Content-Type: text/xml");
- $rest = new RestInterface();
- foreach($_REQUEST as $command=>$arg)
- {
- if (in_array($command, $rest_commands))
- print $rest->$command($arg);
- else
- print "Unknown command " . htmlentities($command) . "<br />";
-
- }
-}
-
-// classes
-
-class RestInterface {
- public function global_status() {
- $info = globalinfo();
- $common = new Common();
-
- $down_speed = $info['download_speed'];
- $up_speed = $info['upload_speed'];
-
- $down_total
- = $common->bytes_to_readable($info['bytes_downloaded']);
- $up_total
- = $common->bytes_to_readable($info['bytes_uploaded']);
-
- $dht = $info['dht_support'] ? "on" : "off";
- $encryption = $info['use_encryption'] ? "on" : "off";
-
- $xml = new KTorrentXML('status_bar');
-
- $elements = array(
- $xml->new_element('download_speed' , $down_speed),
- $xml->new_element('upload_speed' , $up_speed),
- $xml->new_element('downloaded_total', $down_total),
- $xml->new_element('uploaded_total', $up_total),
-
- $xml->new_element('dht', null, array('status' => $dht)),
- $xml->new_element('encryption', null, array('status' => $encryption)),
- );
-
- foreach($elements as $element) {
- $xml->append_to_root($element);
- }
-
- return $xml->saveXML();
-
- }
-
- public function download_status() {
- $download_status = downloadstatus();
- $xml = new KTorrentXML('download_status');
- foreach($download_status as $torrent) {
- $torrent_xml = $xml->new_element('torrent');
- $xml->append_to_root($torrent_xml);
-
-// foreach(array_keys($torrent) as $key) {
-// $torrent_xml->appendChild(
-// $xml->new_element("raw_$key", $torrent[$key]));
-// }
-
- $status = $torrent['status'];
- $done = $torrent['bytes_downloaded'];
- $total_bytes = $torrent['total_bytes_to_download'];
- $bytes_left = $torrent['bytes_left_to_download'];
- $elements = array(
-
- $xml->new_element('name',
- $this->_clean_name($torrent['torrent_name'])),
-
- $xml->new_element('status',
- $this->_torrent_status($status), array('id' => $status)),
-
- $xml->new_element('running', $torrent['running']),
- $xml->new_element('download_rate', $torrent['download_rate']." down"),
- $xml->new_element('upload_rate', $torrent['upload_rate']." up"),
- $xml->new_element('size', $torrent['total_bytes']),
- $xml->new_element('peers', $torrent['num_peers']),
- $xml->new_element('uploaded', $torrent['bytes_uploaded']." uploaded"),
-
-
- $xml->new_element('downloaded',
- "$done downloaded",
- array('percent' => $this->_get_percent_done($total_bytes, $bytes_left))),
- );
-
- foreach($elements as $element) {
- $torrent_xml->appendChild($element);
- }
- }
-
- return $xml->saveXML();
-
- }
-
- public function torrents_details($torrent_id) {
- $xml = new KTorrentXML('torrents_details', null, array('id'=>$torrent_id));
- $download_status = downloadstatus();
- if (isset($download_status[$torrent_id]))
- foreach($download_status[$torrent_id]['files'] as $id=>$info)
- {
- $file_xml = $xml->new_element('file', '', array('id'=>$id));
- $xml->append_to_root($file_xml);
- foreach($info as $key=>$val)
- $file_xml->appendChild($xml->new_element($key, $val));
- }
- return $xml->saveXML();
- }
-
- // Helper function for download_status
- private function _torrent_status($status_id) {
- $status = array(
- 0 => "Not started",
- 1 => "Seeding Complete",
- 2 => "Download Complete",
- 3 => "Seeding",
- 4 => "Downloading",
- 5 => "Stalled",
- 6 => "Stopped",
- 7 => "Allocating Diskspace",
- 8 => "Error",
- 9 => "Queued",
- 10 => "Checking Data"
- );
-
- return $status[$status_id];
- }
-
-
- // Truncate long torrent name, and HTML escape it.
- // This is a helper function for download_status.
- private function _clean_name($name) {
- $name = str_replace("'", "\'", $name);
- if (strlen($name) > 30) {
- $name = substr($name, 0, 27);
- $name .= "...";
- }
- $name = htmlspecialchars($name);
- return $name;
- }
-
- // Calculate percent done.
- // Helper function for download_status
- private function _get_percent_done($bytes_total, $bytes_left) {
- if($bytes_total) {
- $perc_done = round(100.0 - ($bytes_left / $bytes_total) * 100);
- return $perc_done;
- }
- else {
- return 0;
- }
- }
-}
-
-
-/**
- * Class to build a xml tree
- */
-class KTorrentXML extends DomDocument {
- private $root_element;
- public function __construct($root, $value = null, $attributes = null) {
- parent::__construct('1.0');
- $this->root_element = $this->createElement($root);
- $this->appendChild($this->root_element);
- $this->formatOutput = true;
-
- if ($attributes)
- foreach($attributes as $key=>$val)
- $this->root_element->setAttribute($key, $val);
- }
-
- // Creates an element, and returns it.
- public function new_element($name, $value = null, $attributes = null) {
- $element = $this->createElement($name);
- if ($value) {
- $element->appendChild($this->createTextNode($value));
- }
- if ($attributes) {
- foreach(array_keys($attributes) as $key) {
- $element->setAttribute($key, $attributes[$key]);
- }
- }
- return $element;
- }
-
- // Append a given element to the root element of the xml file.
- public function append_to_root($element) {
- $this->root_element->appendChild($element);
- }
-
-}
-
-/**
- * Generic functions
- */
-class Common {
- function bytes_to_readable($bytes) {
- if ($bytes < 1024) {
- return round($bytes, 2) . " bytes";
- }
-
- else if (($kb = ($bytes / 1024)) < 1024) {
- return round($kb, 2) . " KB";
- }
-
- else if (($mb = ($kb / 1024)) < 1024) {
- return round($mb, 2) . " MB";
- }
-
- else {
- $gb = round($mb / 1024, 2);
- return "$gb GB";
- }
- }
-
- function kb_to_readable($kbytes) {
- return Common::bytes_to_readable($kbytes * 1024);
- }
-}
-
-?> \ No newline at end of file
diff --git a/plugins/webinterface/www/coldmilk/shutdown.php b/plugins/webinterface/www/coldmilk/shutdown.php
deleted file mode 100644
index 92862c4..0000000
--- a/plugins/webinterface/www/coldmilk/shutdown.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
- <title>ktorrent - web interface</title>
- <link rel="stylesheet" href="style.css" type="text/css" />
- <meta name="GENERATOR" content="Quanta Plus" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
-</head>
-<body>
-
-
-<div id="action" style="min-height : 130px;">
- <img src="icon.png" alt="" style="float : left; border : 0px solid;" />
- <span style="font-size : x-large; margin-left : 50px;">Goodbye!</span>
-</div>
-
-</form>
-</body>
-</html>
diff --git a/plugins/webinterface/www/coldmilk/style.css b/plugins/webinterface/www/coldmilk/style.css
deleted file mode 100644
index 69010dc..0000000
--- a/plugins/webinterface/www/coldmilk/style.css
+++ /dev/null
@@ -1,212 +0,0 @@
-body {
- font-family : sans-serif;
- color : black;
- background-color : white;
- }
-
-A:link { color : blue; }
-A:visited { color : blue; }
-A:active { color : blue; }
-
-
-
-#header {
- min-height : 130px;
- }
-
-
-#header #logout {
- position : absolute;
- top : 1px;
- right : 0.5em;
- }
-
-
-#header #header_icon {
- float : left;
- margin-left : 1em;
- border : 0px solid;
- }
-
-#header ul {
- display : inline;
- font-size : large;
- list-style-type : none;
-}
-
-
-#header li {
- display : inline;
- margin-right : 0.5em;
- }
-
-
-#header #status_bar {
- font-family : monospace;
- font-size : small;
- color : #636363;
- border : 1px solid;
- border-color : silver;
- background-color : white;
- }
-
-
-.list_table {
- border-collapse : collapse;
- width : 100%;
- }
-
-
-.list_table th {
- text-align : left;
- }
-
-
-.list_table img {
- border : 0px solid;
- padding : 2px;
- }
-
-
-.list_table .percent_bar {
- background-color : #a5d3b4;
- float : left;
- position : relative;
- color : inherit;
-}
-
-.list_table img {
- opacity: 0.4;
-}
-
-.list_table a img {
- opacity: 1.0;
-}
-
-#bottom-menu {
- margin-top : 1em;
- }
-
-
-#bottom-menu ul {
- list-style-type : none;
- padding : 0;
- margin : 0;
- }
-
-
-#bottom-menu li {
- padding : 0.5em;
- border : 1px solid;
- border-color : silver;
- display : inline;
- position : relative;
- background-color : #f5f5f5;
- margin-right : 0.5em;
- color : blue;
-}
-
-
-#bottom-menu img {
- position : absolute;
- top : 0.2em;
- left : 0.5em;
- }
-
-
-#bottom-menu span {
- vertical-align : middle;
- margin-left : 30px;
- }
-
-
-.simple_form {
- border : 1px solid;
- border-color : silver;
- width : 60%;
- float : left;
- padding : 1em;
- background-color : #f5f5f5;
- clear : left;
- color : black;
- }
-
-.simple_form h2, .simple_form h3 {
- margin : 0 0 0.5em 0;
- padding : 0;
-}
-
-
-.simple_form img {
- float : right;
- margin-right : 1em;
- border : 0px solid;
- }
-
-
-.simple_form .item {
- position : relative;
- margin-top : 0.5em;
- }
-
-
-.simple_form .item .option {
- position : absolute;
- top : 0px;
- left: 30%;
- }
-
-
-.simple_form .item .option span {
- font-size : small;
- color : #333333;
- background-color : inherit;
- }
-
-.simple_form .hints {
- font-size : small;
- background-color : #FDFDFD;
- color : inherit;
-}
-
-#action {
- border : 1px solid;
- border-color : silver;
- clear : both;
- width : 60%;
- margin-left : 20%;
- padding : 1em;
- background-color : #f5f5f5;
- color : inherit;
-}
-
-#action ul {
- list-style-type : none;
- margin : 0;
- padding-left : 0;
- padding-bottom : 1em;
-}
-
-#action li {
- margin-top : 0.25em;
- margin-bottom : 0.25em;
- border : 1px solid;
- border-color : silver;
- min-height : 48px;
- padding : 0.5em;
- background-color : #FDFDFD;
- color : inherit;
-
-}
-
-#action li span {
- font-size : x-large;
- vertical-align : middle;
- padding-top : 20px;
-}
-
-#action img {
- float : left;
- clear : both;
- border : 0px solid;
-} \ No newline at end of file
diff --git a/plugins/webinterface/www/default/Makefile.am b/plugins/webinterface/www/default/Makefile.am
deleted file mode 100644
index 01f09df..0000000
--- a/plugins/webinterface/www/default/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDES = -I$(srcdir)/../../libktorrent $(all_includes)
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/default
-
-ktdata_DATA = details.php only_seed.png favicon.ico grad1.jpg grad2.jpg menu_bg.png \
- header_tile.png high_priority.png icon.png interface.php ktorrentwebinterfacelogo.png \
- login.html low_priority.png normal_priority.png remove.png shutdown.php start.png \
- stop.png style.css stylen.css wz_tooltip.js
diff --git a/plugins/webinterface/www/default/details.php b/plugins/webinterface/www/default/details.php
deleted file mode 100644
index a19d57e..0000000
--- a/plugins/webinterface/www/default/details.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-$stats=downloadStatus();
-$num_torrent=$_REQUEST['torrent'];
-
-function cut_name_if_long($string)
-{
- if(strlen($string)>30) return substr($string, 0, 30).'...';
- else return $string;
-}
-
-function get_file_status_name($status_id)
-{
- $table = array(
- 60 => 'PREVIEW_PRIORITY',
- 50 => 'Download First',
- 40 => 'Download Normally',
- 30 => 'Download Last',
- 20 => 'Only Seed',
- 10 => 'Do Not Download'
- );
- if (array_key_exists($status_id, $table)) return $table[$status_id];
- else return 'Not supported file status';
-}
-
-function generate_file_prior_button_code($img, $alt, $href='')
-{
- $img = '<img src="'.htmlspecialchars($img).'" alt="'.htmlspecialchars($alt).'" />';
- if (empty($href)) return $img;
- else return '<a href="'.htmlspecialchars($href).'">'.$img.'</a>';
-}
-
-$display_name=cut_name_if_long($stats[$num_torrent]['torrent_name']);
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<style type="text/css" media="all">
- @import "stylen.css";
-</style>
-<meta http-equiv="Content-Type" content="text/html" />
-<link rel="icon" href="favicon.ico" type="image/x-icon" />
-<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
-<title><?php echo 'KTorrent: Details for '.$display_name; ?></title>
-</head>
-<body>
- <div id="top_bar">WebInterface KTorrent plugin</div>
- <div id="icon"><img src="icon.png" alt="" /></div>
- <div id="header">
- <strong>KTorrent WebInterface</strong>
- <br />
- <small>BitTorrent client for KDE</small>
- </div>
- <ul id="menu">
- <li><a href="interface.php" title="BACK">Back</a></li>
- <li><a href="login.html" title="LOGOUT">Logout</a></li>
- </ul>
- <div id="content">
- <table>
- <tr>
- <th>Actions</th>
- <th>File</th>
- <th>Status</th>
- <th>Size</th>
- <th>Complete</th>
- </tr>
-<?php
- foreach($stats[$num_torrent]['files'] as $id => $file)
- {
- echo "\t\t".'<tr>'."\n\t\t\t";
- echo '<td class="actions">';
- echo generate_file_prior_button_code('/high_priority.png', 'High Priority', $file['status']==50?'':"details.php?file_hp=$num_torrent-$id&torrent=$num_torrent");
- echo generate_file_prior_button_code('/normal_priority.png', 'Normal Priority', $file['status']==40?'':"details.php?file_np=$num_torrent-$id&torrent=$num_torrent");
- echo generate_file_prior_button_code('/low_priority.png', 'Low Priority', $file['status']==30?'':"details.php?file_lp=$num_torrent-$id&torrent=$num_torrent");
- echo generate_file_prior_button_code('/only_seed.png', 'Stop downloading (Only Seed Priority)', ($file['status']==20||$file['status']==10)?'':"details.php?file_stop=$num_torrent-$id&torrent=$num_torrent");
- echo '</td>';
- echo '<td>'.htmlspecialchars(cut_name_if_long($file['name'])).'</td>';
- echo '<td>'.get_file_status_name($file['status']).'</td>';
- echo '<td style="text-align:right;">'.$file['size'].'</td>';
- echo '<td style="text-align:right;">'.round($file['perc_done'], 2).' %</td>';
- echo "\n\t\t".'</tr>'."\n";
- }
- ?>
- </table>
- </div>
- <div id="footer">&#169; 2006 WebInterface KTorrent plugin</div>
-</body>
-</html>
diff --git a/plugins/webinterface/www/default/favicon.ico b/plugins/webinterface/www/default/favicon.ico
deleted file mode 100644
index 3213b23..0000000
--- a/plugins/webinterface/www/default/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/grad1.jpg b/plugins/webinterface/www/default/grad1.jpg
deleted file mode 100644
index 762baa0..0000000
--- a/plugins/webinterface/www/default/grad1.jpg
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/grad2.jpg b/plugins/webinterface/www/default/grad2.jpg
deleted file mode 100644
index bc4d77e..0000000
--- a/plugins/webinterface/www/default/grad2.jpg
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/header_tile.png b/plugins/webinterface/www/default/header_tile.png
deleted file mode 100644
index 9dd45b6..0000000
--- a/plugins/webinterface/www/default/header_tile.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/high_priority.png b/plugins/webinterface/www/default/high_priority.png
deleted file mode 100644
index 3bb3d2c..0000000
--- a/plugins/webinterface/www/default/high_priority.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/icon.png b/plugins/webinterface/www/default/icon.png
deleted file mode 100644
index fbe2294..0000000
--- a/plugins/webinterface/www/default/icon.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/interface.php b/plugins/webinterface/www/default/interface.php
deleted file mode 100644
index 6432798..0000000
--- a/plugins/webinterface/www/default/interface.php
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-$globalinfo=globalInfo();
-$stats=downloadStatus();
-
-function get_torrent_status_name($status_id)
-{
- $table = array(
- 0 => 'Not Started',
- 1 => 'Seeding Complete',
- 2 => 'Download Complete',
- 3 => 'Seeding',
- 4 => 'Downloading',
- 5 => 'Stalled',
- 6 => 'Stopped',
- 7 => 'Allocating Diskspace',
- 8 => 'Error',
- 9 => 'Queued',
- 10 => 'Checking Data'
- );
- if (array_key_exists($status_id, $table)) return $table[$status_id];
- else return 'Not supported Status';
-}
-
-function generate_button_code($img, $alt, $href='')
-{
- $img = '<img src="'.htmlspecialchars($img).'" alt="'.htmlspecialchars($alt).'" />';
- if (empty($href)) return $img;
- else return '<a href="'.htmlspecialchars($href).'">'.$img.'</a>';
-}
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<style type="text/css" media="all">
- @import "stylen.css";
-</style>
-<meta http-equiv="Content-Type" content="text/html" />
-<link rel="icon" href="favicon.ico" type="image/x-icon" />
-<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
-<title><?php echo '(D:'.$globalinfo['download_speed'].') (U:'.$globalinfo['upload_speed'].') KTorrent'; ?></title>
-<script type="text/javascript">
- function validate()
- {
- msg = "Are you absolutely sure that you want to remove this torrent?";
- return confirm(msg);
- }
- function validate_shutdown()
- {
- msg = "Are you absolutely sure that you want to shutdown KTorrent?";
- return confirm(msg);
- }
-</script>
-</head>
-<body>
- <div id="top_bar">WebInterface KTorrent plugin</div>
- <div id="icon"><img src="icon.png" alt="" /></div>
- <div id="header">
- <strong>KTorrent WebInterface</strong>
- <br />
- <small>BitTorrent client for KDE</small>
- </div>
- <ul id="menu">
- <li><a href="shutdown.php?quit=quit" class="shutdown" title="Shutdown KTorrent" onclick="return validate_shutdown()">Shutdown</a></li>
- <li><a href="interface.php" title="REFRESH">Refresh</a></li>
- <li><a href="login.html" title="LOGOUT">Logout</a></li>
- </ul>
- <div id="sidebar">
- <div class="box">
- <h2>Torrent control</h2>
- <form action="interface.php" method="get" style="text-align: center;">
- <input type="submit" name="startall" value="Start All" />
- </form>
- <hr />
- <form action="interface.php" method="get" style="text-align: center;">
- <input type="submit" name="stopall" value="Stop All" />
- </form>
- </div>
- <div class="box">
- <h2>Settings</h2>
- <form action="interface.php" method="get">
- <label>Upload speed <input type="text" name="maximum_upload_rate" value="<?php echo $globalinfo['max_upload_speed']; ?>" class="settingsInput" /></label>
- <label>Download speed <input type="text" name="maximum_download_rate" value="<?php echo $globalinfo['max_download_speed']; ?>" class="settingsInput" /></label>
- <label>Maximum downloads <input type="text" name="maximum_downloads" value="<?php echo $globalinfo['max_downloads']; ?>" class="settingsInput" /></label>
- <label>Maximum seeds <input type="text" name="maximum_seeds" value="<?php echo $globalinfo['max_seeds']; ?>" class="settingsInput" /></label>
- <input type="submit" value="Submit settings" />
- </form>
- </div>
- <div class="box">
- <h2>Load torrents</h2>
- <form action="interface.php" method="get">
- <label class="wide">Torrent URL: <input type="text" name="load_torrent" /></label>
- <input type="submit" value="Load Torrent" />
- </form>
- <hr />
- <form method="post" enctype="multipart/form-data" action="interface.php">
- <label class="wide">Local File:<input type="file" name="load_torrent" /></label>
- <input type="submit" name="Upload Torrent" value="Upload Torrent" />
- </form>
- </div>
- </div>
- <div id="content">
- <table>
- <tr>
- <th>Actions</th>
- <th>File</th>
- <th>Status</th>
- <th>Downloaded</th>
- <th>Size</th>
- <th>Uploaded</th>
- <th>Down Speed</th>
- <th>Up Speed</th>
- <th>Peers</th>
- <th>Complete</th>
- </tr>
-<?php
- $a = 0;
- foreach ($stats as $torrent) {
- echo "\t\t".'<tr>'."\n\t\t\t";
-
- $torrent_name = str_replace("'", "\'", $torrent['torrent_name']);
- if($torrent['total_bytes_to_download']!=0) $perc = round(100.0 - ($torrent['bytes_left_to_download'] / $torrent['total_bytes_to_download']) * 100.0, 2);
- else $perc = 0;
- if(strlen($torrent['torrent_name'])>30) $display_name=substr($torrent['torrent_name'], 0, 30)." ...";
- else $display_name=$torrent['torrent_name'];
- if ($torrent['num_files']>1) $file_td_content = '<a href="details.php?torrent='.$a.'">'.$display_name.'</a>';
- else $file_td_content = $display_name;
-
- echo '<td class="actions">';
- echo generate_button_code('/stop.png', 'stop', ($torrent['running'])?'interface.php?stop='.$a:'');
- echo generate_button_code('/start.png', 'start', ($torrent['running'])?'':'interface.php?start='.$a);
- echo '<a href="interface.php?remove='.$a.'" onclick="return validate()"><img src="/remove.png" alt="remove" /></a>';
- echo '</td>';
- echo "<td style=\"text-align:left;\" onmouseover=\"this.T_TITLE='$torrent_name';return escape('Download speed:&lt;strong&gt;{$torrent['download_rate']}&lt;/strong&gt;&lt;br /&gt; Upload speed:&lt;strong&gt;{$torrent['upload_rate']}&lt;/strong&gt;&lt;/td&gt;')\">$file_td_content</td>";
- echo '<td>'.get_torrent_status_name($torrent['status']).'</td>';
- echo '<td style="text-align:right;">'.$torrent['bytes_downloaded'].'</td>';
- echo '<td style="text-align:right; padding-left:8px;">'.$torrent['total_bytes'].'</td>';
- echo '<td style="text-align:right; padding-left:8px;">'.$torrent['bytes_uploaded'].'</td>';
- echo '<td style="text-align:right;">'.$torrent['download_rate'].'</td>';
- echo '<td style="text-align:right;">'.$torrent['upload_rate'].'</td>';
- echo '<td>'.$torrent['num_peers'].'</td>';
- echo '<td style="text-align:right;">'.$perc.'% </td>';
- echo "\n\t\t".'</tr>'."\n";
- $a++;
- }
- ?>
- </table>
- </div>
- <div id="footer">&#169; 2006 WebInterface KTorrent plugin</div>
- <script type="text/javascript" src="wz_tooltip.js"></script>
-</body>
-</html>
diff --git a/plugins/webinterface/www/default/ktorrentwebinterfacelogo.png b/plugins/webinterface/www/default/ktorrentwebinterfacelogo.png
deleted file mode 100644
index 6146fb1..0000000
--- a/plugins/webinterface/www/default/ktorrentwebinterfacelogo.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/login.html b/plugins/webinterface/www/default/login.html
deleted file mode 100644
index 93ac1e6..0000000
--- a/plugins/webinterface/www/default/login.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<title>KTorrent WebInterface - Login</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" type="text/css" href="style.css" />
-<script type="text/javascript">
- var was_focused = false;
- function try_focus_form()
- {
- if (!was_focused)
- {
- document.forms["loginForm"].elements["username"].focus();
- was_focused = true;
- }
- }
-</script>
-</head>
-<body onload="try_focus_form();">
- <form id="loginForm" action="interface.php" method="post">
- <table style="padding-left:100px; padding-top: 350px;">
- <tr><td>Username:</td><td><input type="text" name="username" onfocus="was_focused = true;" /></td></tr>
- <tr><td>Password:</td><td><input type="password" name="password" /></td></tr>
- <tr><td></td><td><input type="submit" value="Login" /></td></tr>
- </table>
- </form>
-</body>
-</html>
diff --git a/plugins/webinterface/www/default/low_priority.png b/plugins/webinterface/www/default/low_priority.png
deleted file mode 100644
index e6bea7d..0000000
--- a/plugins/webinterface/www/default/low_priority.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/menu_bg.png b/plugins/webinterface/www/default/menu_bg.png
deleted file mode 100644
index 298fef1..0000000
--- a/plugins/webinterface/www/default/menu_bg.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/normal_priority.png b/plugins/webinterface/www/default/normal_priority.png
deleted file mode 100644
index d4dcb20..0000000
--- a/plugins/webinterface/www/default/normal_priority.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/only_seed.png b/plugins/webinterface/www/default/only_seed.png
deleted file mode 100644
index fae2635..0000000
--- a/plugins/webinterface/www/default/only_seed.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/remove.png b/plugins/webinterface/www/default/remove.png
deleted file mode 100644
index 5b30781..0000000
--- a/plugins/webinterface/www/default/remove.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/shutdown.php b/plugins/webinterface/www/default/shutdown.php
deleted file mode 100644
index f87a199..0000000
--- a/plugins/webinterface/www/default/shutdown.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Shutdown page</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-</head>
-<body bgcolor="#a2d2b1">
-
-<center><strong>KTorrent closed successfully</strong></center>
-
-</body>
-</html>
diff --git a/plugins/webinterface/www/default/start.png b/plugins/webinterface/www/default/start.png
deleted file mode 100644
index 31a78ca..0000000
--- a/plugins/webinterface/www/default/start.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/stop.png b/plugins/webinterface/www/default/stop.png
deleted file mode 100644
index 82afb10..0000000
--- a/plugins/webinterface/www/default/stop.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/default/style.css b/plugins/webinterface/www/default/style.css
deleted file mode 100644
index 3af4bb5..0000000
--- a/plugins/webinterface/www/default/style.css
+++ /dev/null
@@ -1,13 +0,0 @@
-/* styles for login.html */
-
-body {
- background: url(ktorrentwebinterfacelogo.png) no-repeat 120px 120px;
- font-family: verdana, arial, sans-serif;
- color: #000000;
- font-size: 12px;
-}
-
-input, textarea {
- border: 1px solid #000000;
- width: 120px;
-}
diff --git a/plugins/webinterface/www/default/stylen.css b/plugins/webinterface/www/default/stylen.css
deleted file mode 100644
index 68966fd..0000000
--- a/plugins/webinterface/www/default/stylen.css
+++ /dev/null
@@ -1,164 +0,0 @@
-/* styles for interface.php and details.php */
-
-html, body {
- background-color: #a2d2b1;
- font-family: sans-serif;
- font-size: 12px;
-}
-html, body, h1, h2, h3, h4, form {
- margin: 0;
- padding: 0;
-}
-img {
- border: 0;
-}
-h2 {
- font-size: 12px;
- min-height: 18px;
- padding-top: 2px;
- margin-bottom: 10px;
- background-image: url(grad1.jpg);
- font-weight: bold;
- border-bottom: 1px solid #000;
- text-align: center;
-}
-form {
- text-align: right;
-}
-label {
- display: block;
- text-align: right;
- margin: 4px 0 4px 0;
-}
-input {
- margin: 0 5% 0 1%;
- width: 30%;
-}
-label.wide {
- text-align: left;
- padding-left: 5%;
-}
-label.wide input {
- margin: 0 0 0 0;
- width: 95%;
-}
-input[type="submit"] {
- width: auto;
-}
-th {
- padding: 2px;
- text-align: left;
-}
-a {
- color: #0C45FF;
- text-decoration: none;
-}
-a:visited {
- color: #0C45FF;
-}
-a:hover {
- color: #FFFFFF;
- text-decoration: none;
-}
-
-
-.actions img {
- width: 16px;
- height: 16px;
- margin: 2px;
-}
-
-
-.box {
- width: 254px;
- margin: 0 auto;
- border: 1px solid black;
- background-color: #d5d5d5;
- padding-bottom: 10px;
- margin-bottom: 10px;
- text-align: center;
-}
-
-
-#top_bar {
- background-color: #b72916;
- border: 1px solid #868686;
- text-align: right;
-}
-
-
-#icon {
- position: absolute;
- left: 5px;
- top: 2px;
-}
-
-
-#header {
- background-color: #42ac64;
- padding: 15px 0 5px 140px;
- font-size: 45px;
-}
-#header strong {
- text-shadow: 3px 3px 5px #bbb;
-}
-#header small {
- font-size: 13px;
-}
-
-
-#menu {
- list-style-type: none;
- margin: 0;
- padding: 0 0 0 140px;
- background-image: url(menu_bg.png);
- height: 24px;
-}
-#menu li {
- display: inline;
- margin-right: 10px;
-}
-#menu a {
- color: #fff;
- font-size: 16px;
-}
-#menu a:hover {
- color: #000;
- text-decoration: none;
-}
-#menu .shutdown {
- margin-right: 290px;
-}
-
-
-#sidebar {
- background: #42AC64;
- float: right;
- width: 280px;
- border-left: 1px solid #000;
- border-bottom: 1px solid #000;
- padding: 10px 0 5px 0;
-}
-#sidebar a:hover {
- color: #000;
-}
-
-
-#content {
- background: #a2d2b1;
- text-align: left;
- margin-right: 280px;
- padding: 10px;
-}
-#content img { opacity: 0.4; }
-#content a img { opacity: 1.0; }
-
-
-#footer {
- clear: both;
- background: #b72916;
- min-height: 25px;
- text-align: center;
- font-size: 14px;
- padding-top: 5px;
-}
diff --git a/plugins/webinterface/www/default/wz_tooltip.js b/plugins/webinterface/www/default/wz_tooltip.js
deleted file mode 100644
index 1329a1b..0000000
--- a/plugins/webinterface/www/default/wz_tooltip.js
+++ /dev/null
@@ -1,509 +0,0 @@
-/* This notice must be untouched at all times.
-
-wz_tooltip.js v. 3.45
-
-The latest version is available at
-http://www.walterzorn.com
-or http://www.devira.com
-or http://www.walterzorn.de
-
-Copyright (c) 2002-2005 Walter Zorn. All rights reserved.
-Created 1. 12. 2002 by Walter Zorn (Web: http://www.walterzorn.com )
-Last modified: 22. 1. 2007
-
-Cross-browser tooltips working even in Opera 5 and 6,
-as well as in NN 4, Gecko-Browsers, IE4+, Opera 7+ and Konqueror.
-No onmouseouts required.
-Appearance of tooltips can be individually configured
-via commands within the onmouseovers.
-
-LICENSE: LGPL
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License (LGPL) as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-For more details on the GNU Lesser General Public License,
-see http://www.gnu.org/copyleft/lesser.html
-*/
-
-
-
-//////////////// GLOBAL TOOPTIP CONFIGURATION /////////////////////
-var ttAbove = false; // tooltip above mousepointer? Alternative: true
-var ttBgColor = "#D5D5D5";
-var ttBgImg = ""; // path to background image;
-var ttBorderColor = "#D00000";
-var ttBorderWidth = 1;
-var ttDelay = 350; // time span until tooltip shows up [milliseconds]
-var ttClickClose = false;
-var ttFontColor = "#000000";
-var ttFontFace = "arial,helvetica,sans-serif";
-var ttFontSize = "11px";
-var ttFontWeight = "normal"; // alternative: "bold";
-var ttLeft = false; // tooltip on the left of the mouse? Alternative: true
-var ttOffsetX = 12; // horizontal offset of left-top corner from mousepointer
-var ttOffsetY = 15; // vertical offset "
-var ttOpacity = 70; // opacity of tooltip in percent (must be integer between 0 and 100)
-var ttPadding = 3; // spacing between border and content
-var ttShadowColor = "";
-var ttShadowWidth = 0;
-var ttStatic = false; // tooltip NOT move with the mouse? Alternative: true
-var ttSticky = false; // do NOT hide tooltip on mouseout? Alternative: true
-var ttTemp = 0; // time span after which the tooltip disappears; 0 (zero) means "infinite timespan"
-var ttTextAlign = "left";
-var ttTitleColor = "#ffffff"; // color of caption text
-var ttWidth = 300;
-//////////////////// END OF TOOLTIP CONFIG ////////////////////////
-
-
-
-////////////// TAGS WITH TOOLTIP FUNCTIONALITY ////////////////////
-// List may be extended or shortened:
-var tt_tags = new Array("a","area","b","big","caption","center","code","dd","div","dl","dt","em","h1","h2","h3","h4","h5","h6","i","img","input","li","map","ol","p","pre","s", "select", "small","span","strike","strong","sub","sup","table","td","textarea","th","tr","tt","u","var","ul","layer");
-/////////////////////////////////////////////////////////////////////
-
-
-
-///////// DON'T CHANGE ANYTHING BELOW THIS LINE /////////////////////
-var tt_obj = null, // current tooltip
-tt_ifrm = null, // iframe to cover windowed controls in IE
-tt_objW = 0, tt_objH = 0, // width and height of tt_obj
-tt_objX = 0, tt_objY = 0,
-tt_offX = 0, tt_offY = 0,
-xlim = 0, ylim = 0, // right and bottom borders of visible client area
-tt_sup = false, // true if T_ABOVE cmd
-tt_sticky = false, // tt_obj sticky?
-tt_wait = false,
-tt_act = false, // tooltip visibility flag
-tt_sub = false, // true while tooltip below mousepointer
-tt_u = "undefined",
-tt_mf = null, // stores previous mousemove evthandler
-// Opera: disable href when hovering <a>
-tt_tag = null; // stores hovered dom node, href and previous statusbar txt
-
-
-var tt_db = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body? document.body : null,
-tt_n = navigator.userAgent.toLowerCase(),
-tt_nv = navigator.appVersion;
-// Browser flags
-var tt_op = !!(window.opera && document.getElementById),
-tt_op6 = tt_op && !document.defaultView,
-tt_op7 = tt_op && !tt_op6,
-tt_ie = tt_n.indexOf("msie") != -1 && document.all && tt_db && !tt_op,
-tt_ie7 = tt_ie && typeof document.body.style.maxHeight != tt_u,
-tt_ie6 = tt_ie && !tt_ie7 && parseFloat(tt_nv.substring(tt_nv.indexOf("MSIE")+5)) >= 5.5,
-tt_n4 = (document.layers && typeof document.classes != tt_u),
-tt_n6 = (!tt_op && document.defaultView && typeof document.defaultView.getComputedStyle != tt_u),
-tt_w3c = !tt_ie && !tt_n6 && !tt_op && document.getElementById,
-tt_ce = document.captureEvents && !tt_n6;
-
-function tt_Int(t_x)
-{
- var t_y;
- return isNaN(t_y = parseInt(t_x))? 0 : t_y;
-}
-function wzReplace(t_x, t_y)
-{
- var t_ret = "",
- t_str = this,
- t_xI;
- while((t_xI = t_str.indexOf(t_x)) != -1)
- {
- t_ret += t_str.substring(0, t_xI) + t_y;
- t_str = t_str.substring(t_xI + t_x.length);
- }
- return t_ret+t_str;
-}
-String.prototype.wzReplace = wzReplace;
-function tt_N4Tags(tagtyp, t_d, t_y)
-{
- t_d = t_d || document;
- t_y = t_y || new Array();
- var t_x = (tagtyp=="a")? t_d.links : t_d.layers;
- for(var z = t_x.length; z--;) t_y[t_y.length] = t_x[z];
- for(z = t_d.layers.length; z--;) t_y = tt_N4Tags(tagtyp, t_d.layers[z].document, t_y);
- return t_y;
-}
-function tt_Htm(tt, t_id, txt)
-{
- var t_bgc = (typeof tt.T_BGCOLOR != tt_u)? tt.T_BGCOLOR : ttBgColor,
- t_bgimg = (typeof tt.T_BGIMG != tt_u)? tt.T_BGIMG : ttBgImg,
- t_bc = (typeof tt.T_BORDERCOLOR != tt_u)? tt.T_BORDERCOLOR : ttBorderColor,
- t_bw = (typeof tt.T_BORDERWIDTH != tt_u)? tt.T_BORDERWIDTH : ttBorderWidth,
- t_ff = (typeof tt.T_FONTFACE != tt_u)? tt.T_FONTFACE : ttFontFace,
- t_fc = (typeof tt.T_FONTCOLOR != tt_u)? tt.T_FONTCOLOR : ttFontColor,
- t_fsz = (typeof tt.T_FONTSIZE != tt_u)? tt.T_FONTSIZE : ttFontSize,
- t_fwght = (typeof tt.T_FONTWEIGHT != tt_u)? tt.T_FONTWEIGHT : ttFontWeight,
- t_opa = (typeof tt.T_OPACITY != tt_u)? tt.T_OPACITY : ttOpacity,
- t_padd = (typeof tt.T_PADDING != tt_u)? tt.T_PADDING : ttPadding,
- t_shc = (typeof tt.T_SHADOWCOLOR != tt_u)? tt.T_SHADOWCOLOR : (ttShadowColor || 0),
- t_shw = (typeof tt.T_SHADOWWIDTH != tt_u)? tt.T_SHADOWWIDTH : (ttShadowWidth || 0),
- t_algn = (typeof tt.T_TEXTALIGN != tt_u)? tt.T_TEXTALIGN : ttTextAlign,
- t_tit = (typeof tt.T_TITLE != tt_u)? tt.T_TITLE : "",
- t_titc = (typeof tt.T_TITLECOLOR != tt_u)? tt.T_TITLECOLOR : ttTitleColor,
- t_w = (typeof tt.T_WIDTH != tt_u)? tt.T_WIDTH : ttWidth;
- if(t_shc || t_shw)
- {
- t_shc = t_shc || "#c0c0c0";
- t_shw = t_shw || 5;
- }
- if(tt_n4 && (t_fsz == "10px" || t_fsz == "11px")) t_fsz = "12px";
-
- var t_optx = (tt_n4? '' : tt_n6? ('-moz-opacity:'+(t_opa/100.0)) : tt_ie? ('filter:Alpha(opacity='+t_opa+')') : ('opacity:'+(t_opa/100.0))) + ';';
- var t_y = '<div id="'+t_id+'" style="position:absolute;z-index:1010;';
- t_y += 'left:0px;top:0px;width:'+(t_w+t_shw)+'px;visibility:'+(tt_n4? 'hide' : 'hidden')+';'+t_optx+'">' +
- '<table border="0" cellpadding="0" cellspacing="0"'+(t_bc? (' bgcolor="'+t_bc+'" style="background:'+t_bc+';"') : '')+' width="'+t_w+'">';
- if(t_tit)
- {
- t_y += '<tr><td style="padding-left:3px;padding-right:3px;" align="'+t_algn+'"><font color="'+t_titc+'" face="'+t_ff+'" ' +
- 'style="color:'+t_titc+';font-family:'+t_ff+';font-size:'+t_fsz+';"><b>' +
- (tt_n4? '&nbsp;' : '')+t_tit+'</b></font></td></tr>';
- }
- t_y += '<tr><td><table border="0" cellpadding="'+t_padd+'" cellspacing="'+t_bw+'" width="100%">' +
- '<tr><td'+(t_bgc? (' bgcolor="'+t_bgc+'"') : '')+(t_bgimg? ' background="'+t_bgimg+'"' : '')+' style="text-align:'+t_algn+';';
- if(tt_n6) t_y += 'padding:'+t_padd+'px;';
- t_y += '" align="'+t_algn+'"><font color="'+t_fc+'" face="'+t_ff+'"' +
- ' style="color:'+t_fc+';font-family:'+t_ff+';font-size:'+t_fsz+';font-weight:'+t_fwght+';">';
- if(t_fwght == 'bold') t_y += '<b>';
- t_y += txt;
- if(t_fwght == 'bold') t_y += '</b>';
- t_y += '</font></td></tr></table></td></tr></table>';
- if(t_shw)
- {
- var t_spct = Math.round(t_shw*1.3);
- if(tt_n4)
- {
- t_y += '<layer bgcolor="'+t_shc+'" left="'+t_w+'" top="'+t_spct+'" width="'+t_shw+'" height="0"></layer>' +
- '<layer bgcolor="'+t_shc+'" left="'+t_spct+'" align="bottom" width="'+(t_w-t_spct)+'" height="'+t_shw+'"></layer>';
- }
- else
- {
- t_optx = tt_n6? '-moz-opacity:0.85;' : tt_ie? 'filter:Alpha(opacity=85);' : 'opacity:0.85;';
- t_y += '<div id="'+t_id+'R" style="position:absolute;background:'+t_shc+';left:'+t_w+'px;top:'+t_spct+'px;width:'+t_shw+'px;height:1px;overflow:hidden;'+t_optx+'"></div>' +
- '<div style="position:relative;background:'+t_shc+';left:'+t_spct+'px;top:0px;width:'+(t_w-t_spct)+'px;height:'+t_shw+'px;overflow:hidden;'+t_optx+'"></div>';
- }
- }
- return(t_y+'</div>');
-}
-function tt_EvX(t_e)
-{
- var t_y = tt_Int(t_e.pageX || t_e.clientX || 0) +
- tt_Int(tt_ie? tt_db.scrollLeft : 0) +
- tt_offX;
- if(t_y > xlim) t_y = xlim;
- var t_scr = tt_Int(window.pageXOffset || (tt_db? tt_db.scrollLeft : 0) || 0);
- if(t_y < t_scr) t_y = t_scr;
- return t_y;
-}
-function tt_EvY(t_e)
-{
- var t_y2;
-
- var t_y = tt_Int(t_e.pageY || t_e.clientY || 0) +
- tt_Int(tt_ie? tt_db.scrollTop : 0);
- if(tt_sup && (t_y2 = t_y - (tt_objH + tt_offY - 15)) >= tt_Int(window.pageYOffset || (tt_db? tt_db.scrollTop : 0) || 0))
- t_y -= (tt_objH + tt_offY - 15);
- else if(t_y > ylim || !tt_sub && t_y > ylim-24)
- {
- t_y -= (tt_objH + 5);
- tt_sub = false;
- }
- else
- {
- t_y += tt_offY;
- tt_sub = true;
- }
- return t_y;
-}
-function tt_ReleasMov()
-{
- if(document.onmousemove == tt_Move)
- {
- if(!tt_mf && tt_ce) document.releaseEvents(Event.MOUSEMOVE);
- document.onmousemove = tt_mf;
- }
-}
-function tt_ShowIfrm(t_x)
-{
- if(!tt_obj || !tt_ifrm) return;
- if(t_x)
- {
- tt_ifrm.style.width = tt_objW+'px';
- tt_ifrm.style.height = tt_objH+'px';
- tt_ifrm.style.display = "block";
- }
- else tt_ifrm.style.display = "none";
-}
-function tt_GetDiv(t_id)
-{
- return(
- tt_n4? (document.layers[t_id] || null)
- : tt_ie? (document.all[t_id] || null)
- : (document.getElementById(t_id) || null)
- );
-}
-function tt_GetDivW()
-{
- return tt_Int(
- tt_n4? tt_obj.clip.width
- : (tt_obj.style.pixelWidth || tt_obj.offsetWidth)
- );
-}
-function tt_GetDivH()
-{
- return tt_Int(
- tt_n4? tt_obj.clip.height
- : (tt_obj.style.pixelHeight || tt_obj.offsetHeight)
- );
-}
-
-// Compat with DragDrop Lib: Ensure that z-index of tooltip is lifted beyond toplevel dragdrop element
-function tt_SetDivZ()
-{
- var t_i = tt_obj.style || tt_obj;
- if(t_i)
- {
- if(window.dd && dd.z)
- t_i.zIndex = Math.max(dd.z+1, t_i.zIndex);
- if(tt_ifrm) tt_ifrm.style.zIndex = t_i.zIndex-1;
- }
-}
-function tt_SetDivPos(t_x, t_y)
-{
- var t_i = tt_obj.style || tt_obj;
- var t_px = (tt_op6 || tt_n4)? '' : 'px';
- t_i.left = (tt_objX = t_x) + t_px;
- t_i.top = (tt_objY = t_y) + t_px;
- // window... to circumvent the FireFox Alzheimer Bug
- if(window.tt_ifrm)
- {
- tt_ifrm.style.left = t_i.left;
- tt_ifrm.style.top = t_i.top;
- }
-}
-function tt_ShowDiv(t_x)
-{
- tt_ShowIfrm(t_x);
- if(tt_n4) tt_obj.visibility = t_x? 'show' : 'hide';
- else tt_obj.style.visibility = t_x? 'visible' : 'hidden';
- tt_act = t_x;
-}
-function tt_DeAlt(t_tag)
-{
- if(t_tag)
- {
- if(t_tag.alt) t_tag.alt = "";
- if(t_tag.title) t_tag.title = "";
- var t_c = t_tag.children || t_tag.childNodes || null;
- if(t_c)
- {
- for(var t_i = t_c.length; t_i; )
- tt_DeAlt(t_c[--t_i]);
- }
- }
-}
-function tt_OpDeHref(t_e)
-{
- var t_tag;
- if(t_e)
- {
- t_tag = t_e.target;
- while(t_tag)
- {
- if(t_tag.hasAttribute("href"))
- {
- tt_tag = t_tag
- tt_tag.t_href = tt_tag.getAttribute("href");
- tt_tag.removeAttribute("href");
- tt_tag.style.cursor = "hand";
- tt_tag.onmousedown = tt_OpReHref;
- tt_tag.stats = window.status;
- window.status = tt_tag.t_href;
- break;
- }
- t_tag = t_tag.parentElement;
- }
- }
-}
-function tt_OpReHref()
-{
- if(tt_tag)
- {
- tt_tag.setAttribute("href", tt_tag.t_href);
- window.status = tt_tag.stats;
- tt_tag = null;
- }
-}
-function tt_Show(t_e, t_id, t_sup, t_clk, t_delay, t_fix, t_left, t_offx, t_offy, t_static, t_sticky, t_temp)
-{
- if(tt_obj) tt_Hide();
- tt_mf = document.onmousemove || null;
- if(window.dd && (window.DRAG && tt_mf == DRAG || window.RESIZE && tt_mf == RESIZE)) return;
- var t_sh, t_h;
-
- tt_obj = tt_GetDiv(t_id);
- if(tt_obj)
- {
- t_e = t_e || window.event;
- tt_sub = !(tt_sup = t_sup);
- tt_sticky = t_sticky;
- tt_objW = tt_GetDivW();
- tt_objH = tt_GetDivH();
- tt_offX = t_left? -(tt_objW+t_offx) : t_offx;
- tt_offY = t_offy;
- if(tt_op7) tt_OpDeHref(t_e);
- if(tt_n4)
- {
- if(tt_obj.document.layers.length)
- {
- t_sh = tt_obj.document.layers[0];
- t_sh.clip.height = tt_objH - Math.round(t_sh.clip.width*1.3);
- }
- }
- else
- {
- t_sh = tt_GetDiv(t_id+'R');
- if(t_sh)
- {
- t_h = tt_objH - tt_Int(t_sh.style.pixelTop || t_sh.style.top || 0);
- if(typeof t_sh.style.pixelHeight != tt_u) t_sh.style.pixelHeight = t_h;
- else t_sh.style.height = t_h+'px';
- }
- }
-
- xlim = tt_Int((tt_db && tt_db.clientWidth)? tt_db.clientWidth : window.innerWidth) +
- tt_Int(window.pageXOffset || (tt_db? tt_db.scrollLeft : 0) || 0) -
- tt_objW -
- (tt_n4? 21 : 0);
- ylim = tt_Int(window.innerHeight || tt_db.clientHeight) +
- tt_Int(window.pageYOffset || (tt_db? tt_db.scrollTop : 0) || 0) -
- tt_objH - tt_offY;
-
- tt_SetDivZ();
- if(t_fix) tt_SetDivPos(tt_Int((t_fix = t_fix.split(','))[0]), tt_Int(t_fix[1]));
- else tt_SetDivPos(tt_EvX(t_e), tt_EvY(t_e));
-
- var t_txt = 'tt_ShowDiv(\'true\');';
- if(t_sticky) t_txt += '{'+
- 'tt_ReleasMov();'+
- (t_clk? ('window.tt_upFunc = document.onmouseup || null;'+
- 'if(tt_ce) document.captureEvents(Event.MOUSEUP);'+
- 'document.onmouseup = new Function("window.setTimeout(\'tt_Hide();\', 10);");') : '')+
- '}';
- else if(t_static) t_txt += 'tt_ReleasMov();';
- if(t_temp > 0) t_txt += 'window.tt_rtm = window.setTimeout(\'tt_sticky = false; tt_Hide();\','+t_temp+');';
- window.tt_rdl = window.setTimeout(t_txt, t_delay);
-
- if(!t_fix)
- {
- if(tt_ce) document.captureEvents(Event.MOUSEMOVE);
- document.onmousemove = tt_Move;
- }
- }
-}
-var tt_area = false;
-function tt_Move(t_ev)
-{
- if(!tt_obj) return;
- if(tt_n6 || tt_w3c)
- {
- if(tt_wait) return;
- tt_wait = true;
- setTimeout('tt_wait = false;', 5);
- }
- var t_e = t_ev || window.event;
- tt_SetDivPos(tt_EvX(t_e), tt_EvY(t_e));
- if(window.tt_op6)
- {
- if(tt_area && t_e.target.tagName != 'AREA') tt_Hide();
- else if(t_e.target.tagName == 'AREA') tt_area = true;
- }
-}
-function tt_Hide()
-{
- if(window.tt_obj)
- {
- if(window.tt_rdl) window.clearTimeout(tt_rdl);
- if(!tt_sticky || !tt_act)
- {
- if(window.tt_rtm) window.clearTimeout(tt_rtm);
- tt_ShowDiv(false);
- tt_SetDivPos(-tt_objW, -tt_objH);
- tt_obj = null;
- if(typeof window.tt_upFunc != tt_u) document.onmouseup = window.tt_upFunc;
- }
- tt_sticky = false;
- if(tt_op6 && tt_area) tt_area = false;
- tt_ReleasMov();
- if(tt_op7) tt_OpReHref();
- }
-}
-function tt_Init()
-{
- if(!(tt_op || tt_n4 || tt_n6 || tt_ie || tt_w3c)) return;
-
- var htm = tt_n4? '<div style="position:absolute;"></div>' : '',
- tags,
- t_tj,
- over,
- t_b,
- esc = 'return escape(';
- for(var i = tt_tags.length; i;)
- {--i;
- tags = tt_ie? (document.all.tags(tt_tags[i]) || 1)
- : document.getElementsByTagName? (document.getElementsByTagName(tt_tags[i]) || 1)
- : (!tt_n4 && tt_tags[i]=="a")? document.links
- : 1;
- if(tt_n4 && (tt_tags[i] == "a" || tt_tags[i] == "layer")) tags = tt_N4Tags(tt_tags[i]);
- for(var j = tags.length; j;)
- {--j;
- if(typeof (t_tj = tags[j]).onmouseover == "function" && t_tj.onmouseover.toString().indexOf(esc) != -1 && !tt_n6 || tt_n6 && (over = t_tj.getAttribute("onmouseover")) && over.indexOf(esc) != -1)
- {
- if(over) t_tj.onmouseover = new Function(over);
- var txt = unescape(t_tj.onmouseover());
- htm += tt_Htm(
- t_tj,
- "tOoLtIp"+i+""+j,
- txt.wzReplace("& ","&")
- );
- // window. to circumvent the FF Alzheimer Bug
- t_tj.onmouseover = new Function('e',
- 'if(window.tt_Show && tt_Show) tt_Show(e,'+
- '"tOoLtIp' +i+''+j+ '",'+
- ((typeof t_tj.T_ABOVE != tt_u)? t_tj.T_ABOVE : ttAbove)+','+
- ((typeof t_tj.T_CLICKCLOSE != tt_u)? t_tj.T_CLICKCLOSE : ttClickClose)+','+
- ((typeof t_tj.T_DELAY != tt_u)? t_tj.T_DELAY : ttDelay)+','+
- ((typeof t_tj.T_FIX != tt_u)? '"'+t_tj.T_FIX+'"' : '""')+','+
- ((typeof t_tj.T_LEFT != tt_u)? t_tj.T_LEFT : ttLeft)+','+
- ((typeof t_tj.T_OFFSETX != tt_u)? t_tj.T_OFFSETX : ttOffsetX)+','+
- ((typeof t_tj.T_OFFSETY != tt_u)? t_tj.T_OFFSETY : ttOffsetY)+','+
- ((typeof t_tj.T_STATIC != tt_u)? t_tj.T_STATIC : ttStatic)+','+
- ((typeof t_tj.T_STICKY != tt_u)? t_tj.T_STICKY : ttSticky)+','+
- ((typeof t_tj.T_TEMP != tt_u)? t_tj.T_TEMP : ttTemp)+
- ');'
- );
- t_tj.onmouseout = tt_Hide;
- tt_DeAlt(t_tj);
- }
- }
- }
- if(tt_ie6) htm += '<iframe id="TTiEiFrM" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>';
- t_b = document.getElementsByTagName? document.getElementsByTagName("body")[0] : tt_db;
- if(t_b && t_b.insertAdjacentHTML) t_b.insertAdjacentHTML("AfterBegin", htm);
- else if(t_b && typeof t_b.innerHTML != tt_u && document.createElement && t_b.appendChild)
- {
- var t_el = document.createElement("div");
- t_b.appendChild(t_el);
- t_el.innerHTML = htm;
- }
- else
- document.write(htm);
- if(document.getElementById) tt_ifrm = document.getElementById("TTiEiFrM");
-}
-tt_Init();
diff --git a/plugins/webinterface/www/mobile/Makefile.am b/plugins/webinterface/www/mobile/Makefile.am
deleted file mode 100644
index 3aae8b4..0000000
--- a/plugins/webinterface/www/mobile/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-INCLUDES = -I$(srcdir)/../../libktorrent $(all_includes)
-METASOURCES = AUTO
-
-ktdatadir = $(kde_datadir)/ktorrent/www/mobile
-
-
-
-ktdata_DATA = favicon.ico interface.php ktorrentwebinterfacelogo.png login.html remove.png start.png stop.png settings.php torrent.php
diff --git a/plugins/webinterface/www/mobile/favicon.ico b/plugins/webinterface/www/mobile/favicon.ico
deleted file mode 100644
index 3213b23..0000000
--- a/plugins/webinterface/www/mobile/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/mobile/interface.php b/plugins/webinterface/www/mobile/interface.php
deleted file mode 100644
index 57582de..0000000
--- a/plugins/webinterface/www/mobile/interface.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<html>
-<head>
-<title>KTorrent WebInterface</title>
-</head>
-<body>
-<table width="100%">
- <tbody>
- <tr>
- <td align="center"><IMG src="ktorrentwebinterfacelogo.png" width="340" height="150" align="top" border="0"></td>
-
- <td><strong>ktorrent</strong>->transfers</td>
-
- <td><td><a href="interface.php" >refresh</a></td>
- </tr>
- </tbody>
-</table>
-<hr>
-<table width="100%">
- <tbody>
- <?php
- $stats=downloadStatus();
- $a = 0;
- foreach ($stats as $torrent) {
- echo "<tr>";
- $perc = round(100.0 - ($torrent['bytes_left_to_download'] / $torrent['total_bytes_to_download']) * 100.0, 2);
- echo "<td><a href=\"torrent.php?id=$a\" >{$torrent['torrent_name']}</a></td>";
- switch ($torrent['status']) {
- case 0:
- echo "<td>Not Started</td>";
- break;
- case 1:
- echo "<td>Seeding Complete</td>";
- break;
- case 2:
- echo "<td>Download Complete</td>";
- break;
- case 3:
- echo "<td>Seeding</td>";
- break;
- case 4:
- echo "<td>Downloading</td>";
- break;
- case 5:
- echo "<td>Stalled</td>";
- break;
- case 6:
- echo "<td>Stopped</td>";
- break;
- case 7:
- echo "<td>Allocating Diskspace</td>";
- break;
- case 8:
- echo "<td>Error</td>";
- break;
- case 9:
- echo "<td>Queued</td>";
- break;
- case 10:
- echo "<td>Checking Data</td>";
- break;
- default:
- echo "<td>Not supported Status</td>";
- }
- echo "<td>$perc%</td>";
- $a=$a+1;
- echo "</tr>";
- }
- ?>
-
- <tr>
- <td>&nbsp;</td>
- <td><hr></td>
- <td>&nbsp;</td>
- </tr>
-
- <tr>
- <?php
- $globalinfo=globalInfo();
- echo "<td><strong>Speed</strong></td>";
- echo "<td>Down: {$globalinfo['download_speed']}</td>";
- echo "<td>Up: {$globalinfo['upload_speed']}</td>";
- ?>
- </tr>
- <tr>
- <td>&nbsp;</td>
- <td><hr></td>
- <td>&nbsp;</td>
- </tr>
- <tr>
- <td><a href="interface.php?startall=startall" ><strong>Start All</strong></a></td>
- <td>&nbsp;</td>
- <td><a href="interface.php?stopall=stopall" ><strong>Stop All</strong></a></td>
- </tr>
- <tr>
- <td>&nbsp;</td>
- <td><a href="settings.php" ><strong>Settings</strong></a></td>
- <td>&nbsp;</td>
- </tr>
-
- </tbody>
-</table>
-<FORM method="GET">
-<INPUT type="text" name="load_torrent">
-<INPUT type="submit" name="Load torrent" value="Load torrent"></tr>
-</FORM>
-<FORM method="post" enctype="multipart/form-data" action="interface.php">
-Local File:<INPUT type="file" name="load_torrent">
-<INPUT type="submit" name="Upload Torrent" value="Upload Torrent"></tr>
-</FORM>
-
-</body>
-</html>
-
diff --git a/plugins/webinterface/www/mobile/ktorrentwebinterfacelogo.png b/plugins/webinterface/www/mobile/ktorrentwebinterfacelogo.png
deleted file mode 100644
index 6146fb1..0000000
--- a/plugins/webinterface/www/mobile/ktorrentwebinterfacelogo.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/mobile/login.html b/plugins/webinterface/www/mobile/login.html
deleted file mode 100644
index 359c44c..0000000
--- a/plugins/webinterface/www/mobile/login.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-
-<head>
- <title>KTorrent WebInterface - Login</title>
- <meta name="GENERATOR" content="Quanta Plus">
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-<body>
-<TABLE align="center" >
-<tr><td><IMG src="ktorrentwebinterfacelogo.png" width="687" height="300" align="left" border="0"></td></tr>
-</TABLE>
-<TABLE align="center" >
-<FORM action="interface.php" method="POST">
-
- <tr><td>Username</td><td><INPUT type="text" name="username"></td></tr>
- <tr><td>Password</td><td><INPUT type="password" name="password"></td></tr>
-<tr><td></td><td><INPUT type="submit" name="Login"></td></tr>
-
-</FORM>
-</TABLE>
-
-</body>
-</html>
diff --git a/plugins/webinterface/www/mobile/remove.png b/plugins/webinterface/www/mobile/remove.png
deleted file mode 100644
index 281edd3..0000000
--- a/plugins/webinterface/www/mobile/remove.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/mobile/settings.php b/plugins/webinterface/www/mobile/settings.php
deleted file mode 100644
index b763bb1..0000000
--- a/plugins/webinterface/www/mobile/settings.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<html>
-<head>
-<title>KTorrent WebInterface</title>
-</head>
-<body>
-<table width="100%">
- <tbody>
- <tr>
- <td align="center"><IMG src="ktorrentwebinterfacelogo.png" width="340" height="150" align="top" border="0"></td>
- <td><strong>ktorrent-><a href="interface.php">transfers</a></strong>->settings</td>
- <td><a href="settings.php" >refresh</a></td>
- </tr>
- </tbody>
-</table>
-<table width="100%">
- <tbody>
-<?php
- $globalinfo=globalInfo();
- echo "<FORM method=\"GET\">";
- echo "<tr>";
- echo "<td>Upload Speed (0 is no limit): </td>";
- echo "<td><INPUT type=\"text\" name=\"maximum_upload_rate\" value=\"{$globalinfo['max_upload_speed']}\"></td>";
- echo " </tr>";
- echo "<tr>";
- echo "<td>Download Speed (0 is no limit): </td>";
- echo "<td><INPUT type=\"text\" name=\"maximum_download_rate\" value=\"{$globalinfo['max_download_speed']}\"></td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td>Maximum downloads (0 is no limit): </td>";
- echo "<td><INPUT type=\"text\" name=\"maximum_downloads\" value=\"{$globalinfo['max_downloads']}\"></td>";
- echo"</tr>";
- echo "<tr>";
- echo "<td>Maximum seeds (0 is no limit): </td>";
- echo "<td><INPUT type=\"text\" name=\"maximum_seeds\" value=\"{$globalinfo['max_seeds']}\"></td>";
- echo"</tr>";
- echo "<tr><td><INPUT type=\"submit\"></tr></td>";
- echo "</FORM>";
-?>
-</tbody>
-</table>
-
-</body>
-</html>
-
diff --git a/plugins/webinterface/www/mobile/start.png b/plugins/webinterface/www/mobile/start.png
deleted file mode 100644
index d071181..0000000
--- a/plugins/webinterface/www/mobile/start.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/mobile/stop.png b/plugins/webinterface/www/mobile/stop.png
deleted file mode 100644
index 3c6942a..0000000
--- a/plugins/webinterface/www/mobile/stop.png
+++ /dev/null
Binary files differ
diff --git a/plugins/webinterface/www/mobile/torrent.php b/plugins/webinterface/www/mobile/torrent.php
deleted file mode 100644
index a1e451d..0000000
--- a/plugins/webinterface/www/mobile/torrent.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<html>
-<head>
-<title>KTorrent WebInterface</title>
-</head>
-<body>
-<table width="100%">
- <tbody>
- <tr>
- <td align="center"><IMG src="ktorrentwebinterfacelogo.png" width="340" height="150" align="top" border="0"></td>
- <?php
- $stats=downloadStatus();
- $t=$stats[$_REQUEST['id']];
- echo "<td><strong>ktorrent-><a href=\"interface.php\">transfers</a></strong>->{$t['torrent_name']}</td>";
- echo "<td><a href=\"torrent.php?id={$_REQUEST['id']}\" >refresh</a></td>";
- ?>
- </tr>
- </tbody>
-</table>
-<table width="100%">
- <tbody>
- <tr>
- <?php
- echo "<td><a href=\"torrent.php?stop={$_REQUEST['id']}&id={$_REQUEST['id']}\" title=\"STOP\"><img src=\"/stop.png\" name=\"stop\" width=\"16\" height=\"16\" border=\"0\"></a></td>";
- echo "<td><a href=\"torrent.php?start={$_REQUEST['id']}&id={$_REQUEST['id']}\" title=\"START\"><img src=\"/start.png\" name=\"start\" width=\"16\" height=\"16\" border=\"0\"></a></td>";
- echo "<td><a href=\"interface.php?remove={$_REQUEST['id']}\" title=\"REMOVE\"><img src=\"/remove.png\" name=\"remove\" width=\"16\" height=\"16\" border=\"0\"></a></td>";
- ?>
- </tr>
- </tbody>
-</table>
-<table width="100%">
- <tbody>
- <?php
- echo "<tr>";
- echo "<td><strong>Status: </strong></td>";
- switch ($t['status']) {
- case 0:
- echo "<td>NOT_STARTED</td>";
- break;
- case 1:
- echo "<td>SEEDING_COMPLETE</td>";
- break;
- case 2:
- echo "<td>DOWNLOAD_COMPLETE</td>";
- break;
- case 3:
- echo "<td>SEEDING</td>";
- break;
- case 4:
- echo "<td>DOWNLOADING</td>";
- break;
- case 5:
- echo "<td>STALLED</td>";
- break;
- case 6:
- echo "<td>STOPPED</td>";
- break;
- case 7:
- echo "<td>ALLOCATING_DISKSPACE</td>";
- break;
- case 8:
- echo "<td>ERROR</td>";
- break;
- case 9:
- echo "<td>QUEUED</td>";
- break;
- case 10:
- echo "<td>CHECKING_DATA</td>";
- break;
- default:
- echo "<td>Not supported Status</td>";
- }
- echo "</tr>";
- echo "<tr>";
- echo "<td><strong>Down speed: </strong></td>";
- echo "<td>{$t['download_rate']}</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td><strong>Up speed: </strong></td>";
- echo "<td>{$t['upload_rate']}</td>";
- echo "</tr>";
- echo "<tr>";
- echo "<td><strong>Complete: </strong></td>";
- $perc = round(100.0 - ($t['bytes_left_to_download'] / $t['total_bytes_to_download']) * 100.0, 2);
- echo "<td>$perc %</td>";
- echo "</tr>";
- ?>
- </tbody>
-</table>
-</body>
-</html>
-