uid) { return casetracker_xmlrpc_error($user); } $data = (object)$data; node_save($data); // force to object. return t('Your data was accepted and submitted as a node.'); } /** * Ensure that the given user has permission to create cases. * Stolen and made relevant for us from blogapi_validate_user(). */ function casetracker_xmlrpc_validate_user($username, $password) { global $user; $user = user_authenticate($username, $password); if ($user->uid) { if (user_access('create cases via XML-RPC')) { return $user; // authorized. excelsior! } else { // naughty little monkey has tried to overstep bounds. NO BANANAS. return t("This account does not have access to create cases via XML-RPC."); } } else { ///me clucks disapprovingly. return t('Wrong username or password.'); } } /** * Prepare an error message for returning to the XML-RPC caller. * Stolen and slightly modified from blogapi_error(). */ function casetracker_xmlrpc_error($message) { static $xmlrpcusererr; // stolen from blogapi_error. heathens. return xmlrpc_error($xmlrpcusererr + 1, strip_tags($message)); }