diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 62df32c0d..7f219e5b0 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -1058,7 +1058,7 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * */ //------------------------------------------------------------------------- void CControlAPI::GetBouquetCGI(CyhookHandler *hh) { - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); std::string result = ""; if (!(hh->ParamList.empty())) { @@ -1211,7 +1211,7 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) { bool encode = false; std::string result = ""; - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); if (hh->ParamList["showhidden"] == "false") show_hidden = false; @@ -1357,7 +1357,7 @@ void CControlAPI::epgDetailList(CyhookHandler *hh) { } // ------ generate output ------ - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); std::string result = ""; NeutrinoAPI->eList.clear(); @@ -1457,7 +1457,7 @@ void CControlAPI::SendFoundEvents(CyhookHandler *hh, bool xml_format) if (xml_format) // to stay backward compatible :/ hh->ParamList["format"] = "xml"; - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); /* TODO: maybe add following options as in tuxbox neutrino hh->ParamList["epgitem"] @@ -2996,7 +2996,7 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh) { std::string result = ""; std::string configFileName = hh->ParamList["config"]; - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); if (hh->ParamList["action"] == "submit") load = false; @@ -3133,7 +3133,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { if (hh->ParamList["action"] == "list") { // directory list: action=list&path= DIR *dirp; - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); std::string path = hh->ParamList["path"]; if ((dirp = opendir(path.c_str()))) { @@ -3259,7 +3259,7 @@ void CControlAPI::getDirCGI(CyhookHandler *hh) { std::string item = ""; bool isFirstLine = true; - TOutType outType = hh->outStart(); + TOutType outType = hh->outStart(true /*old mode*/); //Shows all 7 directories stored in the moviebrowser.conf if (hh->ParamList["dir"] == "moviedir" || hh->ParamList["dir"] == "allmoviedirs" ) { diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index d7a46bf4b..c159416d5 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -28,6 +28,7 @@ CyhookHandler::CyhookHandler() Method = M_UNKNOWN; httpStatus = HTTP_NIL; outType = plain; + outSingle = false; LastModified=0; } @@ -405,7 +406,8 @@ TOutType CyhookHandler::checkOutput() { return outType; } //----------------------------------------------------------------------------- -TOutType CyhookHandler::outStart() { +TOutType CyhookHandler::outStart(bool single) { + outSingle = single; // for compatibility // get outType outType = plain; // plain if (ParamList["format"] == "json") @@ -440,7 +442,13 @@ std::string CyhookHandler::outPair(std::string _key, std::string _content, bool result += "\n"; break; default: - result = _content; + if (outSingle) + result = _content; + else + { + result = _key + "=" + _content; + result += "\n"; + } break; } return result; diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index d5556a043..781d8dc9f 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -139,6 +139,7 @@ public: std::string Sendfile; // Path & Name (local os style) of file to send bool keep_alive; bool cached; // cached by mod_cache + bool outSingle; // Input CStringList ParamList; // local copy of ParamList (Request) @@ -199,7 +200,7 @@ public: int _outIndent; TOutType outType; // Outputtpe = plain (default)|xml|json - TOutType outStart(); + TOutType outStart(bool single = false); TOutType checkOutput(); std::string outIndent(); std::string outPair(std::string _key, std::string _content, bool _next);