• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP rXMLRPCRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中rXMLRPCRequest的典型用法代码示例。如果您正苦于以下问题:PHP rXMLRPCRequest类的具体用法?PHP rXMLRPCRequest怎么用?PHP rXMLRPCRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了rXMLRPCRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: createTorrent

 public static function createTorrent($torrent, $hash)
 {
     global $saveUploadedTorrents;
     $torrent = new Torrent($torrent);
     if ($torrent->errors()) {
         return self::STE_DELETED;
     }
     if ($torrent->hash_info() == $hash) {
         return self::STE_UPTODATE;
     }
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_directory_base", $hash), new rXMLRPCCommand("d.get_custom1", $hash), new rXMLRPCCommand("d.get_throttle_name", $hash), new rXMLRPCCommand("d.get_connection_seed", $hash), new rXMLRPCCommand("d.is_open", $hash), new rXMLRPCCommand("d.is_active", $hash), new rXMLRPCCommand("d.get_state", $hash), new rXMLRPCCommand("d.stop", $hash), new rXMLRPCCommand("d.close", $hash)));
     if ($req->success()) {
         $addition = array(getCmd("d.set_connection_seed=") . $req->val[3], getCmd("d.set_custom") . "=chk-state," . self::STE_UPDATED, getCmd("d.set_custom") . "=chk-time," . time(), getCmd("d.set_custom") . "=chk-stime," . time());
         $isStart = $req->val[4] != 0 && $req->val[5] != 0 && $req->val[6] != 0;
         if (!empty($req->val[2])) {
             $addition[] = getCmd("d.set_throttle_name=") . $req->val[2];
         }
         if (preg_match('/rat_(\\d+)/', $req->val[3], $ratio)) {
             $addition[] = getCmd("view.set_visible=") . "rat_" . $ratio;
         }
         $label = rawurldecode($req->val[1]);
         if (rTorrent::sendTorrent($torrent, $isStart, false, $req->val[0], $label, $saveUploadedTorrents, false, true, $addition)) {
             $req = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
             if ($req->success()) {
                 return null;
             }
         }
     }
     return self::STE_ERROR;
 }
开发者ID:limerainne,项目名称:ruTorrent,代码行数:30,代码来源:check.php


示例2: makeSimpleCall

