コード例 #1
0
ファイル: engines.php プロジェクト: NetOverflow/ruTorrent
 public function getTorrent($url)
 {
     global $profileMask;
     $cli = $this->fetch($url);
     if ($cli) {
         $name = $cli->get_filename();
         if ($name === false) {
             $name = md5($url) . ".torrent";
         }
         $name = getUniqueUploadedFilename($name);
         $f = @fopen($name, "w");
         if ($f !== false) {
             @fwrite($f, $cli->results, strlen($cli->results));
             fclose($f);
             @chmod($name, $profileMask & 0666);
             return $name;
         }
     }
     return false;
 }
コード例 #2
0
ファイル: rss.php プロジェクト: chaitanya11/rtorrent
 public function getTorrent($href)
 {
     if (strpos($href, "magnet:") === 0) {
         return "magnet";
     }
     global $profileMask;
     $cli = self::fetchURL(Snoopy::linkencode($href), $this->cookies);
     if ($cli && $cli->status >= 200 && $cli->status < 300) {
         $name = $cli->get_filename();
         if ($name === false) {
             $name = md5($href) . ".torrent";
         }
         $name = getUniqueUploadedFilename($name);
         $f = @fopen($name, "w");
         if ($f !== false) {
             @fwrite($f, $cli->results, strlen($cli->results));
             fclose($f);
             @chmod($name, $profileMask & 0666);
             return $name;
         }
     }
     return false;
 }
コード例 #3
0
 } else {
     $torrent = new Torrent($path_edit, array(), $piece_size, $callback_log, $callback_err);
 }
 if (isset($request['comment'])) {
     $comment = trim($request['comment']);
     if (strlen($comment)) {
         $torrent->comment($comment);
     }
 }
 if ($request['private']) {
     $torrent->is_private(true);
 }
 $fname = rTask::formatPath($taskNo) . '/result.torrent';
 $torrent->save($fname);
 if ($request['start_seeding']) {
     $fname = getUniqueUploadedFilename($torrent->info['name'] . '.torrent');
     $path_edit = trim($request['path_edit']);
     if (is_dir($path_edit)) {
         $path_edit = addslash($path_edit);
     }
     if (rTorrentSettings::get()->correctDirectory($path_edit)) {
         $path_edit = dirname($path_edit);
         if ($resumed = rTorrent::fastResume($torrent, $path_edit)) {
             $torrent = $resumed;
         }
         $torrent->save($fname);
         rTorrent::sendTorrent($torrent, true, true, $path_edit, null, true, isLocalMode());
         @chmod($fname, $profileMask & 0666);
     }
 }
 exit(0);
コード例 #4
0
ファイル: addtorrent.php プロジェクト: chaitanya11/rtorrent
             $uploaded_files[] = array('name' => $file['name'], 'file' => $ufile, 'status' => $ok ? "Success" : "Failed");
         }
     } else {
         if (isset($_REQUEST['url'])) {
             $url = trim($_REQUEST['url']);
             $uploaded_url = array('name' => $url, 'status' => "Failed");
             if (strpos($url, "magnet:") === 0) {
                 $uploaded_url['status'] = rTorrent::sendMagnet($url, !isset($_REQUEST['torrents_start_stopped']), !isset($_REQUEST['not_add_path']), $dir_edit, $label) ? "Success" : "Failed";
             } else {
                 $cli = new Snoopy();
                 if (@$cli->fetchComplex($url) && $cli->status >= 200 && $cli->status < 300) {
                     $name = $cli->get_filename();
                     if ($name === false) {
                         $name = md5($url) . ".torrent";
                     }
                     $name = getUniqueUploadedFilename($name);
                     $f = @fopen($name, "w");
                     if ($f !== false) {
                         @fwrite($f, $cli->results, strlen($cli->results));
                         fclose($f);
                         $uploaded_url['file'] = $name;
                         $uploaded_url['status'] = "Success";
                     }
                 } else {
                     $uploaded_url['status'] = "FailedURL";
                 }
             }
             $uploaded_files[] = $uploaded_url;
         }
     }
 }