Ejemplo n.º 1
0
Jarifa is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Jarifa is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Jarifa.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once "inc/rpc.inc";
$rpc = new rpc();
$host = simplexml_load_file("php://input", 'SimpleXMLElement', LIBXML_NOCDATA);
// Update <opaque><id></id></opaque> content as it is surrounded by CDATA:
$host->opaque->addChild('id', '');
$host->opaque->id = simplexml_load_string($host->opaque, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($rpc->auth($host)) {
    //fill reply with name and public key
    $rpc->xmlSigningKey();
    //check, if host already exists
    if (!$rpc->exist_host()) {
        //host is unknown, add it
        $id = $rpc->add_host();
        if ($id == False) {
            $rpc->error('database operation (add host) failed');
            echo $rpc->dom->saveXML();
            return;
Ejemplo n.º 2
0
 public function rpcCall($method, $parameters = array(), $identity)
 {
     $appName = $this->app_id;
     $appKey = apiUtil::getAppKey($appName);
     return rpc::call($method, $parameters, $appKey, $identity);
 }