function makeSimpleCall($cmds, $hash)
{
    $req = new rXMLRPCRequest();
    foreach ($hash as $h) {
        foreach ($cmds as $cmd) {
            $req->addCommand(new rXMLRPCCommand($cmd, $h));
        }
    }
    return $req->success() ? $req->val : false;
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:10,代码来源:action.php


示例3: getRatiosStat

function getRatiosStat()
{
    $req = new rXMLRPCRequest(new rXMLRPCCommand("d.multicall", array("main", getCmd("d.get_hash="))));
    $ret = 'theWebUI.ratiosStat = {';
    if ($req->run() && !$req->fault) {
        $tm = time();
        for ($i = 0; $i < count($req->val); $i++) {
            $st = new rStat("torrents/" . $req->val[$i] . ".csv");
            $ratios = $st->getRatios($tm);
            if ($ret != 'theWebUI.ratiosStat = {') {
                $ret .= ',';
            }
            $ret .= '"' . $req->val[$i] . '": [' . $ratios[0] . ',' . $ratios[1] . ',' . $ratios[2] . ']';
        }
    }
    return $ret . '}; ';
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:17,代码来源:ratios.php


示例4: getNFO

function getNFO()
{
    if ($_GET['id']) {
        $hash = $_GET['id'];
        $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_base_path", $hash), new rXMLRPCCommand("d.get_name", $hash)));
        if ($req->success()) {
            $dir = $req->val[0];
            if ($h = opendir($dir)) {
                while (false !== ($file = readdir($h))) {
                    if (preg_match("/\\.nfo\$/", $file)) {
                        return file_get_contents($dir . "/" . $file);
                    }
                }
            }
        }
    }
    return false;
}
开发者ID:ravenstar,项目名称:rutorrent-essential,代码行数:18,代码来源:view.php


示例5: fastResume

 public static function fastResume($torrent, $base, $add_path = true)
 {
     $files = array();
     $info = $torrent->info;
     $psize = intval($info['piece length']);
     $base = trim($base);
     if ($base == '') {
         $req = new rXMLRPCRequest(new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, 'get_directory'));
         if ($req->success()) {
             $base = $req->val[0];
         }
     }
     if ($psize && \model\xmlrpc\rTorrentSettings::get(\config\Conf::$userscgi)->correctDirectory($base)) {
         $base = addslash($base);
         $tsize = 0.0;
         if (isset($info['files'])) {
             foreach ($info['files'] as $key => $file) {
                 $tsize += floatval($file['length']);
                 $files[] = $add_path ? $info['name'] . "/" . implode('/', $file['path']) : implode('/', $file['path']);
             }
         } else {
             $tsize = floatval($info['length']);
             $files[] = $info['name'];
         }
         $chunks = intval(($tsize + $psize - 1) / $psize);
         $torrent->{'libtorrent_resume'}['bitfield'] = intval($chunks);
         if (!isset($torrent->{'libtorrent_resume'}['files'])) {
             $torrent->{'libtorrent_resume'}['files'] = array();
         }
         foreach ($files as $key => $file) {
             $ss = LFS::stat($base . $file);
             if ($ss === false) {
                 return false;
             }
             if (count($torrent->{'libtorrent_resume'}['files']) < $key) {
                 $torrent->{'libtorrent_resume'}['files'][$key]['mtime'] = $ss["mtime"];
             } else {
                 $torrent->{'libtorrent_resume'}['files'][$key] = array("priority" => 2, "mtime" => $ss["mtime"]);
             }
         }
         return $torrent;
     }
     return false;
 }
开发者ID:CamTosh,项目名称:Mediastorrent,代码行数:44,代码来源:rTorrent.php


示例6: trim

                 }
             }
             if ($setComment) {
                 $torrent->clear_comment();
                 $comment = trim($comment);
                 if (strlen($comment)) {
                     $torrent->comment($comment);
                 }
             }
             if (isset($torrent->{'rtorrent'})) {
                 unset($torrent->{'rtorrent'});
             }
             if (count($req->val) > 9) {
                 $throttle = getCmd("d.set_throttle_name=") . $req->val[9];
             }
             $eReq = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
             if ($eReq->run() && !$eReq->fault) {
                 $label = rawurldecode($req->val[5]);
                 if (!rTorrent::sendTorrent($torrent, $isStart, false, $req->val[6], $label, false, $req->val[8] == 1, false, array(getCmd("d.set_custom3") . "=1", getCmd("d.set_connection_seed=") . $req->val[7], $throttle))) {
                     $errors[] = array('desc' => "theUILang.errorAddTorrent", 'prm' => $fname);
                 }
             } else {
                 $errors[] = array('desc' => "theUILang.badLinkTorTorrent", 'prm' => '');
             }
         } else {
             $errors[] = array('desc' => "theUILang.errorReadTorrent", 'prm' => $fname);
         }
     } else {
         $errors[] = array('desc' => "theUILang.cantFindTorrent", 'prm' => '');
     }
 } else {
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:action.php


示例7: flush

 public function flush()
 {
     $req1 = new rXMLRPCRequest(new rXMLRPCCommand("view_list"));
     if ($req1->run() && !$req1->fault) {
         $insCmd = getCmd('branch=');
         $req = new rXMLRPCRequest();
         for ($i = 0; $i < MAX_RATIO; $i++) {
             $insCmd .= getCmd('d.views.has=') . 'rat_' . $i . ',,';
             $rat = $this->rat[$i];
             if (!in_array("rat_" . $i, $req1->val)) {
                 $req->addCommand(new rXMLRPCCommand("group.insert_persistent_view", array("", "rat_" . $i)));
             }
             if ($this->isCorrect($i)) {
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.enable", array("")));
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.min.set", $rat["min"]));
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.max.set", $rat["max"]));
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.upload.set", floatval($rat["upload"] * 1024 * 1024)));
                 switch ($rat["action"]) {
                     case RAT_STOP:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close="))));
                         break;
                     case RAT_STOP_AND_REMOVE:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close=") . "; " . getCmd("view.set_not_visible") . "=rat_" . $i . "; " . getCmd("d.views.remove") . "=rat_" . $i)));
                         break;
                     case RAT_ERASE:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close=") . "; " . getCmd("d.erase="))));
                         break;
                     case RAT_ERASEDATA:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close=") . "; " . getCmd("d.set_custom5=") . "1; " . getCmd("d.erase="))));
                         break;
                     default:
                         $thr = "thr_" . ($rat["action"] - RAT_FIRSTTHROTTLE);
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd('cat') . '=$' . getCmd("d.stop") . '=,$' . getCmd("d.set_throttle_name=") . $thr . ',$' . getCmd('d.start='))));
                         break;
                 }
             }
         }
         if ($this->isCorrect($this->default - 1)) {
             $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_ratio' . getUser(), $insCmd . getCmd('view.set_visible=') . 'rat_' . ($this->default - 1))));
         } else {
             $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_ratio' . getUser(), getCmd('cat='))));
         }
         return $req->run() && !$req->fault;
     }
     return false;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:46,代码来源:ratio.php


