| 47 | } |
| 48 | |
| 49 | bool UpdateBZDBVars::process(std::string& inputPage, |
| 50 | const HTTPRequest& request, HTTPReply& reply) { |
| 51 | UNUSED(reply); |
| 52 | std::map<std::string, std::vector<std::string> >::const_iterator itr = request.parameters.begin(); |
| 53 | |
| 54 | if (!userInfo->hasPerm("setVar")) { |
| 55 | serverError->errorMessage = "Update BZDB Var: Invalid Permission"; |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | if (!inputPage.size()) { |
| 60 | inputPage = "Vars"; |
| 61 | } |
| 62 | |
| 63 | while (itr != request.parameters.end()) { |
| 64 | const std::string& key = itr->first; |
| 65 | if (itr->second.size()) { |
| 66 | // vars only use the first param with the name. |
| 67 | const std::string val = url_decode(itr->second[0]); |
| 68 | if (strncmp(key.c_str(), "var", 3) == 0) { |
| 69 | // it's a var, |
| 70 | if (varChanged(key.c_str() + 3, val.c_str())) { |
| 71 | bz_updateBZDBString(key.c_str() + 3, val.c_str()); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | itr++; |
| 76 | } |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | bool UpdateBZDBVars::varChanged(const char* key , const char* val) { |
nothing calls this directly
no test coverage detected