rendered paste body<?php $config_ok = true; require_once "intermission/config/config.php"; require_once "intermission/libs/intermission.php"; $intermission = new Intermission($config_sock); $ids_known = json_decode($_GET["ids"]); $torrents = array(); $all_ids = $intermission->helper_get_info_all(array("id")); if ($ids_known) { foreach ($ids_known as $id) { if (!in_array($id, $all_ids)) { $torrent["id"] = $id; $torrent["internal"] = "deleted"; array_push($torrents, $torrent); } } } foreach ($all_ids as $id) { $torrent = array(); $torrent["id"] = $id; $status = $intermission->helper_get_status($torrent["id"], array("completed", "state")); $torrent["completed"] = $status["completed"]; $torrent["state"] = $status["state"]; if ($torrent["state"] == "downloading") { $status = $intermission->helper_get_status($torrent["id"], array("download-speed", "eta", "peers-total", "peers-uploading", "upload-speed")); $torrent["download_speed"] = $status["download-speed"]; $torrent["eta"] = $status["eta"]; $torrent["peers_total"] = $status["peers-total"]; $torrent["peers_uploading"] = $status["peers-uploading"]; $torrent["upload_speed"] = $status["upload-speed"]; } elseif ($torrent["state"] == "seeding") { $status = $intermission->helper_get_status($torrent["id"], array("peers-downloading", "peers-total", "upload-speed")); $torrent["peers_downloading"] = $status["peers-downloading"]; $torrent["peers_total"] = $status["peers-total"]; $torrent["upload_speed"] = $status["upload-speed"]; } if ($ids_known) { if (!in_array($torrent["id"], $ids_known)) { $status = $intermission->helper_get_info($torrent["id"], array("name", "size")); $torrent["internal"] = "new"; $torrent["name"] = $status["name"]; $torrent["size"] = $status["size"]; } else { $torrent["internal"] = "old"; } } else { $status = $intermission->helper_get_info($torrent["id"], array("name", "size")); $torrent["internal"] = "new"; $torrent["name"] = $status["name"]; $torrent["size"] = $status["size"]; } array_push($torrents, $torrent); } $intermission->sock_close(); echo json_encode(array("torrents" => $torrents));?>