示例8: run

 public static function run($cmd, $flags = 0)
 {
     $ret = -1;
     $params = " >/dev/null 2>&1";
     if (!($flags & self::FLG_WAIT)) {
         $params .= " &";
     }
     if ($flags & self::FLG_RUN_AS_WEB) {
         if (self::FLG_RUN_AS_CMD) {
             $cmd = '-c "' . $cmd . '"';
         }
         exec('sh ' . $cmd . $params, $output, $ret);
     } else {
         $req = new rXMLRPCRequest(rTorrentSettings::get()->iVersion >= 0x900 && !($flags & self::FLG_WAIT) ? new rXMLRPCCommand("execute.nothrow.bg", array("", "sh", $cmd)) : new rXMLRPCCommand("execute_nothrow", array("sh", "-c", $cmd . $params)));
         if ($req->success() && count($req->val)) {
             $ret = intval($req->val[0]);
         }
     }
     return $ret;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:20,代码来源:task.php


示例9: rXMLRPCRequest

<?php

if (chdir(dirname(__FILE__))) {
    if (count($argv) > 3) {
        $_SERVER['REMOTE_USER'] = $argv[3];
    }
    if (count($argv) > 2 && empty($argv[2])) {
        require_once "rquota.php";
        $qt = rQuota::load();
        if (!$qt->check()) {
            $action = new rXMLRPCRequest(new rXMLRPCCommand("d.stop", $argv[1]));
            $action->run();
        } else {
            $qt->restoreDL();
        }
    }
}
开发者ID:RobbieL811,项目名称:rutorrent_stuff,代码行数:17,代码来源:pauser.php


示例10: setHandlers

 public function setHandlers()
 {
     $theSettings = rTorrentSettings::get();
     $pathToXmpp = dirname(__FILE__);
     $req = new rXMLRPCRequest();
     if ($this->message !== '' && isset($this->jabberServer) && isset($this->jabberLogin) && isset($this->jabberPasswd) && isset($this->jabberFor)) {
         $cmd = $theSettings->getOnFinishedCommand(array('xmpp' . getUser(), getCmd('execute.nothrow.bg') . '={' . getPHP() . ',' . $pathToXmpp . '/notify.php,"$' . getCmd('d.name') . '=","' . getUser() . '"}'));
     } else {
         $cmd = $theSettings->getOnFinishedCommand(array('xmpp' . getUser(), getCmd('cat=')));
     }
     $req->addCommand($cmd);
     return $req->success();
 }
开发者ID:nilimahona,项目名称:quick-box,代码行数:13,代码来源:xmpp.php


示例11: rXMLRPCRequest

<?php

$req = new rXMLRPCRequest(rTorrentSettings::get()->getRemoveScheduleCommand("rss"));
$req->run();
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:4,代码来源:done.php


示例12: setHandlers

 public function setHandlers()
 {
     global $rootPath;
     if ($this->enabled) {
         $cmd = rTorrentSettings::get()->getOnFinishedCommand(array('unpack' . getUser(), getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/unpack/update.php,$' . getCmd('d.get_directory') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,$' . getCmd('d.get_custom1') . '=,$' . getCmd('d.get_name') . '=,' . getCmd('d.get_hash') . '=,' . getUser() . '}'));
     } else {
         $cmd = rTorrentSettings::get()->getOnFinishedCommand(array('unpack' . getUser(), getCmd('cat=')));
     }
     $req = new rXMLRPCRequest($cmd);
     return $req->success();
 }
开发者ID:jcvfen,项目名称:rutorrent,代码行数:11,代码来源:unpack.php


示例13: getActiveTorrents

 public static function getActiveTorrents()
 {
     $delta = 2;
     $cmd = new rXMLRPCCommand("d.multicall", array("started", getCmd("d.get_hash="), getCmd("d.get_connection_current=")));
     if (rTorrentSettings::get()->iVersion >= 0x805) {
         $cmd->addParameter(getCmd("d.get_custom=") . "sch_ignore");
         $delta = 3;
     }
     $req = new rXMLRPCRequest($cmd);
     $seeds = array();
     $leeches = array();
     if ($req->run() && !$req->fault) {
         for ($i = 0; $i < count($req->val); $i += $delta) {
             $hash = $req->val[$i];
             if ($delta == 2 || empty($req->val[$i + 2])) {
                 if ($req->val[$i + 1] == 'leech') {
                     $leeches[$hash] = true;
                 } else {
                     $seeds[$hash] = true;
                 }
             }
         }
     }
     return array("seeds" => $seeds, "leeches" => $leeches);
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:25,代码来源:scheduler.php


示例14: setHandlers

 public function setHandlers()
 {
     global $rootPath;
     $throttleRulesExist = false;
     $ratioRulesExist = false;
     foreach ($this->lst as $item) {
         if ($item->ratio != '') {
             $ratioRulesExist = true;
         }
         if ($item->channel != '') {
             $throttleRulesExist = true;
         }
     }
     if ($ratioRulesExist) {
         eval(getPluginConf('ratio'));
         $insCmd = '';
         for ($i = 0; $i < MAX_RATIO; $i++) {
             $insCmd .= getCmd('d.views.has=') . 'rat_' . $i . ',,';
         }
         $ratCmd = getCmd('d.set_custom') . '=x-extratio1,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,ratio,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio1,,' . $insCmd . getCmd('view.set_visible') . '=$' . getCmd('d.get_custom') . '=x-extratio1';
     } else {
         $ratCmd = getCmd('cat=');
     }
     if ($throttleRulesExist) {
         $thrCmd = getCmd('d.set_custom') . '=x-extratio2,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,channel,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio2,,' . getCmd('d.set_throttle_name') . '=$' . getCmd('d.get_custom') . '=x-extratio2';
     } else {
         $thrCmd = getCmd('cat=');
     }
     $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('_exratio1' . getUser(), $ratCmd)), rTorrentSettings::get()->getOnInsertCommand(array('_exratio2' . getUser(), $thrCmd))));
     return $req->success();
 }
