function get_json() { $jsonstring = get_phpinput(); $json = json_decode(fix_utf8_encoding($jsonstring), true); if ($json === null) { report_problem(WEAVE_ERROR_JSON_PARSE, 400); } return $json; }
} else { log_error("register not enabled"); report_problem(WEAVE_ERROR_FUNCTION_NOT_SUPPORTED, 400); } } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($username == '') { log_error("user.php : Post no username"); report_problem(WEAVE_ERROR_INVALID_USERNAME, 400); } $db = new WeaveStorage($username); log_error("user.php: POST"); if ($function == "password") { #Auth the user verify_user($username, $db); $new_pwd = get_phpinput(); log_error("user.php: POST password "); //to do // change pw in db $hash = WeaveHashFactory::factory(); if ($db->change_password($hash->hash($new_pwd))) { exit("success"); } else { report_problem(WEAVE_ERROR_INVALID_PROTOCOL, 503); } //server db messed up somehow // return success // report_problem(7, 400); } else { if ($function == "email") { //change email adr