diff --git a/wrenchboard/src/shared_tool/account.cc b/wrenchboard/src/shared_tool/account.cc index 62ade3c8..49d1cd4b 100644 --- a/wrenchboard/src/shared_tool/account.cc +++ b/wrenchboard/src/shared_tool/account.cc @@ -1166,7 +1166,7 @@ long WrenchUpdateAccountTerms(CVars in, CVars &out) { } long WrenchUpdateProfile(CVars in, CVars &out) { - logfmt(logINFO, "long WrenchUpdateProfile(CVars in, CVars out)"); + logfmt(logINFO, "long WrenchUpdateProfile(CVars in, CVars out) ******* RETIRE THIS FUNCTION - no country change"); long ret = PHP_API_BAD_PARAM; try { REQ_STRING(in, "firstname", 3, 49, "(.*)"); diff --git a/wrenchboard/src/shared_tool/mobile.cc b/wrenchboard/src/shared_tool/mobile.cc index ed195f87..f8f785fc 100644 --- a/wrenchboard/src/shared_tool/mobile.cc +++ b/wrenchboard/src/shared_tool/mobile.cc @@ -186,27 +186,38 @@ long WrenchReturnUserProfile(CVars in, CVars &out) { /* This profile apps*/ long WrenchUpdateUserProfile(CVars in, CVars &out) { - logfmt(logINFO, "WrenchReturnUserProfile()"); + logfmt(logINFO, "WrenchUpdateUserProfile()"); long ret = PHP_API_BAD_PARAM; - try { + REQ_STRING(in, "firstname", 3, 49, "(.*)"); + REQ_STRING(in, "lastname", 3, 49, "(.*)"); + REQ_STRING(in, "email", 5, 150, "(.*)"); + REQ_STRING(in, "state", 3, 150, "(.*)"); + REQ_STRING(in, "city", 3, 150, "(.*)"); long member_id = REQ_LONG(in, "member_id", 1, -1); - out["total_record"] = "0"; - const PGresult *res; - res = pgsql_query("SELECT * FROM members WHERE id = %lu", member_id ); + const PGresult *res; + res = pgsql_query("SELECT * FROM members WHERE id = %lu AND uid='%s'", member_id ); if (res != NULL && pgsql_num_rows(res) > 0) { - out["total_record"] = pgsql_num_rows(res); - mapf = pgsql_fetch_assoc(res, 0); - map_to_cvars(f, out); + CVars x; + x["firstname"] = in["firstname"]; + x["firstname"].set_valid(true); + x["lastname"] = in["lastname"]; + x["lastname"].set_valid(true); + x["email"] = in["email"]; + x["email"].set_valid(true); + x["state"] = in["state"]; + x["state"].set_valid(true); + x["city"] = in["city"]; + x["city"].set_valid(true); + update_db_record(DBS_VALID, "members", x, member_id); ret = PHP_API_OK; - out["status"] = "OK"; } } catch (bad_parameter) { - logfmt(logINFO, "ERROR CALL long WrenchReturnUserProfile(CVars in, CVars &out)"); + logfmt(logINFO, "ERROR CALL long WrenchUpdateUserProfile(CVars in, CVars &out)"); } - logfmt(logINFO, "/WrenchReturnUserProfile()"); + logfmt(logINFO, "/WrenchUpdateUserProfile()"); return ret; } diff --git a/www-api/public/svs/user/userve.php b/www-api/public/svs/user/userve.php index 09daa53d..b68ea442 100755 --- a/www-api/public/svs/user/userve.php +++ b/www-api/public/svs/user/userve.php @@ -79,10 +79,10 @@ if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) { $endpoint = strtolower(str_replace('/svs/user/', '', strtok($_SERVER['REQUEST_URI'], '?'))); $id = 0; // update, get & delete actions require ID -if (substr($endpoint, 0, 19) == 'gettransportrequest' || substr($endpoint, 0, 13) == 'updateprofile') { - $endpoint = strtok($endpoint, '/'); - $id = strtok('/'); -} +//if (substr($endpoint, 0, 19) == 'gettransportrequest' || substr($endpoint, 0, 13) == 'updateprofile') { +// $endpoint = strtok($endpoint, '/'); +// $id = strtok('/'); +//} if (!isset($endpoints[$endpoint])) { header('HTTP/1.1 400 Bad Request');