Example #1
0
 public function correct()
 {
     $cmd = new rXMLRPCCommand("d.multicall", array("default", getCmd("d.get_hash=")));
     for ($i = 0; $i < MAX_RATIO; $i++) {
         $cmd->addParameters(array(getCmd("d.views.has") . "=rat_" . $i, getCmd("view.set_not_visible") . "=rat_" . $i));
     }
     $req = new rXMLRPCRequest($cmd);
     $req->setParseByTypes();
     if ($req->success()) {
         $req1 = new rXMLRPCRequest();
         foreach ($req->strings as $no => $hash) {
             for ($i = 0; $i < MAX_RATIO; $i++) {
                 if ($req->i8s[$no * MAX_RATIO * 2 + $i * 2] == 1) {
                     $req1->addCommand(new rXMLRPCCommand("view.set_visible", array($hash, "rat_" . $i)));
                 }
             }
         }
         return $req1->getCommandsCount() == 0 || $req1->success();
     }
     return false;
 }
Example #2
0
            }
            $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) {
                        $lbl_tracker = $tmp;