当前位置: 首页>>代码示例>>PHP>>正文


PHP rTorrentSettings::get方法代码示例

本文整理汇总了PHP中rTorrentSettings::get方法的典型用法代码示例。如果您正苦于以下问题:PHP rTorrentSettings::get方法的具体用法?PHP rTorrentSettings::get怎么用?PHP rTorrentSettings::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rTorrentSettings的用法示例。


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

示例1: correct

 public function correct($deltaUp, $deltaDown)
 {
     $tm = getdate();
     $ndx = $tm["hours"];
     $was = getdate($this->hourHitTimes[$ndx]);
     if ($tm[0] - $this->hourHitTimes[$ndx] > 3600 + 3600 || $ndx != $was["hours"]) {
         $this->hourHitTimes[$ndx] = $tm[0];
         $this->hourUp[$ndx] = 0;
         $this->hourDown[$ndx] = 0;
     }
     $this->hourUp[$ndx] += $deltaUp;
     $this->hourDown[$ndx] += $deltaDown;
     $ndx = $tm["mday"] - 1;
     $was = getdate($this->monthHitTimes[$ndx]);
     if ($tm[0] - $this->monthHitTimes[$ndx] > 3600 * 24 + 3600 || $ndx != $was["mday"] - 1) {
         $this->monthHitTimes[$ndx] = $tm[0];
         $this->monthUp[$ndx] = 0;
         $this->monthDown[$ndx] = 0;
     }
     $this->monthUp[$ndx] += $deltaUp;
     $this->monthDown[$ndx] += $deltaDown;
     $ndx = $tm["mon"] - 1;
     $was = getdate($this->yearHitTimes[$ndx]);
     if ($tm[0] - $this->yearHitTimes[$ndx] > 3600 * 24 * 31 + 3600 || $ndx != $was["mon"] - 1) {
         $this->yearHitTimes[$ndx] = $tm[0];
         $this->yearUp[$ndx] = 0;
         $this->yearDown[$ndx] = 0;
     }
     $this->yearUp[$ndx] += $deltaUp;
     $this->yearDown[$ndx] += $deltaDown;
     rTorrentSettings::get()->pushEvent("TraficUpdated", array("stat" => &$this));
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:32,代码来源:stat.php

示例2: sendTorrent

 public static function sendTorrent($fname, $isStart, $directory = null)
 {
     $hash = false;
     $torrent = is_object($fname) ? $fname : new \model\simple\Torrent($fname);
     if (!$torrent->errors()) {
         $raw_value = base64_encode($torrent->__toString());
         $filename = is_object($fname) ? $torrent->getFileName() : $fname;
         if (strlen($raw_value) < self::RTORRENT_PACKET_LIMIT || is_null($filename)) {
             $cmd = new rXMLRPCCommand(\config\Conf::$userscgi, $isStart ? 'load.raw_start' : 'load.raw');
             $cmd->addParameter("");
             $cmd->addParameter($raw_value, "base64");
             if (!is_null($filename) && !true) {
                 @unlink($filename);
             }
         } else {
             $cmd = new rXMLRPCCommand(\config\Conf::$userscgi, $isStart ? 'load.start' : 'load.normal');
             $cmd->addParameter("");
             $cmd->addParameter($filename);
         }
         if (!is_null($filename) && rTorrentSettings::get(\config\Conf::$userscgi)->iVersion >= 0x805) {
             $cmd->addParameter(rTorrentSettings::getCmd(\config\Conf::$userscgi, "d.custom.set") . "=x-filename," . rawurlencode(basename($filename)));
         }
         $req = new rXMLRPCRequest(\config\Conf::$userscgi);
         $req->addCommand($cmd);
         if (!is_null($directory)) {
             $cmd->addParameter(rTorrentSettings::getCmd(\config\Conf::$userscgi, "d.directory.set=") . "\"" . $directory . "\"");
         }
         if ($req->run() && !$req->fault) {
             $hash = $req->val;
         }
     }
     return $hash;
 }
开发者ID:CamTosh,项目名称:Mediastorrent,代码行数:33,代码来源:rTorrent.php

示例3: init

 public function init()
 {
     $req = new rXMLRPCRequest();
     for ($i = 0; $i < MAX_THROTTLE; $i++) {
         if ($this->isCorrect($i)) {
             $up = $this->thr[$i]["up"];
             $down = $this->thr[$i]["down"];
         } else {
             $up = 0;
             $down = 0;
         }
         $req->addCommand(new rXMLRPCCommand("throttle_up", array("thr_" . $i, $up . "")));
         $req->addCommand(new rXMLRPCCommand("throttle_down", array("thr_" . $i, $down . "")));
     }
     if ($this->isCorrect($this->default - 1)) {
         $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_throttle' . getUser(), getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd("d.get_throttle_name") . '=,' . getCmd('d.set_throttle_name') . '=thr_' . ($this->default - 1))));
     } else {
         $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_throttle' . getUser(), getCmd('cat='))));
     }
     return $req->run() && !$req->fault;
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:21,代码来源:throttle.php

示例4: load

 public static function load($mngr = null)
 {
     $cache = new rCache();
     $ar = new rURLRewriteRulesList();
     $cache->get($ar);
     if (rTorrentSettings::get()->isPluginRegistered("rss")) {
         $changed = false;
         if (is_null($mngr)) {
             require_once dirname(__FILE__) . '/../rss/rss.php';
             $mngr = new rRSSManager();
         }
         foreach ($ar->lst as $rule) {
             if (!empty($rule->rssHash) && !$mngr->rssList->isExist($rule->rssHash) && !$mngr->groups->get($rule->rssHash)) {
                 $rule->rssHash = '';
                 $changed = true;
             }
         }
         if ($changed) {
             $ar->store();
         }
     }
     return $ar;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:23,代码来源:rules.php

示例5: run

 public static function run($hash, $state = null, $time = null, $successful_time = null)
 {
     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)) {
             $state = self::run_ex($hash, $fname);
         }
         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:limerainne,项目名称:ruTorrent,代码行数:26,代码来源:check.php

示例6: rXMLRPCRequest

<?php

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

示例7: Debug

    Debug("enabled          : " . $at->enable_watch);
    Debug("autostart        : " . $at->watch_start);
    if ($at->enable_watch) {
        $auto_start = $at->watch_start;
        $path_to_watch = rtAddTailSlash(trim($at->path_to_watch));
        Debug("path_to_watch    : " . $path_to_watch);
        if ($path_to_watch == '' || $path_to_watch == '/') {
            $is_ok = false;
        }
    } else {
        $is_ok = false;
    }
}
// Ask info from rTorrent
if ($is_ok) {
    $directory = rtAddTailSlash(rTorrentSettings::get()->directory);
    Debug("get_directory    : " . $directory);
    if ($directory == '' || $directory == '/') {
        $is_ok = false;
    }
}
// Scan for *.torrent files at $path_to_watch
if ($is_ok) {
    $files = rtScanFiles($path_to_watch, "/.*\\.torrent\$/i");
    // ignore case
    foreach ($files as $file) {
        $torrent_file = $path_to_watch . $file;
        // don't use realpath() here !!!
        $dest_path = rtAddTailSlash(dirname($directory . $file));
        Debug("torrent file     : " . $torrent_file);
        Debug("save data to     : " . $dest_path);
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:watch.php

示例8: eval

<?php

require_once "xmlrpc.php";
eval(getPluginConf($plugin["name"]));
$session = rTorrentSettings::get()->session;
if (!strlen($session) || !@file_exists(addslash(rTorrentSettings::get()->session) . '.')) {
    $jResult .= "plugin.disable(); noty('" . $plugin["name"] . ": '+theUILang.webBadSessionError+' (" . $session . ").','error');";
} else {
    if ($updateInterval) {
        $req = new rXMLRPCRequest($theSettings->getScheduleCommand('rutracker_check', $updateInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' &}'));
        if ($req->success()) {
            $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
        } else {
            $jResult .= "plugin.disable(); noty('rutracker_check: '+theUILang.pluginCantStart, 'error');";
        }
    } else {
        require 'done.php';
        $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
    }
}
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:20,代码来源:init.php

示例9: rXMLRPCRequest

     }
     break;
 case "add_peer":
     $req = new rXMLRPCRequest(new rXMLRPCCommand("add_peer", array($hash[0], $vs[0])));
     if ($req->success()) {
         $result = $req->val;
     }
     break;
 case "getchunks":
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_bitfield", $hash[0]), new rXMLRPCCommand("d.get_chunk_size", $hash[0]), new rXMLRPCCommand("d.get_size_chunks", $hash[0])));
     if (rTorrentSettings::get()->apiVersion >= 4) {
         $req->addCommand(new rXMLRPCCommand("d.chunks_seen", $hash[0]));
     }
     if ($req->success()) {
         $result = array("chunks" => $req->val[0], "size" => $req->val[1], "tsize" => $req->val[2]);
         if (rTorrentSettings::get()->apiVersion >= 4) {
             $result["seen"] = $req->val[3];
         }
     }
     break;
 default:
     if (isset($HTTP_RAW_POST_DATA)) {
         $result = rXMLRPCRequest::send($HTTP_RAW_POST_DATA);
         if (!empty($result)) {
             $pos = strpos($result, "\r\n\r\n");
             if ($pos !== false) {
                 $result = substr($result, $pos + 4);
             }
             cachedEcho($result, "text/xml");
         }
     }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:action.php

示例10: makeCall

 protected function makeCall()
 {
     rTorrentSettings::get()->patchDeprecatedRequest($this->commands);
     $this->fault = false;
     $this->content = "";
     $cnt = count($this->commands);
     if ($cnt > 0) {
         $this->content = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>';
         if ($cnt == 1) {
             $cmd = $this->commands[0];
             $this->content .= "{$cmd->command}</methodName><params>\r\n";
             foreach ($cmd->params as &$prm) {
                 $this->content .= "<param><value><{$prm->type}>{$prm->value}</{$prm->type}></value></param>\r\n";
             }
         } else {
             $this->content .= "system.multicall</methodName><params><param><value><array><data>";
             foreach ($this->commands as &$cmd) {
                 $this->content .= "\r\n<value><struct><member><name>methodName</name><value><string>" . "{$cmd->command}</string></value></member><member><name>params</name><value><array><data>";
                 foreach ($cmd->params as &$prm) {
                     $this->content .= "\r\n<value><{$prm->type}>{$prm->value}</{$prm->type}></value>";
                 }
                 $this->content .= "\r\n</data></array></value></member></struct></value>";
             }
             $this->content .= "\r\n</data></array></value></param>";
         }
         $this->content .= "</params></methodCall>";
     }
     return $cnt > 0;
 }
开发者ID:jcvfen,项目名称:rutorrent,代码行数:29,代码来源:xmlrpc.php

示例11: trim

        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);
    }
    exit(1);
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:createtorrent.php