开发者ID:byte916,项目名称:ruTorrent,代码行数:31,代码来源:rules.php


示例15: setHandlers

 public function setHandlers()
 {
     global $autowatch_interval;
     $theSettings = rTorrentSettings::get();
     $req = new rXMLRPCRequest($theSettings->getOnInsertCommand(array('autolabel' . getUser(), getCmd('cat='))));
     $pathToAutoTools = dirname(__FILE__);
     if ($this->enable_label) {
         $cmd = $theSettings->getOnInsertCommand(array('_autolabel' . getUser(), getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd("d.get_custom1") . '=,"' . getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/label.php,$' . getCmd("d.get_hash") . '=,' . getUser() . '}"'));
     } else {
         $cmd = $theSettings->getOnInsertCommand(array('_autolabel' . getUser(), getCmd('cat=')));
     }
     $req->addCommand($cmd);
     if ($this->enable_move && trim($this->path_to_finished) != '') {
         if ($theSettings->iVersion < 0x808) {
             $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('d.set_custom') . '=x-dest,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-dest,,' . getCmd('d.set_directory_base') . '=$' . getCmd('d.get_custom') . '=x-dest'));
         } else {
             if ($this->fileop_type == "Move") {
                 $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('d.set_directory_base') . '="$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $pathToAutoTools . '/check.php,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}" ; ' . getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}'));
             } else {
                 $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}'));
             }
         }
     } else {
         $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('cat=')));
     }
     $req->addCommand($cmd);
     if ($this->enable_watch && trim($this->path_to_watch) != '') {
         $cmd = $theSettings->getAbsScheduleCommand('autowatch', $autowatch_interval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($pathToAutoTools . '/watch.php') . ' ' . escapeshellarg(getUser()) . ' &}');
     } else {
         $cmd = $theSettings->getRemoveScheduleCommand('autowatch');
     }
     $req->addCommand($cmd);
     return $req->success();
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:34,代码来源:autotools.php


