MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / process

Method process

plugins/webadmin/actions.cpp:49–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49bool 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
81bool UpdateBZDBVars::varChanged(const char* key , const char* val) {

Callers

nothing calls this directly

Calls 15

url_decodeFunction · 0.85
bz_updateBZDBStringFunction · 0.85
bz_sendTextMessageFunction · 0.85
getPlayerFromGUIDFunction · 0.85
bz_freePlayerRecordFunction · 0.85
bz_kickUserFunction · 0.85
bz_getBanListSizeFunction · 0.85
bz_IPUnbanUserFunction · 0.85
bz_getBanItemFunction · 0.85
bz_IDUnbanUserFunction · 0.85
bz_HostUnbanUserFunction · 0.85

Tested by

no test coverage detected