mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-17 02:13:35 +02:00
Merge remote-tracking branch 'check/cst-next'
*needs buildfixing*
Conflicts:
src/daemonc/Makefile.am
src/daemonc/remotecontrol.cpp
src/driver/Makefile.am
src/driver/audiodec/Makefile.am
src/driver/pictureviewer/Makefile.am
src/driver/vfd.cpp
src/gui/bedit/Makefile.am
src/gui/components/Makefile.am
src/gui/luainstance.cpp
src/gui/widget/Makefile.am
src/nhttpd/tuxboxapi/coolstream/Makefile.am
src/system/Makefile.am
Origin commit data
------------------
Branch: ni/coolstream
Commit: b5a64e6887
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2015-01-26 (Mon, 26 Jan 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -73,7 +73,7 @@ CControlAPI::CControlAPI(CNeutrinoAPI *_NeutrinoAPI)
|
||||
//-----------------------------------------------------------------------------
|
||||
void CControlAPI::init(CyhookHandler *hh)
|
||||
{
|
||||
if(PLUGIN_DIRS[0] == "")
|
||||
if(PLUGIN_DIRS[0].empty())
|
||||
{ // given in nhttpd.conf
|
||||
PLUGIN_DIRS[0]=PLUGIN_DIRS[1]=hh->WebserverConfigList["WebsiteMain.override_directory"];
|
||||
PLUGIN_DIRS[1].append("/scripts");
|
||||
@@ -255,10 +255,10 @@ void CControlAPI::Execute(CyhookHandler *hh)
|
||||
}
|
||||
|
||||
// send header
|
||||
else if(std::string(yCgiCallList[index].mime_type) == "") // decide in function
|
||||
else if(std::string(yCgiCallList[index].mime_type).empty()) // decide in function
|
||||
;
|
||||
else if(std::string(yCgiCallList[index].mime_type) == "+xml") // Parameter xml?
|
||||
if ((hh->ParamList["xml"] != "") ||(hh->ParamList["format"] == "xml"))
|
||||
if ((!hh->ParamList["xml"].empty()) ||(hh->ParamList["format"] == "xml"))
|
||||
hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
|
||||
else
|
||||
hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8");
|
||||
@@ -295,7 +295,7 @@ void CControlAPI::TimerCGI(CyhookHandler *hh)
|
||||
NeutrinoAPI->Timerd->removeTimerEvent(removeId);
|
||||
hh->SendOk();
|
||||
}
|
||||
else if(hh->ParamList["get"] != "")
|
||||
else if(!hh->ParamList["get"].empty())
|
||||
{
|
||||
int pre=0,post=0;
|
||||
NeutrinoAPI->Timerd->getRecordingSafety(pre,post);
|
||||
@@ -697,11 +697,11 @@ void CControlAPI::RCEmCGI(CyhookHandler *hh) {
|
||||
#if 0
|
||||
unsigned int repeat = 1;
|
||||
unsigned int delay = 250;
|
||||
if (hh->ParamList["delay"] != "")
|
||||
if (!hh->ParamList["delay"].empty())
|
||||
delay = atoi(hh->ParamList["delay"].c_str());
|
||||
if (hh->ParamList["duration"] != "")
|
||||
if (!hh->ParamList["duration"].empty())
|
||||
repeat = atoi(hh->ParamList["duration"].c_str()) * 1000 / delay;
|
||||
if (hh->ParamList["repeat"] != "")
|
||||
if (!hh->ParamList["repeat"].empty())
|
||||
repeat = atoi(hh->ParamList["repeat"].c_str());
|
||||
#endif
|
||||
int evd = open(EVENTDEV, O_RDWR);
|
||||
@@ -797,7 +797,7 @@ void CControlAPI::VolumeCGI(CyhookHandler *hh)
|
||||
else if (hh->ParamList["1"].compare("status") == 0) { // Mute status
|
||||
(NeutrinoAPI->Zapit->getMuteStatus()) ? hh->Write("1") : hh->Write("0");
|
||||
}
|
||||
else if(hh->ParamList["1"]!="") { //set volume
|
||||
else if(!hh->ParamList["1"].empty()) { //set volume
|
||||
char vol = atol( hh->ParamList["1"].c_str() );
|
||||
NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::EVT_SET_VOLUME, CEventServer::INITID_HTTPD, (void *)&vol, sizeof(char));
|
||||
hh->SendOk();
|
||||
@@ -857,11 +857,11 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann
|
||||
}
|
||||
}
|
||||
|
||||
result += hh->outPair("isActiveChannel", (channel->channel_id == current_channel) ? "true" : "false", (firstEPG != ""));
|
||||
if(firstEPG != "") {
|
||||
result += hh->outPair("isActiveChannel", (channel->channel_id == current_channel) ? "true" : "false", (!firstEPG.empty()));
|
||||
if(!firstEPG.empty()) {
|
||||
result += hh->outCollection("firstEPG", firstEPG);
|
||||
}
|
||||
if(secondEPG != "") {
|
||||
if(!secondEPG.empty()) {
|
||||
result += hh->outNext();
|
||||
result += hh->outCollection("secondEPG", secondEPG);
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) {
|
||||
int BouquetNr = -1; // -1 = all bouquets
|
||||
int startBouquet = 0;
|
||||
int bsize = (int) g_bouquetManager->Bouquets.size();
|
||||
if (hh->ParamList["bouquet"] != "") {
|
||||
if (!hh->ParamList["bouquet"].empty()) {
|
||||
// list for given bouquet
|
||||
BouquetNr = atoi(hh->ParamList["bouquet"].c_str());
|
||||
if (BouquetNr > 0)
|
||||
@@ -1404,7 +1404,7 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat )
|
||||
hh->printf("\t\t<info2>%s</info2>\n",ZapitTools::UTF8_to_UTF8XML(epg.info2.c_str()).c_str());
|
||||
if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) {
|
||||
hh->printf("\t\t<fsk>%u</fsk>\n", longepg.fsk);
|
||||
if (longepg.contentClassification.length()> 0){
|
||||
if (!longepg.contentClassification.empty()){
|
||||
genere = GetGenre(longepg.contentClassification[0]);
|
||||
genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str());
|
||||
hh->printf("\t\t<genre>%s</genre>\n", genere.c_str());
|
||||
@@ -1438,7 +1438,7 @@ void CControlAPI::EpgSearchCGI(CyhookHandler *hh, bool xml_forat )
|
||||
hh->WriteLn(epg.info2);
|
||||
if (CEitManager::getInstance()->getEPGid(eventIterator->eventID, eventIterator->startTime, &longepg)) {
|
||||
hh->printf("fsk:%u\n", longepg.fsk);
|
||||
if (longepg.contentClassification.length()> 0){
|
||||
if (!longepg.contentClassification.empty()){
|
||||
genere = GetGenre(longepg.contentClassification[0]);
|
||||
genere = ZapitTools::UTF8_to_UTF8XML(genere.c_str());
|
||||
hh->WriteLn(genere);
|
||||
@@ -1507,7 +1507,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
}
|
||||
}
|
||||
// query details for given eventid
|
||||
else if (hh->ParamList["eventid"] != "") {
|
||||
else if (!hh->ParamList["eventid"].empty()) {
|
||||
//special epg query
|
||||
uint64_t epgid = 0;
|
||||
sscanf(hh->ParamList["eventid"].c_str(), "%" SCNu64 "", &epgid);
|
||||
@@ -1518,8 +1518,8 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
|
||||
hh->WriteLn(epg.info2);
|
||||
}
|
||||
}
|
||||
else if (hh->ParamList["eventid2fsk"] != "") {
|
||||
if (hh->ParamList["starttime"] != "") {
|
||||
else if (!hh->ParamList["eventid2fsk"].empty()) {
|
||||
if (!hh->ParamList["starttime"].empty()) {
|
||||
uint64_t epgid = 0;
|
||||
time_t starttime = 0;
|
||||
sscanf(hh->ParamList["fskid"].c_str(), "%" SCNu64 "", &epgid);
|
||||
@@ -1586,7 +1586,7 @@ void CControlAPI::ScreenshotCGI(CyhookHandler *hh)
|
||||
enableOSD = false;
|
||||
if(hh->ParamList["video"] == "0")
|
||||
enableVideo = false;
|
||||
if(hh->ParamList["name"] != "")
|
||||
if(!hh->ParamList["name"].empty())
|
||||
filename = hh->ParamList["name"];
|
||||
|
||||
CScreenShot * sc = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/);
|
||||
@@ -1686,7 +1686,7 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh)
|
||||
else
|
||||
hh->SendError();
|
||||
}
|
||||
else if (hh->ParamList["name"] != "")
|
||||
else if (!hh->ParamList["name"].empty())
|
||||
{
|
||||
t_channel_id channel_id;
|
||||
channel_id = NeutrinoAPI->ChannelNameToChannelId(hh->ParamList["name"]);
|
||||
@@ -1716,7 +1716,7 @@ void CControlAPI::StartPluginCGI(CyhookHandler *hh)
|
||||
std::string pluginname;
|
||||
if (!(hh->ParamList.empty()))
|
||||
{
|
||||
if (hh->ParamList["name"] != "")
|
||||
if (!hh->ParamList["name"].empty())
|
||||
{
|
||||
pluginname = hh->ParamList["name"];
|
||||
//pluginname=decodeString(pluginname);
|
||||
@@ -2212,7 +2212,7 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
|
||||
void CControlAPI::YWebCGI(CyhookHandler *hh)
|
||||
{
|
||||
bool status=true;
|
||||
if (hh->ParamList["video_stream_pids"] != "")
|
||||
if (!hh->ParamList["video_stream_pids"].empty())
|
||||
{
|
||||
int para=0;
|
||||
sscanf( hh->ParamList["video_stream_pids"].c_str(), "%d", ¶);
|
||||
@@ -2239,7 +2239,7 @@ void CControlAPI::YWeb_SendVideoStreamingPids(CyhookHandler *hh, int apid_no)
|
||||
apid_idx=apid_no;
|
||||
if(!pids.APIDs.empty())
|
||||
apid = pids.APIDs[apid_idx].pid;
|
||||
if(hh->ParamList["no_commas"] != "")
|
||||
if(!hh->ParamList["no_commas"].empty())
|
||||
{
|
||||
hh->printf("0x%04x 0x%04x 0x%04x",pids.PIDs.pmtpid,pids.PIDs.vpid,apid);
|
||||
if (pids.PIDs.pcrpid != pids.PIDs.vpid)
|
||||
@@ -2337,17 +2337,17 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
int alHour=0;
|
||||
|
||||
// if alarm given then in parameters im time_t format
|
||||
if(hh->ParamList["alarm"] != "")
|
||||
if(!hh->ParamList["alarm"].empty())
|
||||
{
|
||||
alarmTimeT = atoi(hh->ParamList["alarm"].c_str());
|
||||
if(hh->ParamList["stop"] != "")
|
||||
if(!hh->ParamList["stop"].empty())
|
||||
stopTimeT = atoi(hh->ParamList["stop"].c_str());
|
||||
if(hh->ParamList["announce"] != "")
|
||||
if(!hh->ParamList["announce"].empty())
|
||||
announceTimeT = atoi(hh->ParamList["announce"].c_str());
|
||||
else
|
||||
announceTimeT = alarmTimeT;
|
||||
}
|
||||
else if(hh->ParamList["alDate"] != "") //given formatted
|
||||
else if(!hh->ParamList["alDate"].empty()) //given formatted
|
||||
{
|
||||
// Alarm Date - Format exact! DD.MM.YYYY
|
||||
tnull = time(NULL);
|
||||
@@ -2360,7 +2360,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
}
|
||||
|
||||
// Alarm Time - Format exact! HH:MM
|
||||
if(hh->ParamList["alTime"] != "")
|
||||
if(!hh->ParamList["alTime"].empty())
|
||||
sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d",&(alarmTime->tm_hour), &(alarmTime->tm_min));
|
||||
alHour = alarmTime->tm_hour;
|
||||
correctTime(alarmTime);
|
||||
@@ -2369,11 +2369,11 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
struct tm *stopTime = localtime(&alarmTimeT);
|
||||
stopTime->tm_sec = 0;
|
||||
// Stop Time - Format exact! HH:MM
|
||||
if(hh->ParamList["stTime"] != "")
|
||||
if(!hh->ParamList["stTime"].empty())
|
||||
sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d",&(stopTime->tm_hour), &(stopTime->tm_min));
|
||||
|
||||
// Stop Date - Format exact! DD.MM.YYYY
|
||||
if(hh->ParamList["stDate"] != "")
|
||||
if(!hh->ParamList["stDate"].empty())
|
||||
if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d",&(stopTime->tm_mday), &(stopTime->tm_mon), &(stopTime->tm_year)) == 3)
|
||||
{
|
||||
stopTime->tm_mon -= 1;
|
||||
@@ -2381,7 +2381,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
}
|
||||
correctTime(stopTime);
|
||||
stopTimeT = mktime(stopTime);
|
||||
if(hh->ParamList["stDate"] == "" && alHour > stopTime->tm_hour)
|
||||
if(hh->ParamList["stDate"].empty() && alHour > stopTime->tm_hour)
|
||||
stopTimeT += 24* 60 * 60; // add 1 Day
|
||||
}
|
||||
else // alarm/stop time given in pieces
|
||||
@@ -2389,15 +2389,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
// alarm time
|
||||
time_t now = time(NULL);
|
||||
struct tm *alarmTime=localtime(&now);
|
||||
if(hh->ParamList["ad"] != "")
|
||||
if(!hh->ParamList["ad"].empty())
|
||||
alarmTime->tm_mday = atoi(hh->ParamList["ad"].c_str());
|
||||
if(hh->ParamList["amo"] != "")
|
||||
if(!hh->ParamList["amo"].empty())
|
||||
alarmTime->tm_mon = atoi(hh->ParamList["amo"].c_str())-1;
|
||||
if(hh->ParamList["ay"] != "")
|
||||
if(!hh->ParamList["ay"].empty())
|
||||
alarmTime->tm_year = atoi(hh->ParamList["ay"].c_str())-1900;
|
||||
if(hh->ParamList["ah"] != "")
|
||||
if(!hh->ParamList["ah"].empty())
|
||||
alarmTime->tm_hour = atoi(hh->ParamList["ah"].c_str());
|
||||
if(hh->ParamList["ami"] != "")
|
||||
if(!hh->ParamList["ami"].empty())
|
||||
alarmTime->tm_min = atoi(hh->ParamList["ami"].c_str());
|
||||
alarmTime->tm_sec = 0;
|
||||
correctTime(alarmTime);
|
||||
@@ -2406,15 +2406,15 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
|
||||
// stop time
|
||||
struct tm *stopTime = alarmTime;
|
||||
if(hh->ParamList["sd"] != "")
|
||||
if(!hh->ParamList["sd"].empty())
|
||||
stopTime->tm_mday = atoi(hh->ParamList["sd"].c_str());
|
||||
if(hh->ParamList["smo"] != "")
|
||||
if(!hh->ParamList["smo"].empty())
|
||||
stopTime->tm_mon = atoi(hh->ParamList["smo"].c_str())-1;
|
||||
if(hh->ParamList["sy"] != "")
|
||||
if(!hh->ParamList["sy"].empty())
|
||||
stopTime->tm_year = atoi(hh->ParamList["sy"].c_str())-1900;
|
||||
if(hh->ParamList["sh"] != "")
|
||||
if(!hh->ParamList["sh"].empty())
|
||||
stopTime->tm_hour = atoi(hh->ParamList["sh"].c_str());
|
||||
if(hh->ParamList["smi"] != "")
|
||||
if(!hh->ParamList["smi"].empty())
|
||||
stopTime->tm_min = atoi(hh->ParamList["smi"].c_str());
|
||||
stopTime->tm_sec = 0;
|
||||
correctTime(stopTime);
|
||||
@@ -2425,22 +2425,22 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
announceTimeT -= 60;
|
||||
|
||||
CTimerd::CTimerEventTypes type;
|
||||
if(hh->ParamList["type"] != "")
|
||||
if(!hh->ParamList["type"].empty())
|
||||
type = (CTimerd::CTimerEventTypes) atoi(hh->ParamList["type"].c_str());
|
||||
else // default is: record
|
||||
type = CTimerd::TIMER_RECORD;
|
||||
|
||||
// repeat
|
||||
if(hh->ParamList["repcount"] != "")
|
||||
if(!hh->ParamList["repcount"].empty())
|
||||
{
|
||||
repCount = atoi(hh->ParamList["repcount"].c_str());
|
||||
}
|
||||
CTimerd::CTimerEventRepeat rep;
|
||||
if(hh->ParamList["rep"] != "")
|
||||
if(!hh->ParamList["rep"].empty())
|
||||
rep = (CTimerd::CTimerEventRepeat) atoi(hh->ParamList["rep"].c_str());
|
||||
else // default: no repeat
|
||||
rep = (CTimerd::CTimerEventRepeat)0;
|
||||
if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && hh->ParamList["wd"] != "")
|
||||
if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && !hh->ParamList["wd"].empty())
|
||||
NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"]);
|
||||
|
||||
// apids
|
||||
@@ -2478,7 +2478,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
eventinfo.recordingSafety = (hh->ParamList["rs"] == "1");
|
||||
|
||||
// channel by Id or name
|
||||
if(hh->ParamList["channel_id"] != "")
|
||||
if(!hh->ParamList["channel_id"].empty())
|
||||
sscanf(hh->ParamList["channel_id"].c_str(),
|
||||
SCANF_CHANNEL_ID_TYPE,
|
||||
&eventinfo.channel_id);
|
||||
@@ -2499,7 +2499,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
data= &eventinfo;
|
||||
else if (type==CTimerd::TIMER_RECORD)
|
||||
{
|
||||
if(_rec_dir == "")
|
||||
if(_rec_dir.empty())
|
||||
{
|
||||
// get Default Recordingdir
|
||||
CConfigFile *Config = new CConfigFile(',');
|
||||
@@ -2530,7 +2530,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
// update or add timer
|
||||
if(hh->ParamList["update"]=="1")
|
||||
{
|
||||
if(hh->ParamList["id"] != "")
|
||||
if(!hh->ParamList["id"].empty())
|
||||
{
|
||||
unsigned modyId = atoi(hh->ParamList["id"].c_str());
|
||||
if(type == CTimerd::TIMER_RECORD)
|
||||
@@ -2574,7 +2574,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
|
||||
//-------------------------------------------------------------------------
|
||||
void CControlAPI::setBouquetCGI(CyhookHandler *hh)
|
||||
{
|
||||
if (hh->ParamList["selected"] != "") {
|
||||
if (!hh->ParamList["selected"].empty()) {
|
||||
int selected = atoi(hh->ParamList["selected"].c_str());
|
||||
if(hh->ParamList["action"].compare("hide") == 0)
|
||||
NeutrinoAPI->Zapit->setBouquetHidden(selected - 1,true);
|
||||
@@ -2599,7 +2599,7 @@ void CControlAPI::saveBouquetCGI(CyhookHandler *hh)
|
||||
//-------------------------------------------------------------------------
|
||||
void CControlAPI::moveBouquetCGI(CyhookHandler *hh)
|
||||
{
|
||||
if (hh->ParamList["selected"] != "" && (
|
||||
if (!hh->ParamList["selected"].empty() && (
|
||||
hh->ParamList["action"] == "up" ||
|
||||
hh->ParamList["action"] == "down"))
|
||||
{
|
||||
@@ -2619,7 +2619,7 @@ void CControlAPI::moveBouquetCGI(CyhookHandler *hh)
|
||||
//-------------------------------------------------------------------------
|
||||
void CControlAPI::deleteBouquetCGI(CyhookHandler *hh)
|
||||
{
|
||||
if (hh->ParamList["selected"] != "") {
|
||||
if (!hh->ParamList["selected"].empty()) {
|
||||
int selected = atoi(hh->ParamList["selected"].c_str());
|
||||
NeutrinoAPI->Zapit->deleteBouquet(selected - 1);
|
||||
hh->SendOk();
|
||||
@@ -2645,9 +2645,9 @@ void CControlAPI::addBouquetCGI(CyhookHandler *hh)
|
||||
//-------------------------------------------------------------------------
|
||||
void CControlAPI::renameBouquetCGI(CyhookHandler *hh)
|
||||
{
|
||||
if (hh->ParamList["selected"] != "")
|
||||
if (!hh->ParamList["selected"].empty())
|
||||
{
|
||||
if (hh->ParamList["nameto"] != "")
|
||||
if (!hh->ParamList["nameto"].empty())
|
||||
{
|
||||
if (NeutrinoAPI->Zapit->existsBouquet((hh->ParamList["nameto"]).c_str()) == -1)
|
||||
{
|
||||
@@ -2688,7 +2688,7 @@ void CControlAPI::changeBouquetCGI(CyhookHandler *hh)
|
||||
|
||||
NeutrinoAPI->Zapit->renumChannellist();
|
||||
NeutrinoAPI->UpdateBouquets();
|
||||
if(hh->ParamList["redirect"] != "")
|
||||
if(!hh->ParamList["redirect"].empty())
|
||||
hh->SendRewrite(hh->ParamList["redirect"]);
|
||||
else
|
||||
hh->SendOk();
|
||||
@@ -2716,7 +2716,7 @@ void CControlAPI::build_live_url(CyhookHandler *hh)
|
||||
int apid=0,apid_no=0,apid_idx=0;
|
||||
pids.PIDs.vpid=0;
|
||||
|
||||
if(hh->ParamList["audio_no"] !="")
|
||||
if(!hh->ParamList["audio_no"].empty())
|
||||
apid_no = atoi(hh->ParamList["audio_no"].c_str());
|
||||
NeutrinoAPI->Zapit->getPIDS(pids);
|
||||
|
||||
@@ -2744,7 +2744,7 @@ void CControlAPI::build_live_url(CyhookHandler *hh)
|
||||
hh->SendError();
|
||||
// build url
|
||||
std::string url = "";
|
||||
if(hh->ParamList["host"] !="")
|
||||
if(!hh->ParamList["host"].empty())
|
||||
url = "http://"+hh->ParamList["host"];
|
||||
else
|
||||
url = "http://"+hh->HeaderList["Host"];
|
||||
@@ -2757,7 +2757,7 @@ void CControlAPI::build_live_url(CyhookHandler *hh)
|
||||
url += xpids;
|
||||
|
||||
// response url
|
||||
if(hh->ParamList["vlc_link"] !="")
|
||||
if(!hh->ParamList["vlc_link"].empty())
|
||||
{
|
||||
write_to_file("/tmp/vlc.m3u", url);
|
||||
hh->SendRedirect("/tmp/vlc.m3u");
|
||||
@@ -2849,7 +2849,7 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh) {
|
||||
else if (configFileName == "yweb")
|
||||
config_filename = YWEB_CONFIGFILE;
|
||||
|
||||
if (config_filename != "") {
|
||||
if (!config_filename.empty()) {
|
||||
Config->loadConfig(config_filename);
|
||||
|
||||
if (load) { // get and output list
|
||||
@@ -2879,19 +2879,19 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh) {
|
||||
Config->setString(key, it->second);
|
||||
}
|
||||
}
|
||||
if (config_filename != "")
|
||||
if (!config_filename.empty())
|
||||
Config->saveConfig(config_filename);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(configFileName != "")
|
||||
if(!configFileName.empty())
|
||||
error = string_printf("no config defined for: %s", (hh->ParamList["config"]).c_str());
|
||||
else
|
||||
error = "no config given";
|
||||
}
|
||||
|
||||
// write footer
|
||||
if (error == "") {
|
||||
if (error.empty()) {
|
||||
if (outType == json) {
|
||||
hh->WriteLn(json_out_success(result));
|
||||
}
|
||||
|
@@ -171,7 +171,7 @@ std::string CNeutrinoYParser::func_mount_get_list(CyhookHandler *, std::string)
|
||||
yip = Config->getString("network_nfs_ip_"+ynr,"");
|
||||
ydir = Config->getString("network_nfs_dir_"+ynr,"");
|
||||
ylocal_dir = Config->getString("network_nfs_local_dir_"+ynr,"");
|
||||
if(ydir != "")
|
||||
if(!ydir.empty())
|
||||
ydir="("+ydir+")";
|
||||
|
||||
yresult += string_printf("<input type='radio' name='R1' value='%d' %s />%d %s - %s %s %s<br/>",
|
||||
@@ -215,7 +215,7 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, st
|
||||
int nr=1;
|
||||
|
||||
ySplitString(para," ",nr_str, do_show_hidden);
|
||||
if(nr_str != "")
|
||||
if(!nr_str.empty())
|
||||
nr = atoi(nr_str.c_str());
|
||||
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
@@ -286,7 +286,7 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, st
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
|
||||
ySplitString(para," ",abouquet, achannel_id);
|
||||
if(abouquet != "")
|
||||
if(!abouquet.empty())
|
||||
bnumber = atoi(abouquet.c_str());
|
||||
if(bnumber > 0) {
|
||||
bnumber--;
|
||||
@@ -323,7 +323,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
||||
int mode = NeutrinoAPI->Zapit->getMode();
|
||||
|
||||
ySplitString(para," ",abnumber, tmp);
|
||||
if(abnumber != "")
|
||||
if(!abnumber.empty())
|
||||
BouquetNr = atoi(abnumber.c_str());
|
||||
if (BouquetNr > 0) {
|
||||
BouquetNr--;
|
||||
@@ -351,7 +351,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
||||
std::string timestr;
|
||||
bool have_logos = false;
|
||||
|
||||
if(hh->WebserverConfigList["Tuxbox.LogosURL"] != "")
|
||||
if(!hh->WebserverConfigList["Tuxbox.LogosURL"].empty())
|
||||
have_logos = true;
|
||||
for(int j = 0; j < (int) channels.size(); j++)
|
||||
{
|
||||
@@ -526,7 +526,7 @@ std::string CNeutrinoYParser::func_get_video_pids(CyhookHandler *, std::string
|
||||
int apid=0,apid_no=0,apid_idx=0;
|
||||
pids.PIDs.vpid=0;
|
||||
|
||||
if(para != "")
|
||||
if(!para.empty())
|
||||
apid_no = atoi(para.c_str());
|
||||
NeutrinoAPI->Zapit->getPIDS(pids);
|
||||
|
||||
@@ -714,7 +714,7 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler *, std::str
|
||||
in >> ymtd >> dummy >> dummy; //format: mtd# start end "name "
|
||||
in.getline(ytmp, 200); // Rest of line is the mtd description
|
||||
yname = ytmp;
|
||||
if((j>0) && (ymtd != ""))// iggnore first line
|
||||
if((j>0) && (!ymtd.empty()))// iggnore first line
|
||||
{
|
||||
ysel = ((j==1) ? "checked=\"checked\"" : "");
|
||||
yresult += string_printf("<input type='radio' name='R1' value='%d' %s title='%s' />%d %s<br/>",
|
||||
@@ -976,7 +976,7 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
|
||||
if(cmd != "new")
|
||||
{
|
||||
// init timerid
|
||||
if(stimerid != "")
|
||||
if(!stimerid.empty())
|
||||
timerId = (unsigned)atoi(stimerid.c_str());
|
||||
|
||||
NeutrinoAPI->Timerd->getTimer(timer, timerId);
|
||||
@@ -1119,7 +1119,7 @@ std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std::
|
||||
if (hh->ParamList["saved"] == "1")
|
||||
hh->ParamList["have_saved"]="true";
|
||||
|
||||
if (hh->ParamList["selected"] != "")
|
||||
if (!hh->ParamList["selected"].empty())
|
||||
selected = atoi(hh->ParamList["selected"].c_str());
|
||||
|
||||
int bouquetSize = (int) g_bouquetManager->Bouquets.size();
|
||||
|
@@ -62,7 +62,7 @@
|
||||
//#define Y_CONFIG_FEATURE_CHROOT y // Add Feature: Use Change Root for Security
|
||||
//#define Y_CONFIG_FEATURE_HTTPD_USER y // Add Feature: Set User for yhttpd-Process
|
||||
#define Y_CONFIG_BUILD_AS_DAEMON y // Build as a Daemon
|
||||
#define Y_CONFIG_FEATURE_THREADING y // Build with possibility for multi threading
|
||||
//#define Y_CONFIG_FEATURE_THREADING y // Build with possibility for multi threading
|
||||
//-----------------------------------------------------------------------------
|
||||
// Define/Undefine Features forced by CONFIG_SYSTEM_xxx
|
||||
// Dependencies
|
||||
|
@@ -275,7 +275,7 @@ bool Cyhttpd::Configure() {
|
||||
std::string groupname= ConfigList["server.group_name"];
|
||||
|
||||
// get user data
|
||||
if(username != "")
|
||||
if(!username.empty())
|
||||
{
|
||||
if((pwd = getpwnam(username.c_str())) == NULL)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ bool Cyhttpd::Configure() {
|
||||
}
|
||||
}
|
||||
// get group data
|
||||
if(groupname != "")
|
||||
if(!groupname.empty())
|
||||
{
|
||||
if((grp = getgrnam(groupname.c_str())) == NULL)
|
||||
{
|
||||
@@ -313,7 +313,7 @@ bool Cyhttpd::Configure() {
|
||||
}
|
||||
#endif
|
||||
#ifdef Y_CONFIG_FEATURE_HTTPD_USER
|
||||
if(username != "" && pwd != NULL && grp != NULL)
|
||||
if(!username.empty() && pwd != NULL && grp != NULL)
|
||||
{
|
||||
log_level_printf(2, "set user and groups\n");
|
||||
|
||||
@@ -321,7 +321,7 @@ bool Cyhttpd::Configure() {
|
||||
setgid(grp->gr_gid);
|
||||
setgroups(0, NULL);
|
||||
// set user group
|
||||
if(groupname != "")
|
||||
if(!groupname.empty())
|
||||
initgroups(username.c_str(), grp->gr_gid);
|
||||
// set user
|
||||
if(setuid(pwd->pw_uid) == -1)
|
||||
@@ -481,7 +481,7 @@ void Cyhttpd::ReadConfig(void) {
|
||||
HTTPD_STANDARD_PORT));
|
||||
Config->setString("WebsiteMain.directory", OrgConfig.getString(
|
||||
"PrivatDocRoot", PRIVATEDOCUMENTROOT));
|
||||
if (OrgConfig.getString("PublicDocRoot", "") != "")
|
||||
if (!OrgConfig.getString("PublicDocRoot", "").empty())
|
||||
Config->setString("WebsiteMain.override_directory",
|
||||
OrgConfig.getString("PublicDocRoot",
|
||||
PRIVATEDOCUMENTROOT));
|
||||
@@ -512,7 +512,7 @@ void Cyhttpd::ReadConfig(void) {
|
||||
Config->setInt32("configfile.version", CONF_VERSION);
|
||||
Config->setString("Language.selected", HTTPD_DEFAULT_LANGUAGE);
|
||||
Config->setString("Language.directory", HTTPD_LANGUAGEDIR);
|
||||
if (Config->getString("WebsiteMain.hosted_directory", "") == "")
|
||||
if (Config->getString("WebsiteMain.hosted_directory", "").empty())
|
||||
Config->setString("WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
|
||||
Config->saveConfig(HTTPD_CONFIGFILE);
|
||||
}
|
||||
@@ -549,7 +549,7 @@ void Cyhttpd::ReadConfig(void) {
|
||||
"WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
|
||||
|
||||
// Check location of logos
|
||||
if (Config->getString("Tuxbox.LogosURL", "") == "") {
|
||||
if (Config->getString("Tuxbox.LogosURL", "").empty()) {
|
||||
if (access(ConfigList["WebsiteMain.override_directory"] + "/logos", R_OK) == 0) {
|
||||
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.override_directory"] + "/logos");
|
||||
have_config = false; //save config
|
||||
|
@@ -99,9 +99,9 @@ void CLanguage::setLanguage(std::string _language){
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string CLanguage::getTranslation(std::string id){
|
||||
std::string trans=ConfigLanguage->getString(id,"");
|
||||
if(trans=="")
|
||||
if(trans.empty())
|
||||
trans=NeutrinoLanguage->getString(id,"");
|
||||
if(trans=="")
|
||||
if(trans.empty())
|
||||
trans=DefaultLanguage->getString(id,"");
|
||||
return trans;
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ bool CWebserverRequest::HandleRequest(void) {
|
||||
start_line = Connection->sock->ReceiveLine();
|
||||
if (!Connection->sock->isValid)
|
||||
return false;
|
||||
if (start_line == "") // Socket empty
|
||||
if (start_line.empty()) // Socket empty
|
||||
{
|
||||
log_level_printf(1, "HandleRequest: End of line not found\n");
|
||||
Connection->Response.SendError(HTTP_INTERNAL_SERVER_ERROR);
|
||||
@@ -82,7 +82,7 @@ bool CWebserverRequest::HandleRequest(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tmp_line == "") {
|
||||
if (tmp_line.empty()) {
|
||||
Connection->Response.SendError(HTTP_INTERNAL_SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ bool CWebserverRequest::HandlePost() {
|
||||
std::string raw_header = "", tmp_line = "";
|
||||
do {
|
||||
tmp_line = Connection->sock->ReceiveLine();
|
||||
if (tmp_line == "") // Socket empty
|
||||
if (tmp_line.empty()) // Socket empty
|
||||
{
|
||||
log_level_printf(1,
|
||||
"HandleRequest: (Header) End of line not found: %s\n",
|
||||
@@ -266,7 +266,7 @@ bool CWebserverRequest::HandlePost() {
|
||||
|
||||
// read meesage body
|
||||
unsigned int content_len = 0;
|
||||
if (HeaderList["Content-Length"] != "")
|
||||
if (!HeaderList["Content-Length"].empty())
|
||||
content_len = atoi(HeaderList["Content-Length"].c_str());
|
||||
|
||||
// Get Rest of Request from Socket
|
||||
@@ -534,7 +534,7 @@ unsigned int CWebserverRequest::HandlePostBoundary(std::string boundary,
|
||||
}
|
||||
log_level_printf(2,"<POST Boundary> read file (already:%d all:%d)\n", _readbytes, content_len);
|
||||
}
|
||||
while((_readbytes < content_len) && (tmp_line.length() != 0));
|
||||
while((_readbytes < content_len) && (!tmp_line.empty()));
|
||||
content_len -= _readbytes;
|
||||
close(fd);
|
||||
log_level_printf(2,"<POST Boundary> read file End\n");
|
||||
|
@@ -116,12 +116,12 @@ bool CySocket::initSSL(void)
|
||||
aprintf("ySocket:SSL Error: Create SSL_CTX_new : %s\n", ERR_error_string(ERR_get_error(), NULL) );
|
||||
return false;
|
||||
}
|
||||
if(SSL_pemfile == "")
|
||||
if(SSL_pemfile.empty())
|
||||
{
|
||||
aprintf("ySocket:SSL Error: no pemfile given\n");
|
||||
return false;
|
||||
}
|
||||
if(SSL_CA_file != "") // have a CA?
|
||||
if(!SSL_CA_file.empty()) // have a CA?
|
||||
if(1 != SSL_CTX_load_verify_locations(SSL_ctx, SSL_CA_file.c_str(), NULL))
|
||||
{
|
||||
aprintf("ySocket:SSL Error: %s CA-File:%s\n",ERR_error_string(ERR_get_error(), NULL), SSL_CA_file.c_str());
|
||||
|
@@ -413,6 +413,10 @@ bool CWebserver::handle_connection(CySocket *newSock) {
|
||||
|
||||
// create arguments
|
||||
TWebserverConnectionArgs *newConn = new TWebserverConnectionArgs;
|
||||
if (!newConn) {
|
||||
dperror("CWebserver TWebserverConnectionArgs error!\n");
|
||||
return false;
|
||||
}
|
||||
newConn->ySock = newSock;
|
||||
newConn->ySock->handling = true;
|
||||
newConn->WebserverBackref = this;
|
||||
@@ -457,24 +461,29 @@ bool CWebserver::handle_connection(CySocket *newSock) {
|
||||
// Webserver-Thread for each connection
|
||||
//-------------------------------------------------------------------------
|
||||
void *WebThread(void *args) {
|
||||
CWebserverConnection *con;
|
||||
CWebserver *ws;
|
||||
TWebserverConnectionArgs *newConn = (TWebserverConnectionArgs *) args;
|
||||
ws = newConn->WebserverBackref;
|
||||
if (!newConn) {
|
||||
dperror("WebThread called without arguments!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool is_threaded = newConn->is_treaded;
|
||||
if (is_threaded)
|
||||
log_level_printf(1, "++ Thread 0x06%X gestartet\n",
|
||||
(int) pthread_self());
|
||||
|
||||
if (!newConn) {
|
||||
dperror("WebThread called without arguments!\n");
|
||||
if (newConn->is_treaded)
|
||||
pthread_exit( NULL);
|
||||
}
|
||||
log_level_printf(1, "++ Thread 0x06%X gestartet\n", (int) pthread_self());
|
||||
|
||||
// (1) create & init Connection
|
||||
con = new CWebserverConnection(ws);
|
||||
CWebserver *ws = newConn->WebserverBackref;
|
||||
if (!ws) {
|
||||
dperror("WebThread CWebserver error!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CWebserverConnection *con = new CWebserverConnection(ws);
|
||||
if (!con) {
|
||||
dperror("WebThread CWebserverConnection error!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
con->Request.UrlData["clientaddr"] = newConn->ySock->get_client_ip(); // TODO:here?
|
||||
con->sock = newConn->ySock; // give socket reference
|
||||
newConn->ySock->handling = true; // dont handle this socket now be webserver main loop
|
||||
@@ -485,9 +494,9 @@ void *WebThread(void *args) {
|
||||
// (3) end connection handling
|
||||
#ifdef Y_CONFIG_FEATURE_KEEP_ALIVE
|
||||
if(!con->keep_alive)
|
||||
log_level_printf(2,"FD SHOULD CLOSE sock:%d!!!\n",con->sock->get_socket());
|
||||
log_level_printf(2,"FD SHOULD CLOSE sock:%d!!!\n",con->sock->get_socket());
|
||||
else
|
||||
ws->addSocketToMasterSet(con->sock->get_socket()); // add to master set
|
||||
ws->addSocketToMasterSet(con->sock->get_socket()); // add to master set
|
||||
#else
|
||||
delete newConn->ySock;
|
||||
#endif
|
||||
|
@@ -17,7 +17,7 @@ THandleStatus CmAuth::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
// dont check local calls or calls from NoAuthClient
|
||||
if (authenticate) {
|
||||
if ((hh->UrlData["clientaddr"]).find(IADDR_LOCAL) > 0
|
||||
&& (no_auth_client == "" || (hh->UrlData["clientaddr"]).compare(no_auth_client) != 0))
|
||||
&& (no_auth_client.empty() || (hh->UrlData["clientaddr"]).compare(no_auth_client) != 0))
|
||||
{
|
||||
if (!CheckAuth(hh)) {
|
||||
hh->SetError(HTTP_UNAUTHORIZED);
|
||||
@@ -50,7 +50,7 @@ THandleStatus CmAuth::Hook_ReadConfig(CConfigFile *Config,
|
||||
// check if given username an pssword are valid
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CmAuth::CheckAuth(CyhookHandler *hh) {
|
||||
if (hh->HeaderList["Authorization"] == "")
|
||||
if (hh->HeaderList["Authorization"].empty())
|
||||
return false;
|
||||
std::string encodet = hh->HeaderList["Authorization"].substr(6,
|
||||
hh->HeaderList["Authorization"].length() - 6);
|
||||
|
@@ -38,7 +38,7 @@ THandleStatus CmodCache::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
|
||||
// Check if modified
|
||||
time_t if_modified_since = (time_t) - 1;
|
||||
if (hh->HeaderList["If-Modified-Since"] != "") // Have If-Modified-Since Requested by Browser?
|
||||
if (!hh->HeaderList["If-Modified-Since"].empty()) // Have If-Modified-Since Requested by Browser?
|
||||
{
|
||||
struct tm mod;
|
||||
if (strptime(hh->HeaderList["If-Modified-Since"].c_str(),
|
||||
@@ -227,11 +227,11 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh) {
|
||||
//-------------------------------------------------------------------------
|
||||
void CmodCache::yCacheClear(CyhookHandler *hh) {
|
||||
std::string result = "";
|
||||
if (hh->ParamList["category"] != "") {
|
||||
if (!hh->ParamList["category"].empty()) {
|
||||
RemoveCategoryFromCache(hh->ParamList["category"]);
|
||||
result = string_printf("Category (%s) removed from cache.</br>",
|
||||
hh->ParamList["category"].c_str());
|
||||
} else if (hh->ParamList["url"] != "") {
|
||||
} else if (!hh->ParamList["url"].empty()) {
|
||||
RemoveURLFromCache(hh->ParamList["url"]);
|
||||
result = string_printf("URL (%s) removed from cache.</br>",
|
||||
hh->ParamList["url"].c_str());
|
||||
|
@@ -76,7 +76,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
#endif //Y_CONFIG_USE_HOSTEDWEB
|
||||
|
||||
std::string mime = sendfileTypes[hh->UrlData["fileext"]];
|
||||
if (((mime != "") || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true"))
|
||||
if (((!mime.empty()) || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true"))
|
||||
&& !(hh->UrlData["fileext"] == "yhtm" || hh->UrlData["fileext"] == "yjs" || hh->UrlData["fileext"] == "ysh")) {
|
||||
//TODO: Check allowed directories / actually in GetFileName
|
||||
// build filename
|
||||
@@ -98,7 +98,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
|
||||
// check If-Modified-Since
|
||||
time_t if_modified_since = (time_t) - 1;
|
||||
if (hh->HeaderList["If-Modified-Since"] != "") {
|
||||
if (!hh->HeaderList["If-Modified-Since"].empty()) {
|
||||
struct tm mod;
|
||||
if (strptime(hh->HeaderList["If-Modified-Since"].c_str(),
|
||||
RFC1123FMT, &mod) != NULL) {
|
||||
@@ -117,7 +117,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
|
||||
if (modified) {
|
||||
hh->RangeStart = 0;
|
||||
hh->RangeEnd = hh->ContentLength - 1;
|
||||
const char *range = (hh->HeaderList["Range"] == "") ? NULL : hh->HeaderList["Range"].c_str();
|
||||
const char *range = (hh->HeaderList["Range"].empty()) ? NULL : hh->HeaderList["Range"].c_str();
|
||||
if ((range &&
|
||||
(2 != sscanf(range, "bytes=%" PRId64 "-%" PRId64, &hh->RangeStart, &hh->RangeEnd)) &&
|
||||
(1 != sscanf(range, "bytes=%" PRId64 "-", &hh->RangeStart)))
|
||||
@@ -203,7 +203,7 @@ std::string CmodSendfile::GetFileName(CyhookHandler *hh, std::string path, std::
|
||||
//-----------------------------------------------------------------------------
|
||||
int CmodSendfile::OpenFile(CyhookHandler *, std::string fullfilename) {
|
||||
int fd = -1;
|
||||
if (fullfilename.length() > 0) {
|
||||
if (!fullfilename.empty()) {
|
||||
fd = open(fullfilename.c_str(), O_RDONLY | O_LARGEFILE);
|
||||
if (fd <= 0) {
|
||||
aprintf("cannot open file %s: ", fullfilename.c_str());
|
||||
|
@@ -63,7 +63,7 @@ THandleStatus CmWebLog::Hook_ReadConfig(CConfigFile *Config, CStringList &) {
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CmWebLog::OpenLogFile() {
|
||||
if (WebLogFilename == "")
|
||||
if (WebLogFilename.empty())
|
||||
return false;
|
||||
if (WebLogFile == NULL) {
|
||||
bool isNew = false;
|
||||
|
@@ -54,7 +54,7 @@ CyParser::~CyParser(void) {
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void CyParser::init(CyhookHandler *hh) {
|
||||
if (HTML_DIRS[0] == "") {
|
||||
if (HTML_DIRS[0].empty()) {
|
||||
CyParser::HTML_DIRS[0] = hh->WebserverConfigList["WebsiteMain.override_directory"];
|
||||
HTML_DIRS[1] = hh->WebserverConfigList["WebsiteMain.directory"];
|
||||
PLUGIN_DIRS[0]=PLUGIN_DIRS[1] = HTML_DIRS[0];
|
||||
@@ -133,10 +133,10 @@ void CyParser::Execute(CyhookHandler *hh) {
|
||||
}
|
||||
|
||||
// send header
|
||||
if (std::string(yCgiCallList[index].mime_type) == "") // set by self
|
||||
if (std::string(yCgiCallList[index].mime_type).empty()) // set by self
|
||||
;
|
||||
else if (std::string(yCgiCallList[index].mime_type) == "+xml") // Parameter xml?
|
||||
if (hh->ParamList["xml"] != "")
|
||||
if (!hh->ParamList["xml"].empty())
|
||||
hh->SetHeader(HTTP_OK, "text/xml");
|
||||
else
|
||||
hh->SetHeader(HTTP_OK, "text/plain");
|
||||
@@ -162,26 +162,26 @@ void CyParser::cgi(CyhookHandler *hh) {
|
||||
std::string htmlfilename, yresult, ycmd;
|
||||
|
||||
if ( !hh->ParamList.empty() ) {
|
||||
if (hh->ParamList["tmpl"] != "") // for GET and POST
|
||||
if (!hh->ParamList["tmpl"].empty()) // for GET and POST
|
||||
htmlfilename = hh->ParamList["tmpl"];
|
||||
else
|
||||
htmlfilename = hh->ParamList["1"];
|
||||
bool ydebug = false;
|
||||
if (hh->ParamList["debug"] != "") // switch debug on
|
||||
if (!hh->ParamList["debug"].empty()) // switch debug on
|
||||
ydebug = true;
|
||||
|
||||
if (hh->ParamList["execute"] != "") // execute done first!
|
||||
if (!hh->ParamList["execute"].empty()) // execute done first!
|
||||
{
|
||||
ycmd = hh->ParamList["execute"];
|
||||
ycmd = YPARSER_ESCAPE_START + ycmd + YPARSER_ESCAPE_END;
|
||||
yresult = cgi_cmd_parsing(hh, ycmd, ydebug); // parsing engine
|
||||
}
|
||||
// parsing given file
|
||||
if (htmlfilename != "")
|
||||
if (!htmlfilename.empty())
|
||||
yresult = cgi_file_parsing(hh, htmlfilename, ydebug);
|
||||
} else
|
||||
printf("[CyParser] Y-cgi:no parameter given\n");
|
||||
if (yresult.length() <= 0)
|
||||
if (yresult.empty())
|
||||
hh->SetError(HTTP_NOT_IMPLEMENTED, HANDLED_NOT_IMPLEMENTED);
|
||||
else
|
||||
hh->addResult(yresult, HANDLED_READY);
|
||||
@@ -237,9 +237,9 @@ void CyParser::ParseAndSendFile(CyhookHandler *hh) {
|
||||
hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8");
|
||||
if (hh->Method == M_HEAD)
|
||||
return;
|
||||
if (hh->ParamList["debug"] != "") // switch debug on
|
||||
if (!hh->ParamList["debug"].empty()) // switch debug on
|
||||
ydebug = true;
|
||||
if (hh->ParamList["execute"] != "") // execute done first!
|
||||
if (!hh->ParamList["execute"].empty()) // execute done first!
|
||||
{
|
||||
ycmd = hh->ParamList["execute"];
|
||||
ycmd = YPARSER_ESCAPE_START + ycmd + YPARSER_ESCAPE_END;
|
||||
@@ -249,7 +249,7 @@ void CyParser::ParseAndSendFile(CyhookHandler *hh) {
|
||||
}
|
||||
// parsing given file
|
||||
yresult += cgi_file_parsing(hh, hh->UrlData["path"]+hh->UrlData["filename"], ydebug);
|
||||
if (yresult.length() <= 0)
|
||||
if (yresult.empty())
|
||||
hh->SetError(HTTP_NOT_IMPLEMENTED, HANDLED_NOT_IMPLEMENTED);
|
||||
else {
|
||||
hh->addResult(yresult, HANDLED_READY);
|
||||
@@ -391,7 +391,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
else if (ycmd_type == "comment") {
|
||||
std::string comment_y, comment_html;
|
||||
if (ySplitString(ycmd_name, "~", comment_y, comment_html)) {
|
||||
if (comment_html != "")
|
||||
if (!comment_html.empty())
|
||||
yresult = "<!-- " + comment_html + " -->";
|
||||
}
|
||||
} else if (ycmd_type == "script")
|
||||
@@ -400,7 +400,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
std::string if_value, if_then, if_else;
|
||||
if (ySplitString(ycmd_name, "~", if_value, if_then)) {
|
||||
ySplitString(if_then, "~", if_then, if_else);
|
||||
yresult = (if_value == "") ? if_then : if_else;
|
||||
yresult = (if_value.empty()) ? if_then : if_else;
|
||||
}
|
||||
} else if (ycmd_type == "if-equal") {
|
||||
std::string if_left_value, if_right_value, if_then, if_else;
|
||||
@@ -451,7 +451,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
if (ySplitString(filename, ";", filename, tmp)) {
|
||||
ySplitString(tmp, ";", varname, ydefault);
|
||||
yresult = YWeb_cgi_get_ini(hh, filename, varname, yaccess);
|
||||
if (yresult == "" && ydefault != "")
|
||||
if (yresult.empty() && !ydefault.empty())
|
||||
yresult = ydefault;
|
||||
} else
|
||||
yresult = "ycgi: ini-get: no ; found";
|
||||
@@ -501,7 +501,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
}
|
||||
} else
|
||||
yresult = "ycgi-type unknown";
|
||||
} else if (hh->ParamList[ycmd] != "") {
|
||||
} else if (!hh->ParamList[ycmd].empty()) {
|
||||
if ((hh->ParamList[ycmd]).find("script") == std::string::npos)
|
||||
yresult = hh->ParamList[ycmd];
|
||||
else
|
||||
@@ -518,7 +518,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) {
|
||||
std::string CyParser::YWeb_cgi_get_ini(CyhookHandler *, std::string filename,
|
||||
std::string varname, std::string yaccess) {
|
||||
std::string result;
|
||||
if ((yaccess == "open") || (yaccess == "")) {
|
||||
if ((yaccess == "open") || (yaccess.empty())) {
|
||||
yConfig->clear();
|
||||
yConfig->loadConfig(filename);
|
||||
}
|
||||
@@ -532,12 +532,12 @@ std::string CyParser::YWeb_cgi_get_ini(CyhookHandler *, std::string filename,
|
||||
//-------------------------------------------------------------------------
|
||||
void CyParser::YWeb_cgi_set_ini(CyhookHandler *, std::string filename,
|
||||
std::string varname, std::string varvalue, std::string yaccess) {
|
||||
if ((yaccess == "open") || (yaccess == "")) {
|
||||
if ((yaccess == "open") || (yaccess.empty())) {
|
||||
yConfig->clear();
|
||||
yConfig->loadConfig(filename);
|
||||
}
|
||||
yConfig->setString(varname, varvalue);
|
||||
if ((yaccess == "save") || (yaccess == ""))
|
||||
if ((yaccess == "save") || (yaccess.empty()))
|
||||
yConfig->saveConfig(filename);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ std::string CyParser::YWeb_cgi_include_block(std::string filename,
|
||||
blockname.c_str());
|
||||
}
|
||||
pthread_mutex_unlock(&yParser_mutex);
|
||||
if (yfile.length() != 0) {
|
||||
if (!yfile.empty()) {
|
||||
std::string t = "start-block~" + blockname;
|
||||
std::string::size_type start, end;
|
||||
if ((start = yfile.find(t)) != std::string::npos) {
|
||||
@@ -732,7 +732,7 @@ std::string CyParser::func_do_reload_httpd_config(CyhookHandler *, std::string)
|
||||
// y-func : Change httpd (process image) on the fly
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CyParser::func_change_httpd(CyhookHandler *hh, std::string para) {
|
||||
if (para != "" && access(para, R_OK) == 0) {
|
||||
if (!para.empty() && access(para, R_OK) == 0) {
|
||||
hh->status = HANDLED_ABORT;
|
||||
char * argv[2] = { (char *)para.c_str(), NULL };
|
||||
int err = execvp(argv[0], argv); // no return if successful
|
||||
@@ -771,7 +771,7 @@ std::string CyParser::func_get_languages_as_dropdown(CyhookHandler *,
|
||||
// y-func : get_header_data
|
||||
//-------------------------------------------------------------------------
|
||||
std::string CyParser::func_set_language(CyhookHandler *, std::string para) {
|
||||
if (para != "") {
|
||||
if (!para.empty()) {
|
||||
CConfigFile *Config = new CConfigFile(',');
|
||||
Config->loadConfig(HTTPD_CONFIGFILE);
|
||||
Config->setString("Language.selected", para);
|
||||
|
Reference in New Issue
Block a user