示例#1
0
文件: index.php 项目: nylen/rtgui
    require_once 'xmlrpc.inc';
    require_once 'xmlrpc_extension_api.inc';
}
if (!isset($r_debug)) {
    $r_debug = 0;
}
$config = array('diskAlertThreshold' => $disk_alert_threshold, 'debugTab' => $debug_mode, 'dateAddedFormat' => $date_added_format, 'rtGuiPath' => get_rtgui_path(), 'canHideUnhide' => $can_hide_unhide, 'defaultFilterText' => 'Filter');
$user_settings = array('refreshInterval' => (int) get_user_setting('refresh_interval'), 'sortVar' => get_user_setting('sort_var'), 'sortDesc' => get_user_setting('sort_desc') == 'yes' ? true : false, 'theme' => get_current_theme(), 'useDialogs' => get_user_setting('use_dialogs') == 'yes' ? true : false, 'showHidden' => get_user_setting('show_hidden') == 'yes' ? true : false);
// Reset saved data (if any)
$_SESSION['rpc_cache'] = array();
$_SESSION['persistent'] = array();
// Get the list of torrents downloading
if (!$r_view) {
    $r_view = 'main';
}
$data = get_all_torrents(array('for_html' => true, 'view' => $r_view));
// Sort the list of torrents
function compare_torrents($a, $b)
{
    global $user_settings;
    $cmp = $user_settings['sortDesc'] ? -1 : 1;
    $value_a = $a[$user_settings['sortVar']];
    $value_b = $b[$user_settings['sortVar']];
    if (is_string($value_a)) {
        $value_a = strtolower($value_a);
    }
    if (is_string($value_b)) {
        $value_b = strtolower($value_b);
    }
    if ($value_a < $value_b) {
        return -$cmp;
示例#2
0
文件: rssfeed.php 项目: nylen/rtgui
require_once 'functions.php';
extract($_REQUEST, EXTR_PREFIX_ALL, 'r');
if (!isset($r_view)) {
    $r_view = "complete";
}
// header:
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\"?>";
echo "<rss version=\"2.0\">";
echo "<channel>";
echo "<title>rtGui rss feed</title>";
echo "<description>Latest info from your rTorrent/rtGui system</description>";
echo "<generator>rtGui - http://rtgui.googlecode.com/ </generator>";
echo "<link>" . get_rtgui_url() . "</link>";
echo "<lastBuildDate>" . date("r") . "</lastBuildDate>";
$data = get_all_torrents(array('torrents_only' => true, 'view' => $r_view));
if (is_array($data)) {
    $sortkey = "state_changed";
    usort($data, 'sort_matches_desc');
    $last = 0;
    foreach ($data as $item) {
        if ($item['state_changed'] > $last) {
            $last = $item['state_changed'];
        }
    }
    echo "<lastBuildDate>" . date("r", $last) . "</lastBuildDate>";
    foreach ($data as $item) {
        echo "<item>";
        echo "<title>" . ($item['complete'] == 1 ? "[Complete] " : "[Incomplete] ") . htmlspecialchars($item['name']) . "</title>";
        echo "<description>";
        echo htmlspecialchars($item['tied_to_file']) . " (" . format_bytes($item['size_bytes']) . ")";
示例#3
0
文件: keys.php 项目: nylen/rtgui
<?php

require_once 'config.php';
require_once 'functions.php';
$torrents = get_all_torrents(array('torrents_only' => true));
foreach ($torrents as $t) {
    foreach (array_keys($t) as $key) {
        print "{$key}\n";
    }
    die;
}
示例#4
0
文件: json.php 项目: nylen/rtgui
//  rtGui 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 3 of the License, or
//  (at your option) any later version.
//
//  rtGui 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 rtGui.  If not, see <http://www.gnu.org/licenses/>.
require_once 'config.php';
require_once 'functions.php';
rtgui_session_start();
$data = get_all_torrents(array('for_html' => true));
if (@is_array($_SESSION['last_data'])) {
    $last_data = $_SESSION['last_data'];
    $diff_torrents = array_compare_special($last_data['torrents'], $data['torrents'], 2);
    $diff_global = array_compare_special($last_data['global'], $data['global']);
    $return = array();
    if ($diff_torrents !== false) {
        $return['torrents'] = $diff_torrents;
    }
    if ($diff_global !== false) {
        $return['global'] = $diff_global;
    }
    if (!count($return)) {
        $return = false;
    }
    echo json_encode($return);