Esempio n. 1
0
 function create_torrent($torrent_trackers, $torrent)
 {
     $t = new Torrent($torrent);
     $data = array('comment' => $this->description, 'files' => array(array($this->file->filename, (int) $this->file->size)), 'piece length' => (int) $this->file->hashes->piecelength, 'pieces' => $this->file->hashes->pieces, 'trackers' => $torrent_trackers, 'created by' => $GLOBALS['generator'], 'encoding' => 'UTF-8');
     return $t->create($data);
 }
Esempio n. 2
0
switch ($_REQUEST['state']) {
    default:
        $renderer->display('torrents/add.tpl');
        break;
        // end default
    // end default
    case 'add':
        $ERRORS = array();
        if ($_POST['torrent']['uri'] == null) {
            $ERRORS[] = 'No torrent URI specified.';
        }
        if (sizeof($ERRORS) > 0) {
            draw_errors($ERRORS);
        } else {
            $start_immediately = true;
            if ($_POST['torrent']['pause'] == 'false') {
                $start_immediately = false;
            }
            $torrent = Torrent::create($APP_CONFIG['rpc_uri'], trim($_POST['torrent']['uri']), $start_immediately);
            $_SESSION['torrents_alert'] = 'Torrent added. It should show up soon...maybe.';
            if ($UI_TYPE == 'iphone') {
                redirect('rss-feeds');
            } else {
                redirect('torrents');
            }
        }
        // end no errors
        break;
        // end add
}
// end switch