Ejemplo n.º 1
0
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;
        }
    }
    //
    $rpc->xmlRepeat_sec();
    //fill reply withh preferences from pool
    $rpc->xmlPreferences();
    //
    $rpc->xmlOpaqueID();
    //fill reply with project infos