示例16: run

 public static function run($hash, $state = null, $time = null, $successful_time = null)
 {
     global $saveUploadedTorrents;
     if (is_null($state)) {
         self::getState($hash, $state, $time, $successful_time);
     }
     if ($state == self::STE_INPROGRESS && time() - $time > self::MAX_LOCK_TIME) {
         $state = 0;
     }
     if ($state != self::STE_INPROGRESS) {
         $state = self::STE_INPROGRESS;
         if (!self::setState($hash, $state)) {
             return false;
         }
         $fname = rTorrentSettings::get()->session . $hash . ".torrent";
         if (is_readable($fname)) {
             $torrent = new Torrent($fname);
             if (!$torrent->errors()) {
                 if (preg_match('`^http://(?P<tracker>rutracker)\\.org/forum/viewtopic\\.php\\?t=(?P<id>\\d+)$`', $torrent->comment(), $matches) || preg_match('`^http://(?P<tracker>kinozal)\\.tv/details\\.php\\?id=(?P<id>\\d+)$`', $torrent->comment(), $matches)) {
                     if ($matches["tracker"] == "rutracker") {
                         $client = self::makeClient($torrent->comment());
                         if ($client->status == 200 && preg_match("`ajax.form_token\\s*=\\s*'(?P<form_token>[^']+)';.*topic_id\\s*:\\s*(?P<topic_id>\\d+),\\s*t_hash\\s*:\\s*'(?P<t_hash>[^']+)'`s", $client->results, $matches1)) {
                             $client->setcookies();
                             $client->fetch("http://rutracker.org/forum/ajax.php", "POST", "application/x-www-form-urlencoded; charset=UTF-8", "action=get_info_hash" . "&topic_id=" . $matches1["topic_id"] . "&t_hash=" . $matches1["t_hash"] . "&form_token=" . $matches1["form_token"]);
                             if ($client->status == 200) {
                                 $ret = json_decode($client->results, true);
                                 if ($ret && array_key_exists("ih_hex", $ret) && strtoupper($ret["ih_hex"]) == $hash) {
                                     self::setState($hash, self::STE_UPTODATE);
                                     return true;
                                 }
                             }
                         }
                         $client->setcookies();
                         $client->fetchComplex("http://dl.rutracker.org/forum/dl.php?t=" . $matches["id"]);
                     } else {
                         if ($matches["tracker"] == "kinozal") {
                             $client = self::makeClient("http://kinozal.tv/get_srv_details.php?action=2&id=" . $matches["id"]);
                             if ($client->status == 200 && preg_match('`<li>.*(?P<hash>[0-9A-Fa-f]{40})</li>`', $client->results, $matches1)) {
                                 if (strtoupper($matches1["hash"]) == $hash) {
                                     self::setState($hash, self::STE_UPTODATE);
                                     return true;
                                 }
                             }
                             $client->setcookies();
                             $client->fetchComplex("http://dl.kinozal.tv/download.php?id=" . $matches["id"]);
                         } else {
                             self::setState($hash, self::STE_NOT_NEED);
                             return true;
                         }
                     }
                     if ($client->status == 200) {
                         $torrent = new Torrent($client->results);
                         if (!$torrent->errors()) {
                             if ($torrent->hash_info() != $hash) {
                                 $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_directory_base", $hash), new rXMLRPCCommand("d.get_custom1", $hash), new rXMLRPCCommand("d.get_throttle_name", $hash), new rXMLRPCCommand("d.get_connection_seed", $hash), new rXMLRPCCommand("d.is_open", $hash), new rXMLRPCCommand("d.is_active", $hash), new rXMLRPCCommand("d.get_state", $hash), new rXMLRPCCommand("d.stop", $hash), new rXMLRPCCommand("d.close", $hash)));
                                 if ($req->success()) {
                                     $addition = array(getCmd("d.set_connection_seed=") . $req->val[3], getCmd("d.set_custom") . "=chk-state," . self::STE_UPDATED, getCmd("d.set_custom") . "=chk-time," . time(), getCmd("d.set_custom") . "=chk-stime," . time());
                                     $isStart = $req->val[4] != 0 && $req->val[5] != 0 && $req->val[6] != 0;
                                     if (!empty($req->val[2])) {
                                         $addition[] = getCmd("d.set_throttle_name=") . $req->val[2];
                                     }
                                     if (preg_match('/rat_(\\d+)/', $req->val[3], $ratio)) {
                                         $addition[] = getCmd("view.set_visible=") . "rat_" . $ratio;
                                     }
                                     $label = rawurldecode($req->val[1]);
                                     if (rTorrent::sendTorrent($torrent, $isStart, false, $req->val[0], $label, $saveUploadedTorrents, false, true, $addition)) {
                                         $req = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
                                         if ($req->success()) {
                                             $state = null;
                                         }
                                     }
                                 }
                             } else {
                                 $state = self::STE_UPTODATE;
                             }
                         } else {
                             $state = self::STE_DELETED;
                         }
                     } else {
                         $state = $client->status < 0 ? self::STE_CANT_REACH_TRACKER : self::STE_DELETED;
                     }
                 } else {
                     $state = self::STE_NOT_NEED;
                 }
             }
         }
         if ($state == self::STE_INPROGRESS) {
             $state == self::STE_ERROR;
         }
         if (!is_null($state)) {
             self::setState($hash, $state);
         }
     }
     return $state != self::STE_CANT_REACH_TRACKER;
 }
