function plan_is_crossnode($username, $node)
{
    return planworld_xmlrpc_query($node, "planworld.users.getId", array($note));
}
Beispiel #2
0
function snoop_add_xmlrpc($rpcuser, $host, $remote = 0)
{
    //	if(IS_JOSH || $_SERVER['USER']=='testuser')
    //		echo "host: $host * rpcuser: $rpcuser * remote: $remote<hr>";
    // $remote in this function is just a shim for admins updating system,
    // but we're going to leverage it for the queue system just the same by
    // using it to pass in snoop_setter
    if ($remote == FALSE) {
        $snoop_setter = $_SERVER['USER'];
    } else {
        $snoop_setter = $remote;
    }
    if (!strstr($snoop_setter, '@planwatch.org')) {
        $snoop_setter .= "@planwatch.org";
    }
    $passedrpcuser = $rpcuser;
    $rpcuser = str_replace(strstr($rpcuser, '@'), '', $rpcuser);
    if (!strstr($host, '@')) {
        $host = "@" . $host;
    }
    //	if(IS_JOSH || $_SERVER['USER']=='testuser')
    //		echo "planworld_xmlrpc_query($host,\"planworld.snoop.add\",array($rpcuser,$snoop_setter),TRUE);";
    $success = planworld_xmlrpc_query($host, "planworld.snoop.add", array($rpcuser, $snoop_setter), FALSE);
    if (!$success) {
        mail("*****@*****.**", "Failed Snoop: {$rpcuser} {$host} {$snoop_setter}", "Failed Snoop: {$rpcuser} {$host} {$snoop_setter}\n\nplanworld_xmlrpc_query({$host},\"planworld.snoop.add\",array({$rpcuser},{$snoop_setter}),FALSE)\n\npassed: {$passedrpcuser};", "From: failedsnoop@planwatch.org");
    }
    /*
    	$hostinfo=planworld_node_getinfo($host);
    	$f=new xmlrpcmsg('planworld.snoop.add');
    	$f->addParam(new xmlrpcval($rpcuser, "string"));
    	$f->addParam(new xmlrpcval($snoop_setter."@planwatch.org", "string"));
    	$c=new xmlrpc_client($hostinfo["directory"], $hostinfo["server"], $hostinfo["port"]);
    	$c->setDebug(0);
    	$r=$c->send($f);
    	if (!$r) { $success = FALSE; }
    	else
    	{
    		$v=$r->value();
    		if (!$r->faultCode())
    		{
    			if ($v->kindOf()=='array')
    			{
    				$success = TRUE;
    			}
    		}
    		else $success = FALSE;
    	}
    	// If the snoop send failed for any reason, add it to the queue
    	// for later sending. This is done by creating a TIMECODE.addsnoop file in
    	// FILE_ROOT/stats which gets picked up by the queue processor in pt.php
    	if ($success == FALSE)
    	{
    		$queue_array=array("snoop_setter"=>$snoop_setter,"snoop_target"=>$rpcuser,"snoop_host"=>$host);
    		file_put_contents("$_SERVER[FILE_ROOT]/stats/".array_sum(explode(" ",microtime())).".addsnoop",serialize($queue_array));
    	}
    */
    return $success;
}
Beispiel #3
0
function send_add_xmlrpc($sender, $recipient, $message)
{
    list($recipient_username, $host) = explode("@", $recipient);
    $debug = FALSE;
    //	if(IS_JOSH) $debug=TRUE;
    $success = planworld_xmlrpc_query($host, 'planworld.send.sendMessage', array("{$sender}@planwatch.org", $recipient_username, $message));
    //	if ($success && IS_JOSH && $sender=='invite') echo "sender invite success $message";
    return $success;
}