示例12: trim

if ($at->setHandlers()) {
    $jResult .= $at->get();
    if ($do_diagnostic) {
        if ($at->enable_move) {
            $path_to_finished = trim($at->path_to_finished);
            if (!rTorrentSettings::get()->correctDirectory($path_to_finished)) {
                $path_to_finished = '';
            }
            if ($path_to_finished == '') {
                $jResult .= "plugin.showError('theUILang.autotoolsNoPathToFinished');";
            } else {
                $session = rTorrentSettings::get()->session;
                if (!strlen($session) || !@file_exists(addslash(rTorrentSettings::get()->session) . '.')) {
                    $jResult .= "plugin.disable(); noty('" . $plugin["name"] . ": '+theUILang.webBadSessionWarning+' (" . $session . ").','error');";
                }
            }
        }
        if ($at->enable_watch) {
            $path_to_watch = trim($at->path_to_watch);
            if (!rTorrentSettings::get()->correctDirectory($path_to_watch)) {
                $path_to_watch = '';
            }
            if ($path_to_watch == '') {
                $jResult .= "plugin.showError('theUILang.autotoolsNoPathToWatch');";
            }
        }
    }
    $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
} else {
    $jResult .= "plugin.disable(); noty('autotools: '+theUILang.pluginCantStart,'error');";
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:init.php

示例13: 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

示例14: setHandlers

 public function setHandlers()
 {
     global $rootPath;
     if ($this->log["addition"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_addition"]) {
         $addCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',1,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}';
     } else {
         $addCmd = getCmd('cat=');
     }
     if ($this->log["finish"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_finish"]) {
         $finCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',2,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}';
     } else {
         $finCmd = getCmd('cat=');
     }
     if ($this->log["deletion"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_deletion"]) {
         $delCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',3,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}';
     } else {
         $delCmd = getCmd('cat=');
     }
     $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('thistory' . getUser(), $addCmd)), rTorrentSettings::get()->getOnFinishedCommand(array('thistory' . getUser(), $finCmd)), rTorrentSettings::get()->getOnEraseCommand(array('thistory' . getUser(), $delCmd))));
     return $req->success();
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:21,代码来源:history.php

示例15: foreach

                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (count($trackers) > 0) {
     $announce_list[] = $trackers;
 }
 if ($setComment || $setTrackers || $setPrivate) {
     foreach ($hashes as $hash) {
         $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_session"), new rXMLRPCCommand("d.is_open", $hash), new rXMLRPCCommand("d.is_active", $hash), new rXMLRPCCommand("d.get_state", $hash), new rXMLRPCCommand("d.get_tied_to_file", $hash), new rXMLRPCCommand("d.get_custom1", $hash), new rXMLRPCCommand("d.get_directory_base", $hash), new rXMLRPCCommand("d.get_connection_seed", $hash), new rXMLRPCCommand("d.get_complete", $hash)));
         $throttle = null;
         if (rTorrentSettings::get()->isPluginRegistered("throttle")) {
             $req->addCommand(new rXMLRPCCommand("d.get_throttle_name", $hash));
         }
         if ($req->run() && !$req->fault) {
             $isStart = $req->val[1] != 0 && $req->val[2] != 0 && $req->val[3] != 0;
             $fname = $req->val[0] . $hash . ".torrent";
             if (empty($req->val[0]) || !is_readable($fname)) {
                 if (strlen($req->val[4]) && is_readable($req->val[4])) {
                     $fname = $req->val[4];
                 } else {
                     $fname = null;
                 }
             }
             if ($fname) {
                 $torrent = new Torrent($fname);
                 if (!$torrent->errors()) {
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:action.php


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