开发者ID:anthonyryan1,项目名称:ruTorrent,代码行数:95,代码来源:check.php


示例17: rtRemoveLastToken

                $torrent_dir = rtRemoveLastToken($torrent_dir, '/');
            }
            $lbl_dir = rtGetRelativePath($default_dir, $torrent_dir);
            if ($lbl_dir == "./") {
                $lbl_dir = "";
            }
            $label = str_replace("{DIR}", $lbl_dir, $label);
        }
    } else {
        Debug("rXMLRPCRequest() fail");
        $is_ok = false;
    }
}
// Get info about tracker
if ($is_ok && strpos($label, "{TRACKER}") !== false) {
    $req = new rXMLRPCRequest(array(new rXMLRPCCommand("t.multicall", array($hash, "", getCmd("t.is_enabled="), getCmd("t.get_type="), getCmd("t.get_group="), getCmd("t.get_url=")))));
    $req->setParseByTypes();
    if ($req->run() && !$req->fault) {
        for ($i = 0; $i < count($req->strings); $i++) {
            // enabled, type == 1, group == 0
            if ($req->i8s[$i * 3] == 0 || $req->i8s[$i * 3 + 1] != 1 || $req->i8s[$i * 3 + 2] != 0) {
                continue;
            }
            $lbl_tracker = parse_url($req->strings[$i], PHP_URL_HOST);
            // if tracker is not an IP address, then
            if (preg_match("/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\$/", $domain) != 1) {
                // get 2-nd level domain only
                $pos = strpos($lbl_tracker, '.');
                if ($pos !== false) {
                    $tmp = substr($lbl_tracker, $pos + 1);
                    if (strpos($tmp, '.') !== false) {
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:label.php


示例18: obtain

 public function obtain()
 {
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_upload_rate"), new rXMLRPCCommand("get_download_rate")));
     if ($req->run() && !$req->fault) {
         $req1 = new rXMLRPCRequest();
         if ($req->val[0] == 0) {
             $req1->addCommand(new rXMLRPCCommand("set_upload_rate", MAX_SPEED));
         }
         if ($req->val[1] == 0) {
             $req1->addCommand(new rXMLRPCCommand("set_download_rate", MAX_SPEED));
         }
         if (($req->val[0] == 0 || $req->val[1] == 0) && (!$req1->run() || $req1->fault)) {
             return false;
         }
         return $this->correct();
     }
     return false;
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:18,代码来源:throttle.php


示例19: obtain

 public function obtain()
 {
     $req = new rXMLRPCRequest(new rXMLRPCCommand("system.client_version"));
     if ($req->run() && count($req->val)) {
         $this->linkExist = true;
         $this->version = $req->val[0];
         $parts = explode('.', $this->version);
         $this->iVersion = 0;
         for ($i = 0; $i < count($parts); $i++) {
             $this->iVersion = ($this->iVersion << 8) + $parts[$i];
         }
         if ($this->iVersion > 0x806) {
             $this->mostOfMethodsRenamed = true;
             $this->aliases = array("d.set_peer_exchange" => "d.peer_exchange.set", "d.set_connection_seed" => "d.connection_seed.set");
         }
         if ($this->iVersion == 0x808) {
             $req = new rXMLRPCRequest(new rXMLRPCCommand("file.prioritize_toc"));
             $req->important = false;
             if ($req->success()) {
                 $this->iVersion = 0x809;
             }
         }
         $this->apiVersion = 0;
         if ($this->iVersion >= 0x901) {
             $req = new rXMLRPCRequest(new rXMLRPCCommand("system.api_version"));
             $req->important = false;
             if ($req->success()) {
                 $this->apiVersion = $req->val[0];
             }
         }
         $req = new rXMLRPCRequest(new rXMLRPCCommand("to_kb", floatval(1024)));
         if ($req->run()) {
             if (!$req->fault) {
                 $this->badXMLRPCVersion = false;
             }
             $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_directory"), new rXMLRPCCommand("get_session"), new rXMLRPCCommand("system.library_version"), new rXMLRPCCommand("set_xmlrpc_size_limit", 67108863), new rXMLRPCCommand("get_name"), new rXMLRPCCommand("get_port_range")));
             if ($req->run() && !$req->fault) {
                 $this->directory = $req->val[0];
                 $this->session = $req->val[1];
                 $this->libVersion = $req->val[2];
                 $this->server = $req->val[4];
                 $this->portRange = $req->val[5];
                 $this->port = intval($this->portRange);
                 if ($this->iVersion >= 0x809) {
                     $req = new rXMLRPCRequest(new rXMLRPCCommand("network.listen.port"));
                     $req->important = false;
                     if ($req->success()) {
                         $this->port = intval($req->val[0]);
                     }
                 }
                 if (isLocalMode()) {
                     if (!empty($this->session)) {
                         $this->started = @filemtime($this->session . '/rtorrent.lock');
                         if ($this->started === false) {
                             $this->started = 0;
                         }
                     }
                     $id = getExternal('id');
                     $req = new rXMLRPCRequest(new rXMLRPCCommand("execute_capture", array("sh", "-c", $id . " -u ; " . $id . " -G ; echo ~ ")));
                     if ($req->run() && !$req->fault && ($line = explode("\n", $req->val[0])) !== false && count($line) > 2) {
                         $this->uid = intval(trim($line[0]));
                         $this->gid = explode(' ', trim($line[1]));
                         $this->home = trim($line[2]);
                         if (!empty($this->directory) && $this->directory[0] == '~') {
                             $this->directory = $this->home . substr($this->directory, 1);
                         }
                     } else {
                         $this->idNotFound = true;
                     }
                 }
                 $this->store();
             }
         }
     }
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:75,代码来源:settings.php


示例20: setHandlers

 public function setHandlers()
 {
     if (rTorrentSettings::get()->linkExist) {
         $req = new rXMLRPCRequest($this->hasAuto() ? rTorrentSettings::get()->getScheduleCommand("loginmgr", 1440, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}') : rTorrentSettings::get()->getRemoveScheduleCommand("loginmgr"));
         $req->success();
     }
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:7,代码来源:accounts.php



注:本文中的rXMLRPCRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP rating类代码示例发布时间:2022-05-23
下一篇:
PHP rTorrentSettings类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap