summaryrefslogtreecommitdiffstats
path: root/plugins/webinterface/www/coldmilk
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 02:37:40 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 02:37:40 +0000
commit9ad5c7b5e23b4940e7a3ea3ca3a6fb77e6a8fab0 (patch)
treed088b5210e77d9fa91d954d8550e00e372b47378 /plugins/webinterface/www/coldmilk
downloadktorrent-9ad5c7b5e23b4940e7a3ea3ca3a6fb77e6a8fab0.tar.gz
ktorrent-9ad5c7b5e23b4940e7a3ea3ca3a6fb77e6a8fab0.zip
Updated to final KDE3 ktorrent release (2.2.6)
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1077377 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'plugins/webinterface/www/coldmilk')
-rw-r--r--plugins/webinterface/www/coldmilk/Makefile.am8
-rw-r--r--plugins/webinterface/www/coldmilk/favicon.icobin0 -> 1406 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icon.pngbin0 -> 26977 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/edit_user.pngbin0 -> 954 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/high_priority.pngbin0 -> 232 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/low_priority.pngbin0 -> 242 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/normal_priority.pngbin0 -> 215 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/16x16/only_seed.pngbin0 -> 237 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/exit.pngbin0 -> 1397 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/ktstart_all.pngbin0 -> 1399 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/ktstop_all.pngbin0 -> 1128 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/remove.pngbin0 -> 1526 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/start.pngbin0 -> 1232 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/22x22/stop.pngbin0 -> 963 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/configure.pngbin0 -> 1838 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/extender_opened.pngbin0 -> 1627 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/fileopen.pngbin0 -> 2231 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/32x32/folder1.pngbin0 -> 2698 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/48x48/exit.pngbin0 -> 3109 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/48x48/switchuser.pngbin0 -> 3164 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am6
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/down.pngbin0 -> 5486 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/folder1_man.pngbin0 -> 6388 bytes
-rw-r--r--plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.pngbin0 -> 5512 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
36 files changed, 1316 insertions, 0 deletions
diff --git a/plugins/webinterface/www/coldmilk/Makefile.am b/plugins/webinterface/www/coldmilk/Makefile.am
new file mode 100644
index 0000000..d6a5f08
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/Makefile.am
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 0000000..3213b23
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/favicon.ico
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icon.png b/plugins/webinterface/www/coldmilk/icon.png
new file mode 100644
index 0000000..6cb2185
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icon.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am b/plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am
new file mode 100644
index 0000000..7380c25
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/16x16/Makefile.am
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 0000000..9e5173f
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/16x16/edit_user.png
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
new file mode 100644
index 0000000..bcde52b
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/16x16/high_priority.png
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
new file mode 100644
index 0000000..966e22b
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/16x16/low_priority.png
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
new file mode 100644
index 0000000..d39228b
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/16x16/normal_priority.png
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
new file mode 100644
index 0000000..254d74a
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/16x16/only_seed.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am b/plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am
new file mode 100644
index 0000000..2bd411f
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/Makefile.am
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 0000000..7ca3753
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/exit.png
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
new file mode 100644
index 0000000..1c55069
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/ktstart_all.png
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
new file mode 100644
index 0000000..8086b69
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/ktstop_all.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/remove.png b/plugins/webinterface/www/coldmilk/icons/22x22/remove.png
new file mode 100644
index 0000000..3da332f
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/remove.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/start.png b/plugins/webinterface/www/coldmilk/icons/22x22/start.png
new file mode 100644
index 0000000..c7995a0
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/start.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/22x22/stop.png b/plugins/webinterface/www/coldmilk/icons/22x22/stop.png
new file mode 100644
index 0000000..5b59e46
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/22x22/stop.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am b/plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am
new file mode 100644
index 0000000..a2b93df
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/32x32/Makefile.am
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 0000000..b45d80a
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/32x32/configure.png
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
new file mode 100644
index 0000000..b8e652b
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/32x32/extender_opened.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/fileopen.png b/plugins/webinterface/www/coldmilk/icons/32x32/fileopen.png
new file mode 100644
index 0000000..e4064bb
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/32x32/fileopen.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/32x32/folder1.png b/plugins/webinterface/www/coldmilk/icons/32x32/folder1.png
new file mode 100644
index 0000000..f1a0279
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/32x32/folder1.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am b/plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am
new file mode 100644
index 0000000..9318a0c
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/48x48/Makefile.am
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 0000000..fd44eb0
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/48x48/exit.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/48x48/switchuser.png b/plugins/webinterface/www/coldmilk/icons/48x48/switchuser.png
new file mode 100644
index 0000000..e85c801
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/48x48/switchuser.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am b/plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am
new file mode 100644
index 0000000..3ff3ae0
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/64x64/Makefile.am
@@ -0,0 +1,6 @@
+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
new file mode 100644
index 0000000..a855ecc
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/64x64/down.png
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
new file mode 100644
index 0000000..a0951d6
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/64x64/folder1_man.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.png b/plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.png
new file mode 100644
index 0000000..2d2bba2
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/64x64/looknfeel.png
Binary files differ
diff --git a/plugins/webinterface/www/coldmilk/icons/Makefile.am b/plugins/webinterface/www/coldmilk/icons/Makefile.am
new file mode 100644
index 0000000..cbe7db5
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/icons/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS= 16x16 22x22 32x32 48x48 64x64
diff --git a/plugins/webinterface/www/coldmilk/interface.js b/plugins/webinterface/www/coldmilk/interface.js
new file mode 100644
index 0000000..2f361a5
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/interface.js
@@ -0,0 +1,44 @@
+ 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
new file mode 100644
index 0000000..246f347
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/interface.php
@@ -0,0 +1,251 @@
+<?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
new file mode 100644
index 0000000..fa95faf
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/login.html
@@ -0,0 +1,55 @@
+<?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
new file mode 100644
index 0000000..c004456
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/page_update.js
@@ -0,0 +1,429 @@
+ /***************************************************************************
+ * 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
new file mode 100644
index 0000000..bab7e68
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/rest.php
@@ -0,0 +1,265 @@
+<?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
new file mode 100644
index 0000000..92862c4
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/shutdown.php
@@ -0,0 +1,21 @@
+<!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
new file mode 100644
index 0000000..69010dc
--- /dev/null
+++ b/plugins/webinterface/www/coldmilk/style.css
@@ -0,0 +1,212 @@
+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