#ifndef HTTPDFUNC_H #define HTTPDFUNC_H time_t webcreatetimeline(char** buf, int* maxlen, int* pos) { int i = 0; struct tm *loctime = NULL; int timeadd = 15 * 60; char* buf1 = NULL; time_t akttimeadd = 0; #ifdef SIMULATE time_t akttime = 1307871000; akttime = 1315614961; #else time_t akttime = time(NULL); #endif akttime -= (((akttime) % 100)); akttime -= (((akttime / 60) % 15) * 60); akttimeadd = akttime; buf1 = malloc(6); if(buf1 == NULL) { err("no mem"); return akttime; } //not shown ostrcatbig(buf, " ", maxlen, pos); for(i = 0; i < 96; i++) { loctime = olocaltime(&akttimeadd); if(loctime != NULL) strftime(buf1, 6, "%H:%M", loctime); else snprintf(buf1, 6, "00:00"); free(loctime); loctime = NULL; ostrcatbig(buf, "
", maxlen, pos); ostrcatbig(buf, buf1, maxlen, pos); ostrcatbig(buf, "
", maxlen, pos); akttimeadd += timeadd; } free(buf1); return akttime / 60; } void webcreatetailbig(char** buf, int* maxlen, int* pos, int flag) { ostrcatbig(buf, "", maxlen, pos); } char* webcreatetail(char* buf, int flag) { buf = ostrcat(buf, "", 1, 0); return buf; } void webcreateheadbig(char** buf, int* maxlen, char* meta, int* pos, int flag) { ostrcatbig(buf, "", maxlen, pos); if(meta != NULL) ostrcatbig(buf, meta, maxlen, pos); ostrcatbig(buf, "", maxlen, pos); if(flag == 0) ostrcatbig(buf, "
", maxlen, pos); else ostrcatbig(buf, "
", maxlen, pos); } char* webcreatehead(char* buf, char* meta, int flag) { buf = ostrcat(buf, "", 1, 0); if(meta != NULL) buf = ostrcat(buf, meta, 1, 0); buf = ostrcat(buf, "", 1, 0); if(flag == 0) buf = ostrcat(buf, "
", 1, 0); else buf = ostrcat(buf, "
", 1, 0); return buf; } void webcreatechannelbody(char** buf, int line, struct channel* chnode, char* channellist, int* maxlen, int* pos, int flag, int fmt) { char* tmpstr = NULL, *buf1 = NULL, *serviceid = NULL, *transponderid = NULL; struct epg* epgnode = getepgakt(chnode); int ret = 0, proz = 0; struct tm *loctime = NULL; time_t max = 0, akt = 0; if(chnode == NULL) return; ret = channelnottunable(chnode); buf1 = malloc(MINMALLOC); if(buf1 == NULL) { err("no mem"); return; } if(fmt == 0) { if(line == 0) ostrcatbig(buf, "", maxlen, pos); else ostrcatbig(buf, "", maxlen, pos); } if(epgnode != NULL) { proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime); if(proz > 100) proz = 100; if(proz < 0) proz = 0; } if(fmt == 0) { ostrcatbig(buf, "", maxlen, pos); } free(buf1); free(serviceid); free(transponderid); } char* webgetbouquetchannel(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL; struct mainbouquet *mbouquet = NULL; struct bouquet *node = NULL; struct channel* chnode = NULL; int line = 0, maxlen = 0, pos = 0; if(param == NULL) return NULL; if(fmt == 0) webcreateheadbig(&buf, &maxlen, "", &pos, 0); mbouquet = getmainbouquet(param); if(mbouquet != NULL) { node = mbouquet->bouquet; tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0); tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0); tmpstr1 = htmlencode(tmpstr); free(tmpstr); tmpstr = NULL; while(node != NULL) { chnode = getchannel(node->serviceid, node->transponderid); if(chnode != NULL) { webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt); if(line == 0) line = 1; else line = 0; } node = node->next; } free(tmpstr1); tmpstr1 = NULL; } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); return buf; } //flag 0: all //flag 1: sat //flag 2: provider //flag 3: A-Z char* webgetchannel(int param, int flag, int page, int fmt) { char* buf = NULL, *tmpnr = NULL, *tmpstr = NULL, *tmpstr1 = NULL; struct channel* chnode = channel; int line = 0, maxcount = 0, maxlen = 0, pos = 0; if(fmt == 0) webcreateheadbig(&buf, &maxlen, "", &pos, 0); if(flag == 0) tmpstr1 = ostrcat(tmpstr1, "(ALL)", 1, 0); if(flag == 1) { struct sat* node = getsatbyorbitalpos(param); if(node != NULL) { tmpstr = ostrcat(tmpstr, "(SAT)-", 1, 0); tmpstr = ostrcat(tmpstr, node->name, 1, 0); tmpstr1 = htmlencode(tmpstr); free(tmpstr); tmpstr = NULL; } } if(flag == 2) { struct provider* node = getprovider(param); if(node != NULL) { tmpstr = ostrcat(tmpstr, "(PROVIDER)-", 1, 0); tmpstr = ostrcat(tmpstr, node->name, 1, 0); tmpstr1 = htmlencode(tmpstr); free(tmpstr); tmpstr = NULL; } } if(flag == 3) { tmpstr = malloc(2); if(tmpstr != NULL) snprintf(tmpstr, 2, "%c", param); tmpstr = ostrcat("(A-Z)-", tmpstr, 0, 1); tmpstr1 = htmlencode(tmpstr); free(tmpstr); tmpstr = NULL; } while(chnode != NULL) { if(chnode->transponder == NULL) { chnode = chnode->next; continue; } if(chnode->name == NULL) { chnode = chnode->next; continue; } if(flag == 1 && chnode->transponder->orbitalpos != param) { chnode = chnode->next; continue; } if(flag == 2 && chnode->providerid != param) { chnode = chnode->next; continue; } if(flag == 3 && chnode->name[0] != param && chnode->name[0] != param + 32) { chnode = chnode->next; continue; } maxcount++; if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page) { chnode = chnode->next; continue; } webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt); if(line == 0) line = 1; else line = 0; chnode = chnode->next; } free(tmpstr); tmpstr = NULL; if(fmt == 0 && maxcount > MAXHTMLLINE) { int i; ostrcatbig(&buf, "", &maxlen, &pos); } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); return buf; } char* webgetprovider(int fmt) { char* buf = NULL, *tmpstr = NULL; struct provider* node = provider; int line = 0, maxlen = 0, pos = 0; if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); while(node != NULL) { if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); } else { buf = ostrcat(buf, node->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->providerid), 1, 1); buf = ostrcat(buf, "\n", 1, 0); } node = node->next; } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); return buf; } char* webgetsat(int fmt) { char* buf = NULL, *tmpstr = NULL; struct sat* node = sat; int line = 0, maxlen = 0, pos = 0; if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); while(node != NULL) { if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); } else { buf = ostrcat(buf, node->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->orbitalpos), 1, 1); buf = ostrcat(buf, "\n", 1, 0); } node = node->next; } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); return buf; } char* webgetaz(int fmt) { char* buf = NULL, *tmpstr = NULL, *tmpnr = NULL; int line = 0, maxlen = 0, pos = 0, i; tmpstr = malloc(2); if(tmpstr == NULL) { err("no memory"); return NULL; } if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); for(i = 65; i < 91; i++) { if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); } else { snprintf(tmpstr, 2, "%c", i); buf = ostrcat(buf, tmpstr, 1, 0); buf = ostrcat(buf, "\n", 1, 0); } } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); free(tmpstr); return buf; } char* webgetbouquet(int fmt) { char* buf = NULL; struct mainbouquet* node = mainbouquet; int line = 0, maxlen = 0, pos = 0; if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); while(node != NULL) { if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); } else { buf = ostrcat(buf, node->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->type), 1, 1); buf = ostrcat(buf, "\n", 1, 0); } node = node->next; } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); return buf; } char* websetmute(char* param, int fmt) { char* buf = NULL; int mute = status.mute; if(param != NULL) mute = atoi(param); if(fmt == 0) { buf = ostrcat(buf, "
", 1, 0); if(mute == 0) buf = ostrcat(buf, "\"Mute", 1, 0); else buf = ostrcat(buf, "\"Mute", 1, 0); buf = ostrcat(buf, "
", 1, 0); } else { if(mute == 0) buf = ostrcat(buf, "0", 1, 0); else buf = ostrcat(buf, "1", 1, 0); } if(mute != status.mute) screenmute(NULL, NULL, 0); return buf; } char* websetvol(char* param, int fmt) { char* buf = NULL; int vol = 30; if(param == NULL) vol = getvol(); else vol = atoi(param); if(fmt == 0) { buf = ostrcat(buf, "
", 1, 0); if(vol >=10) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=20) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=30) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=40) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=50) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=60) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=70) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=80) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=90) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); if(vol >=100) buf = ostrcat(buf, " ", 1, 0); else buf = ostrcat(buf, " ", 1, 0); buf = ostrcat(buf, "
", 1, 0); } else buf = ostrcat(buf, oitoa(vol), 1, 1); if(param != NULL) { setvol(vol); if(status.mute == 1) screenmute(NULL, NULL, 0); } return buf; } char* webgetaktservice(int fmt) { char* buf = NULL; struct channel* chnode = status.aktservice->channel; int line = 0, maxlen = 0, pos = 0; if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1); webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt); if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1); return buf; } char* webgetservice(char* param, int fmt) { char* buf = NULL, *param1 = NULL; struct channel* chnode = NULL; int line = 0, maxlen = 0, pos = 0; if(param == NULL) return NULL; //create param1 param1 = strchr(param, '&'); if(param1 != NULL) *param1++ = '\0'; if(param1 == NULL) return NULL; chnode = getchannel(atoi(param), strtoull(param1, NULL, 10)); if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1); webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt); if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1); return buf; } char* webswitch(char* param, int fmt) { if(status.channelswitch == 1) goto end; int ret = 0; char* param1 = NULL, *param2 = NULL; struct channel* chnode = NULL; if(param == NULL) goto end; //create param1 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } if(param1 == NULL && param2 == NULL) goto end; chnode = getchannel(atoi(param), strtoull(param1, NULL, 10)); if(chnode != NULL) { ret = channelnottunable(chnode); if(ret == 0) ret = servicestart(chnode, param2, NULL, 0); } end: return webgetaktservice(fmt); } char* webgetm3u(char* param, int connfd, int fmt) { int extip = 1; char* buf = NULL, *ip = NULL, *tmpbuf = NULL; struct sockaddr_in sin; socklen_t len = sizeof(sin); if(param == NULL) return NULL; if(getconfigint("webifip", NULL) == 1) ip = getispip(); if(ip == NULL) { if(getsockname(connfd, &sin, &len) < 0) { perr("getsockname"); return NULL; } extip = 0; ip = inet_ntoa(sin.sin_addr); if(ip == NULL) return NULL; } buf = ostrcat(buf, "#EXTM3U\n", 1, 0); buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0); buf = ostrcat(buf, "http://", 1, 0); buf = ostrcat(buf, ip, 1, 0); buf = ostrcat(buf, ":", 1, 0); buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0); buf = ostrcat(buf, "/", 1, 0); tmpbuf = htmlencode(param); if(tmpbuf != NULL) param = tmpbuf; buf = ostrcat(buf, param, 1, 0); free(tmpbuf); tmpbuf = NULL; if(extip == 1) free(ip); return buf; } char* webgetvideo(char* param, int connfd, int fmt) { int extip = 1; char* buf = NULL, *ip = NULL, *tmpbuf = NULL; struct sockaddr_in sin; socklen_t len = sizeof(sin); if(param == NULL) return NULL; if(getconfigint("webifip", NULL) == 1) ip = getispip(); if(ip == NULL) { if(getsockname(connfd, &sin, &len) < 0) { perr("getsockname"); return NULL; } extip = 0; ip = inet_ntoa(sin.sin_addr); if(ip == NULL) return NULL; } if(fmt == 0) { buf = ostrcat(buf, "
TV", maxlen, pos); else ostrcatbig(buf, "Radio", maxlen, pos); //single epg ostrcatbig(buf, "\"Single", maxlen, pos); //m3u stream + webstream if(ret == 0) { ostrcatbig(buf, "Stream", maxlen, pos); ostrcatbig(buf, "WebStream", maxlen, pos); } else ostrcatbig(buf, "\"Channel", maxlen, pos); ostrcatbig(buf, "

", &maxlen, &pos); for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++) { if(page == i) ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, tmpnr, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(tmpnr); tmpnr = NULL; } ostrcatbig(&buf, "
providerid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "\">", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "
providerid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "\">", &maxlen, &pos); line = 0; } ostrcatbig(&buf, node->name, &maxlen, &pos); ostrcatbig(&buf, "
orbitalpos); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "\">", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "
orbitalpos); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "\">", &maxlen, &pos); line = 0; } ostrcatbig(&buf, node->name, &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "
", &maxlen, &pos); line = 0; } snprintf(tmpstr, 2, "%c", i); ostrcatbig(&buf, tmpstr, &maxlen, &pos); ostrcatbig(&buf, "
name, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "
name, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); line = 0; } ostrcatbig(&buf, node->name, &maxlen, &pos); ostrcatbig(&buf, "TV", &maxlen, &pos); else ostrcatbig(&buf, "img/radio.png width=16 height=16 alt=Radio>", &maxlen, &pos); ostrcatbig(&buf, "name, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "\"Graphical", &maxlen, &pos); ostrcatbig(&buf, "
", 1, 0); } if(extip == 1) free(ip); return buf; } char* webvideo(char* param, int fmt) { char* buf = NULL, *param1 = NULL, *tmpbuf = NULL; if(param == NULL) return NULL; //create param1 param1 = strchr(param, '&'); if(param1 != NULL) *param1++ = '\0'; if(param1 == NULL) return NULL; htmldecode(param1, param1); if(param1 != NULL) { if(status.play == 0 && status.webplayfile == NULL) { if(ostrstr(param1, "url=") == param1) status.webplayfile = ostrcat(param1 + 4, NULL, 0, 0); else if(ostrstr(param1, "hosterurl=") == param1) { status.webplayfile = ostrcat(param1 + 10, NULL, 0, 0); // stream over tithek enable start printf("status.webplayfile: %s\n",status.webplayfile); struct skin* tithekplugin = getplugin("TiTan Mediathek"); if(tithekplugin != NULL) { struct tithek* (*startplugin)(char*); startplugin = dlsym(tithekplugin->pluginhandle, "hoster"); if(startplugin != NULL) { status.webplayfile = startplugin(status.webplayfile); printf("status.webplayfile changed: %s\n",status.webplayfile); } } // stream over tithek enable end } else status.webplayfile = ostrcat(param1, NULL, 0, 0); } } tmpbuf = ostrcat("not in play mode", NULL, 0, 0); int count = 0; if(status.timeshift == 0 && status.play == 0 && (ostrcmp("play", param) == 0 || ostrcmp("play=", param) == 0)) { int count = 0; int rcret = getrcconfigint("rcwebplay", NULL); if(rcret == 0) rcret = getrcconfigint("rcarchive", NULL); if(rcret == 0) rcret = getrcconfigint("rcplay", NULL); writerc(rcret); while(status.play == 0 && count < 30) { usleep(100000); count++; } } else count = 31; if(count >= 30 && status.play == 0) { free(status.webplayfile); status.webplayfile = NULL; free(tmpbuf); tmpbuf = NULL; tmpbuf = ostrcat("can not start playback", NULL, 0, 0); } if(status.timeshift == 0 && status.play == 1) { if(ostrcmp("stop", param) == 0 || ostrcmp("stop=", param) == 0) writerc(getrcconfigint("rcstop", NULL)); if(ostrcmp("pause", param) == 0 || ostrcmp("pause=", param) == 0) writerc(getrcconfigint("rcpause", NULL)); if(ostrcmp("ff", param) == 0 || ostrcmp("ff=", param) == 0) writerc(getrcconfigint("rcff", NULL)); if(ostrcmp("fr", param) == 0 || ostrcmp("fr=", param) == 0) writerc(getrcconfigint("rcfr", NULL)); free(tmpbuf); tmpbuf = NULL; tmpbuf = ostrcat(param, NULL, 0, 0); if(ostrcmp("getlen", param) == 0 || ostrcmp("getlen=", param) == 0) { unsigned long len = 0; free(tmpbuf); tmpbuf = NULL; len = playergetlength(); tmpbuf = ostrcat(buf, olutoa(len), 1, 1); } if(ostrcmp("getpos", param) == 0 || ostrcmp("getpos=", param) == 0) { unsigned long pos = 0; free(tmpbuf); tmpbuf = NULL; pos = playergetpts() / 90000; tmpbuf = ostrcat(buf, olutoa(pos), 1, 1); } if(ostrcmp("getisplaying", param) == 0 || ostrcmp("getisplaying=", param) == 0) { int playing = 0; free(tmpbuf); tmpbuf = NULL; playing = playerisplaying(); tmpbuf = ostrcat(buf, oitoa(playing), 1, 1); } if(ostrcmp("getplayercan", param) == 0 || ostrcmp("getplayercan=", param) == 0) { free(tmpbuf); tmpbuf = NULL; tmpbuf = ostrcat(buf, olutoa(status.playercan), 1, 1); } } if(fmt == 0) { buf = webcreatehead(buf, NULL, 1); buf = ostrcat(buf, "", 1, 0); buf = webcreatetail(buf, 1); } else buf = ostrcat(buf, tmpbuf, 1, 1); return buf; } char* webgetchannelpage(char* param, int fmt) { char* param1 = NULL, *param2 = NULL; if(param == NULL) return NULL; //create param1 + 2 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } if(param1 == NULL || param2 == NULL) return NULL; return webgetchannel(atoi(param), atoi(param1), atoi(param2), fmt); } void webmessage(struct stimerthread* timernode, char* text, int flag) { textbox(_("Message"), text, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); free(text); } char* websendmessage(char* param, int fmt) { char* text = NULL, *buf = NULL; if(param == NULL) return NULL; param = strchr(param, '='); if(param != NULL) { param++; stringreplacechar(param, '+', ' '); text = ostrcat(text, param, 1, 0); } addtimer(&webmessage, START, 1000, 1, (void*)text, NULL, NULL); if(fmt == 0) { buf = webcreatehead(buf, NULL, 1); buf = ostrcat(buf, "", 1, 0); buf = webcreatetail(buf, 1); } else buf = ostrcat(buf, "Message Send", 1, 0); return buf; } char* webgetsignal(int fmt) { char* buf = NULL, *tmpnr = NULL; uint16_t snr = 0, signal = 0; uint32_t ber = 0, unc = 0; ber = fereadber(status.aktservice->fedev); unc = fereaduncorrectedblocks(status.aktservice->fedev); signal = fereadsignalstrength(status.aktservice->fedev); snr = fereadsnr(status.aktservice->fedev); snr = (snr * 100) / 0xffff; if(fmt == 0) { buf = webcreatehead(buf, "", 0); buf = ostrcat(buf, "", 1, 0); buf = webcreatetail(buf, 0); } else { buf = ostrcat(buf, oitoa(ber), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(unc), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(signal), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(snr), 1, 1); } return buf; } char* webgetepg(char* param, int fmt) { char* buf = NULL, *buf1 = NULL, *tmpstr = NULL, *param1 = NULL, *param2 = NULL; struct epg* epgnode = NULL; struct channel* chnode = NULL; struct tm *loctime = NULL; if(param == NULL) return NULL; //create param1 + 2 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } if(param1 == NULL || param2 == NULL) return NULL; chnode = getchannel(atoi(param), strtoull(param1, NULL, 10)); if(chnode == NULL) return NULL; epgnode = getepg(chnode, atoi(param2), 0); if(epgnode == NULL) return NULL; if(fmt == 0) buf = webcreatehead(buf, NULL, 0); buf1 = malloc(MINMALLOC); if(buf1 == NULL) { err("no mem"); return buf; } if(fmt == 0) buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = webcreatetail(buf, 0); } free(buf1); return buf; } char* webgetsingleepg(char* param, int fmt) { int line = 0, maxlen = 0, pos = 0, longdesc = 1; char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL, *tmpstr = NULL; struct epg* epgnode = NULL; struct channel* chnode = NULL; struct tm *loctime = NULL; if(param == NULL) return NULL; //create param1 + 2 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } if(param1 == NULL) return NULL; if(param2 != NULL) longdesc = atoi(param2); chnode = getchannel(atoi(param), strtoull(param1, NULL, 10)); if(chnode == NULL) return NULL; epgnode = getepgakt(chnode);; if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); buf1 = malloc(MINMALLOC); if(buf1 == NULL) { err("no mem"); return buf; } while(epgnode != NULL) { if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "", &maxlen, &pos); line = 0; } ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, buf2, &maxlen, &pos); ostrcatbig(&buf, "\"set", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); } else { buf = ostrcat(buf, epgnode->title, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, epgnode->subtitle, 1, 0); buf = ostrcat(buf, "#", 1, 0); if(longdesc == 1) { tmpstr = epgdescunzip(epgnode); if(tmpstr != NULL) buf = ostrcat(buf, tmpstr, 1, 0); free(tmpstr); tmpstr = NULL; } buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1); buf = ostrcat(buf, "\n", 1, 0); } epgnode = epgnode->next; free(buf2); buf2 = NULL; } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); else if(buf == NULL) buf = ostrcat("no data", NULL, 0, 0); free(buf1); return buf; } //TODO: create rectimer line void webcalcrecline(char** buf, int* maxlen, int* pos) { //ostrcatbig(buf, "
", 1, 0); buf = ostrcat(buf, "", 1, 0); //buf = ostrcat(buf, "Play", 1, 0); //buf = ostrcat(buf, "Stop", 1, 0); //buf = ostrcat(buf, "Fullscreen", 1, 0); buf = ostrcat(buf, "


Video ", 1, 0); buf = ostrcat(buf, tmpbuf, 1, 1); buf = ostrcat(buf, " !!!


Message Send !!!


BER: ", 1, 0); tmpnr = oitoa(ber); buf = ostrcat(buf, tmpnr, 1, 0); free(tmpnr); tmpnr = NULL; buf = ostrcat(buf, "
UNC: ", 1, 0); tmpnr = oitoa(unc); buf = ostrcat(buf, tmpnr, 1, 0); free(tmpnr); tmpnr = NULL; buf = ostrcat(buf, "
SIG: ", 1, 0); tmpnr = oitoa(signal); buf = ostrcat(buf, tmpnr, 1, 0); free(tmpnr); tmpnr = NULL; buf = ostrcat(buf, "
SNR: ", 1, 0); tmpnr = oitoa(snr); buf = ostrcat(buf, tmpnr, 1, 0); free(tmpnr); tmpnr = NULL; buf = ostrcat(buf, "
", 1, 0); if(epgnode->title != NULL) { buf = ostrcat(buf, epgnode->title, 1, 0); if(fmt == 0) { buf = ostrcat(buf, " (", 1, 0); loctime = olocaltime(&epgnode->starttime); if(loctime != NULL) strftime(buf1, MINMALLOC, "%H:%M -", loctime); free(loctime); loctime = NULL; loctime = olocaltime(&epgnode->endtime); if(loctime != NULL) strftime(&buf1[7], MINMALLOC - 8, " %H:%M", loctime); free(loctime); loctime = NULL; buf = ostrcat(buf, buf1, 1, 0); buf = ostrcat(buf, ")", 1, 0); } } if(fmt == 0) { buf = ostrcat(buf, "

", 1, 0); } else { buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1); buf = ostrcat(buf, "#", 1, 0); } if(epgnode->subtitle != NULL) buf = ostrcat(buf, epgnode->subtitle, 1, 0); if(fmt == 0) { buf = ostrcat(buf, "

", 1, 0); } else buf = ostrcat(buf, "#", 1, 0); tmpstr = epgdescunzip(epgnode); if(tmpstr != NULL) buf = ostrcat(buf, tmpstr, 1, 0); free(tmpstr); tmpstr = NULL; if(fmt == 0) { buf = ostrcat(buf, "
serviceid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); buf2 = ostrcat("transponderid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); buf2 = ostrcat(buf2, tmpstr, 0, 0); buf2 = ostrcat(buf2, "&", 0, 0); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "&", &maxlen, &pos); tmpstr = oitoa(epgnode->eventid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); buf2 = ostrcat(buf2, tmpstr, 0, 0); buf2 = ostrcat(buf2, ">", 0, 0); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, ">", &maxlen, &pos); loctime = olocaltime(&epgnode->starttime); if(loctime != NULL) strftime(buf1, MINMALLOC, "%d.%m - %H:%M : ", loctime); //strftime(buf1, MINMALLOC, "%H:%M -", loctime); free(loctime); loctime = NULL; //loctime = olocaltime(&epgnode->endtime); //if(loctime != NULL) // strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime); //free(loctime); loctime = NULL; ostrcatbig(&buf, buf1, &maxlen, &pos); ostrcatbig(&buf, " ", &maxlen, &pos); ostrcatbig(&buf, epgnode->title, &maxlen, &pos); if(epgnode->subtitle != NULL) { ostrcatbig(&buf, " (", &maxlen, &pos); ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos); ostrcatbig(&buf, ")", &maxlen, &pos); } ostrcatbig(&buf, "
", maxlen, pos); } char* webgetgmultiepg(char* param, int fmt) { int page = 1, i, line = 0, treffer = 0, maxlen = 0, pos = 0; char* buf = NULL, *tmpnr = NULL, *param1 = NULL; struct mainbouquet *mbouquet = NULL; struct bouquet *node = NULL; struct channel* chnode = NULL; struct epg* epgnode = NULL; time_t akttime = 0, difftime = 0, starttime = 0, endtime = 0, lastendtime = 0; if(param == NULL) return NULL; //create param1 param1 = strchr(param, '&'); if(param1 != NULL) *param1++ = '\0'; if(param1 != NULL) page = atoi(param1); ostrcatbig(&buf, "
", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "", &maxlen, &pos); line = 0; } } if(fmt == 1 && newchannel == 1) { newchannel = 0; ostrcatbig(&buf, "BeginNewChannel", &maxlen, &pos); ostrcatbig(&buf, "#", &maxlen, &pos); ostrcatbig(&buf, chnode->name, &maxlen, &pos); ostrcatbig(&buf, "#", &maxlen, &pos); tmpstr = oitoa(chnode->serviceid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "#", &maxlen, &pos); tmpstr = ollutoa(chnode->transponderid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "#", &maxlen, &pos); tmpstr = oitoa(chnode->servicetype); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "\n", &maxlen, &pos); } if(fmt == 0) { ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, buf2, &maxlen, &pos); ostrcatbig(&buf, "\"set", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); } else { ostrcatbig(&buf, epgnode->title, &maxlen, &pos); ostrcatbig(&buf, "#", &maxlen, &pos); tmpstr = olutoa(epgnode->starttime); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "#", &maxlen, &pos); tmpstr = olutoa(epgnode->endtime); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "#", &maxlen, &pos); ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos); ostrcatbig(&buf, "#", &maxlen, &pos); if(longepg == 1) { tmpstr = epgdescunzip(epgnode); if(tmpstr != NULL) ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; } ostrcatbig(&buf, "#", &maxlen, &pos); tmpstr = oitoa(epgnode->eventid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "\n", &maxlen, &pos); } } epgnode = epgnode->next; free(buf2); buf2 = NULL; } chnode = chnode->next; } if(maxcount > MAXHTMLLINE && fmt == 0) { int i; ostrcatbig(&buf, "", &maxlen, &pos); } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); else if(buf == NULL) buf = ostrcat("no data", NULL, 0, 0); free(buf1); return buf; } //flagbit 0: restrict to path //flagbit 1: show epg icon //flagbit 2: show delete icon //flagbit 3: show stream icon //flagbit 4: show websteam icon char* webgetfilelist(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt) { char* buf = NULL, *tmppath = NULL, *tmpnr = NULL, *param1 = NULL; int maxlen = 0, pos = 0, line = 0, maxcount = 0, page = 1; struct skin* webdir = getscreen("webdir"); struct skin* filelist = getscreennode(webdir, "filelist"); struct skin* filelistpath = getscreennode(webdir, "filelistpath"); struct skin* node = NULL; if(param == NULL) param = path; //create param1 param1 = strchr(param, '&'); if(param1 != NULL) *param1++ = '\0'; if(param1 != NULL) page = atoi(param1); if(strlen(param) == 0 || !isdir(param)) tmppath = ostrcat(path, NULL, 0, 0); else tmppath = ostrcat(param, NULL, 0, 0); char* tmppath1 = createpath(tmppath, ""); free(tmppath); tmppath = tmppath1; if(checkbit(flag, 0) == 1) { if(ostrstr(tmppath, path) != tmppath) { free(tmppath); tmppath = NULL; tmppath = ostrcat(path, NULL, 0, 0); } } changemask(filelist, mask); changeinput(filelist, tmppath); changetext(filelistpath, filelist->input); free(tmppath); tmppath = NULL; delmarkedscreennodes(webdir, FILELISTDELMARK); createfilelist(webdir, filelist, 0); if(fmt == 0) ostrcatbig(&buf, "
", &maxlen, &pos); akttime = webcreatetimeline(&buf, &maxlen, &pos); akttime += ((page - 1) * 1440); ostrcatbig(&buf, "", &maxlen, &pos); mbouquet = getmainbouquet(param); if(mbouquet != NULL) { node = mbouquet->bouquet; while(node != NULL) { chnode = getchannel(node->serviceid, node->transponderid); if(chnode != NULL) { if(line == 0) { ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, chnode->name, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); webcalcrecline(&buf, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "", &maxlen, &pos); node = node->next; } } ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, chnode->name, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); webcalcrecline(&buf, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); line = 0; } treffer = 0; lastendtime = 0; epgnode = getepgakt(chnode); while(epgnode != NULL) { treffer = 1; starttime = epgnode->starttime / 60; endtime = epgnode->endtime / 60; if(endtime <= starttime || starttime >= akttime + 1440) { epgnode = epgnode->next; continue; } //check if old endtime > new starttime if(lastendtime > 0 && starttime > lastendtime) { difftime = (starttime - lastendtime) * 5; if(difftime <= 0) { epgnode = epgnode->next; continue; } ostrcatbig(&buf, "", &maxlen, &pos); } //check if starttime < last endtime if(starttime < lastendtime) starttime = lastendtime; //check if endtime is in next day if(endtime > akttime + 1440) endtime = endtime - (endtime - (akttime + 1440)); //check if starttime is in prev day if(starttime < akttime) difftime = (endtime - akttime) * 5; else difftime = (endtime - starttime) * 5; if(difftime <= 0) { epgnode = epgnode->next; continue; } lastendtime = endtime; ostrcatbig(&buf, "", &maxlen, &pos); epgnode = epgnode->next; } if(treffer == 0) ostrcatbig(&buf, "", &maxlen, &pos); } ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, epgnode->title, &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); for(i = 1; i <= 14; i++) { if(page == i) ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, tmpnr, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(tmpnr); tmpnr = NULL; } ostrcatbig(&buf, "
", &maxlen, &pos); return buf; } char* webgetdrawcount(char* param, int fmt) { return oitoa(status.drawscreencount); } void webgetshoot(char* param, int fmt) { printf("param: %s\n",param); printf("parm: %d\n",fmt); screenshoot(atoi(param)); } char* webgetepgsearch(char* query, char* param, int fmt) { int line = 0, maxlen = 0, pos = 0, maxcount = 0, page = 1, newchannel = 0, longepg = 0; char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *tmpstr = NULL, *tmpnr = NULL, *param1 = NULL, *param2 = NULL; struct channel* chnode = channel; struct epg* epgnode = NULL; struct tm *loctime = NULL; if(query == NULL) return NULL; if(param == NULL) { query = strchr(query, '='); if(query != NULL) { query++; stringreplacechar(param, '+', ' '); param = query; } } else { //create param1 + 2 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } } if(param1 != NULL) page = atoi(param1); if(param2 != NULL) longepg = atoi(param2); buf1 = malloc(MINMALLOC); if(buf1 == NULL) { err("no mem"); return buf; } if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); while(chnode != NULL) { newchannel = 1; epgnode = getepgakt(chnode); while(epgnode != NULL) { if(epgnode->title != NULL && ostrstrcase(epgnode->title, param) != NULL) { maxcount++; if(page >= 0) { if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page) { epgnode = epgnode->next; continue; } } if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "
serviceid); buf2 = ostrcat("transponderid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); buf2 = ostrcat(buf2, tmpstr, 0, 0); buf2 = ostrcat(buf2, "&", 0, 0); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, "&", &maxlen, &pos); tmpstr = oitoa(epgnode->eventid); ostrcatbig(&buf, tmpstr, &maxlen, &pos); buf2 = ostrcat(buf2, tmpstr, 0, 0); buf2 = ostrcat(buf2, ">", 0, 0); free(tmpstr); tmpstr = NULL; ostrcatbig(&buf, ">", &maxlen, &pos); loctime = olocaltime(&epgnode->starttime); if(loctime != NULL) strftime(buf1, MINMALLOC, "%d.%m _ %H:%M __ ", loctime); //strftime(buf1, MINMALLOC, "%H:%M -", loctime); free(loctime); loctime = NULL; //loctime = olocaltime(&epgnode->endtime); //if(loctime != NULL) // strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime); //free(loctime); loctime = NULL; ostrcatbig(&buf, buf1, &maxlen, &pos); ostrcatbig(&buf, " ", &maxlen, &pos); ostrcatbig(&buf, epgnode->title, &maxlen, &pos); if(chnode->name != NULL) { ostrcatbig(&buf, " (", &maxlen, &pos); ostrcatbig(&buf, chnode->name, &maxlen, &pos); ostrcatbig(&buf, ")", &maxlen, &pos); } ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos); ostrcatbig(&buf, "

", &maxlen, &pos); for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++) { if(page == i) ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, tmpnr, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(tmpnr); tmpnr = NULL; } ostrcatbig(&buf, "
", &maxlen, &pos); node = filelist; while(node != NULL) { if(node->del == FILELISTDELMARK) { maxcount++; if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page) { node = node->next; continue; } if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "", &maxlen, &pos); line = 0; } ostrcatbig(&buf, "", &maxlen, &pos); } else { ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "#0", &maxlen, &pos); ostrcatbig(&buf, "\n", &maxlen, &pos); } } else { if(fmt == 0) { ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); } } node = node->next; } if(maxcount > MAXHTMLLINE) { int i; ostrcatbig(&buf, "", &maxlen, &pos); } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); delmarkedscreennodes(webdir, FILELISTDELMARK); return buf; } char* webgetmovieepg(char* param, char* path, int flag, int fmt) { char* buf = NULL, *tmpstr = NULL; char tstr[2]; char c = 0; int first = 1, maxlen = 0, pos = 0; FILE* fd = NULL; if(fmt == 0) { webcreateheadbig(&buf, &maxlen, NULL, &pos, 0); ostrcatbig(&buf, "", &maxlen, &pos); webcreatetailbig(&buf, &maxlen, &pos, 0); } free(tmpstr); tmpstr = NULL; return buf; } char* webdelfile(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt) { int del = 0; char* buf = NULL, *param1 = NULL, *param2 = NULL, *tmpparam = NULL; if(param == NULL) return NULL; //create param1 + 2 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } if(param1 == NULL || param2 == NULL) return NULL; tmpparam = createpath(param, param2); if(checkbit(flag, 0) == 1) { if(tmpparam != NULL && ostrstr(tmpparam, path) == tmpparam) del = 1; } else del = 1; if(del == 1) { char* epgfilename = NULL; unlink(tmpparam); if(cmpfilenameext(tmpparam, ".ts") == 0) { epgfilename = changefilenameext(tmpparam, ".epg"); unlink(epgfilename); free(epgfilename); epgfilename = NULL; epgfilename = changefilenameext(tmpparam, ".se"); unlink(epgfilename); free(epgfilename); epgfilename = NULL; epgfilename = changefilenameext(tmpparam, ".ma"); unlink(epgfilename); free(epgfilename); epgfilename = NULL; } } free(tmpparam); tmpparam = NULL; tmpparam = ostrcat(tmpparam, param, 1, 0); tmpparam = ostrcat(tmpparam, "&", 1, 0); tmpparam = ostrcat(tmpparam, param1, 1, 0); buf = webgetfilelist(tmpparam, link, dellink, path, mask, flag, fmt); free(tmpparam); tmpparam = NULL; return buf; } char* websendrc(char* param, int fmt) { int rccode = 0; char* buf = NULL; rccode = getrcconfigint(param, NULL); writerc(rccode); buf = ostrcat("ok", NULL, 0, 0); return buf; } //flag 0: get aktiv timer //flag 1: get old timer char* webgetrectimer(char* param, int flag, int fmt) { char* buf = NULL, *buf1 = NULL; struct rectimer* node = rectimer; struct channel* chnode = NULL; int line = 0, maxlen = 0, pos = 0; struct tm *loctime = NULL; buf1 = malloc(MINMALLOC); if(buf1 == NULL) { err("no mem"); return NULL; } if(fmt == 0) ostrcatbig(&buf, "
", &maxlen, &pos); } if(node->input != NULL) //dir { if(fmt == 0) { ostrcatbig(&buf, "Directory input, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, " ", &maxlen, &pos); //epg png if(checkbit(flag, 1) == 1) { ostrcatbig(&buf, "text, &maxlen, &pos); ostrcatbig(&buf, "/", &maxlen, &pos); ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "EPG", &maxlen, &pos); } //delete png if(checkbit(flag, 2) == 1) { ostrcatbig(&buf, "Delete", &maxlen, &pos); } //stream png if(checkbit(flag, 3) == 1) { ostrcatbig(&buf, "text, &maxlen, &pos); ostrcatbig(&buf, "/", &maxlen, &pos); ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "Stream", &maxlen, &pos); } //webstream png if(checkbit(flag, 4) == 1) { ostrcatbig(&buf, "text, &maxlen, &pos); ostrcatbig(&buf, "/", &maxlen, &pos); ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "WebStream", &maxlen, &pos); ostrcatbig(&buf, "text, &maxlen, &pos); ostrcatbig(&buf, "/", &maxlen, &pos); ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "Download", &maxlen, &pos); } } else { ostrcatbig(&buf, node->text, &maxlen, &pos); ostrcatbig(&buf, "#1", &maxlen, &pos); ostrcatbig(&buf, "\n", &maxlen, &pos); } } if(fmt == 0) { ostrcatbig(&buf, "

", &maxlen, &pos); for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++) { if(page == i) { ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, tmpnr, &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(tmpnr); tmpnr = NULL; } ostrcatbig(&buf, "
", &maxlen, &pos); } if(flag == 1) { if(param != NULL && ostrstr(param, path) == param) { tmpstr = changefilenameext(param, ".epg"); fd = fopen(tmpstr, "r"); } } else { tmpstr = changefilenameext(param, ".epg"); fd = fopen(tmpstr, "r"); } if(fd != NULL) { while(c != EOF) { c = fgetc(fd); if(fmt == 0 && c == '\n') { if(first == 1) { ostrcatbig(&buf, "
", &maxlen, &pos); first = 0; } ostrcatbig(&buf, "
", &maxlen, &pos); continue; } if(c != EOF) { sprintf(tstr, "%c", c); ostrcatbig(&buf, tstr, &maxlen, &pos); } } fclose(fd); } if(fmt == 0) { ostrcatbig(&buf, "
", &maxlen, &pos); while(node != NULL) { if((flag == 0 && (node->status == 2 || node->status == 3)) || (flag == 1 && (node->status == 0 || node->status == 1)) || node->status == 4 || node->status == 5) { node = node->next; continue; } if(fmt == 0) { if(line == 0) { ostrcatbig(&buf, "", &maxlen, &pos); } else { buf = ostrcat(buf, olutoa(node->begin), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(node->end), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->justplay), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->repeate), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->serviceid), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, ollutoa(node->transponderid), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->status), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->errstr, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->timestamp, 1, 0); buf = ostrcat(buf, "#", 1, 0); chnode = getchannel(node->serviceid, node->transponderid); if(chnode != NULL) buf = ostrcat(buf, chnode->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(node->afterevent), 1, 1); buf = ostrcat(buf, "\n", 1, 0); } node = node->next; } if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0); else if(buf == NULL) buf = ostrcat("no data", NULL, 0, 0); free(buf1); return buf; } char* webaddrectimer(char* param, int fmt) { char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL; struct channel* chnode = NULL; struct epg* epgnode = NULL; // int maxlen = 0, pos = 0, tmpservicetype = 0; int maxlen = 0, pos = 0; struct tm* loctime = NULL; time_t akttime = time(NULL); if(param != NULL) { //create param1 + 2 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) *param2++ = '\0'; } if(param1 == NULL || param2 == NULL) return NULL; chnode = getchannel(atoi(param), strtoull(param1, NULL, 10)); if(chnode == NULL) return NULL; epgnode = getepg(chnode, atoi(param2), 0); if(epgnode == NULL) return NULL; } ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, "


", &maxlen, &pos); if(chnode == NULL) ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); line = 1; } else { ostrcatbig(&buf, "
", &maxlen, &pos); line = 0; } loctime = olocaltime(&node->begin); if(loctime != NULL) strftime(buf1, MINMALLOC, "%d-%m-%Y %H:%M -", loctime); free(loctime); loctime = NULL; loctime = olocaltime(&node->end); if(loctime != NULL) strftime(&buf1[18], MINMALLOC - 19, " %H:%M ", loctime); free(loctime); loctime = NULL; ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, buf1, &maxlen, &pos); ostrcatbig(&buf, " (", &maxlen, &pos); if(node->justplay == 0) ostrcatbig(&buf, "rec - ", &maxlen, &pos); else ostrcatbig(&buf, "switch - ", &maxlen, &pos); if(node->repeate == 0) ostrcatbig(&buf, "once", &maxlen, &pos); else ostrcatbig(&buf, "repeate", &maxlen, &pos); ostrcatbig(&buf, ")
", &maxlen, &pos); if(node->name == NULL || strlen(node->name) == 0) ostrcatbig(&buf, "---", &maxlen, &pos); else ostrcatbig(&buf, node->name, &maxlen, &pos); chnode = getchannel(node->serviceid, node->transponderid); if(chnode != NULL) { ostrcatbig(&buf, " (", &maxlen, &pos); ostrcatbig(&buf, chnode->name, &maxlen, &pos); ostrcatbig(&buf, ")", &maxlen, &pos); } ostrcatbig(&buf, "
", &maxlen, &pos); if(node->status == 0) ostrcatbig(&buf, "waiting", &maxlen, &pos); else if(node->status == 1) ostrcatbig(&buf, "running", &maxlen, &pos); else if(node->status == 2) ostrcatbig(&buf, "succes", &maxlen, &pos); else if(node->status == 3) { ostrcatbig(&buf, "error", &maxlen, &pos); if(node->errstr != NULL && strlen(node->errstr) > 0) { ostrcatbig(&buf, " (", &maxlen, &pos); ostrcatbig(&buf, node->errstr, &maxlen, &pos); ostrcatbig(&buf, ")", &maxlen, &pos); } } ostrcatbig(&buf, "
", &maxlen, &pos); if(flag == 0) { ostrcatbig(&buf, "
", &maxlen, &pos); //edit png ostrcatbig(&buf, "timestamp, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "\"Edit", &maxlen, &pos); //delete png ostrcatbig(&buf, "Delete", &maxlen, &pos); } ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); buf2 = malloc(MINMALLOC); if(epgnode != NULL) loctime = olocaltime(&epgnode->starttime); else loctime = olocaltime(&akttime); if(loctime != NULL) strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime); free(loctime); loctime = NULL; buf1 = ostrcat(buf2, NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(buf1); buf1 = NULL; if(epgnode != NULL) loctime = olocaltime(&epgnode->endtime); else loctime = olocaltime(&akttime); if(loctime != NULL) strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime); free(loctime); loctime = NULL; buf1 = ostrcat(buf2, NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(buf1); buf1 = NULL; free(buf2); buf2 = NULL; ostrcatbig(&buf, "", &maxlen, &pos); if(chnode == NULL) ostrcatbig(&buf, "", &maxlen, &pos); free(buf1); buf1 = NULL; ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
Name: title, &maxlen, &pos); else ostrcatbig(&buf, " ", &maxlen, &pos); ostrcatbig(&buf, "\" />
Type: 
Begin: 
End: 
Channel: ", &maxlen, &pos); ostrcatbig(&buf, "serviceid); ostrcatbig(&buf, buf1, &maxlen, &pos); free(buf1); buf1 = NULL; ostrcatbig(&buf, "\" />", &maxlen, &pos); ostrcatbig(&buf, "transponderid); ostrcatbig(&buf, buf1, &maxlen, &pos); free(buf1); buf1 = NULL; ostrcatbig(&buf, "\" />", &maxlen, &pos); ostrcatbig(&buf, "name, &maxlen, &pos); else if(status.aktservice->channel != NULL) ostrcatbig(&buf, status.aktservice->channel->name, &maxlen, &pos); ostrcatbig(&buf, "\" />
after event: 


 
", &maxlen, &pos); //ostrcatbig(&buf, param, &maxlen, &pos); return buf; } char* webrectimercheck(char* param, int fmt) { char* buf = NULL, *buf1 = NULL, *string = NULL, *param1 = NULL, *name = NULL, *begin = NULL, *end = NULL, *type = NULL, *anode = NULL, *channelname = NULL, *ext = NULL, *afterevent = NULL, *repeat = NULL; int maxlen = 0, pos = 0, channelfind = 0; struct channel *channel1 = NULL; anode = ostrstr(param, "node="); if(anode != NULL) anode = anode + 5; name = ostrstr(param, "name="); if(name != NULL) name = name + 5; begin = ostrstr(param, "begin="); if(begin != NULL) begin = begin + 6; end = ostrstr(param, "end="); if(end != NULL) end = end + 4; type = ostrstr(param, "type="); if(type != NULL) type = type + 5; channelname = ostrstr(param, "channel="); if(channelname != NULL) channelname = channelname + 8; ext = ostrstr(param, "ext="); if(ext != NULL) ext = ext + 4; afterevent = ostrstr(param, "afterevent="); if(afterevent != NULL) afterevent = afterevent + 11; repeat = ostrstr(param, "repeat="); if(repeat != NULL) repeat = repeat + 7; param1 = ostrcat(param, NULL, 0, 0); string = param; while(string != NULL) { string = strchr(string, '&'); if(string != NULL) *string++ = '\0'; } ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, "


", &maxlen, &pos); if(anode != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(name != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(begin != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(end != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(type != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(ext != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(afterevent != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } if(repeat != NULL) { ostrcatbig(&buf, "", &maxlen, &pos); } ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "


 
", &maxlen, &pos); if(channelfind < 2) { free(buf); buf = NULL; buf = webrectimersend(param1, fmt); free(param1); param1 = NULL; } return buf; } char* webrectimersend(char* param, int fmt) { char* buf = NULL, *string = NULL, *name = NULL, *begin = NULL, *end = NULL, *type = NULL, *anode = NULL, *channelname = NULL, *sid = NULL, *tid = NULL, *ext = NULL, *afterevent = NULL, *repeat = NULL; int newnode = 0, channelfind = 0; struct rectimer *node = NULL; char* tmpstr = NULL; struct tm* loctime = NULL; struct channel *channel1 = NULL; anode = ostrstr(param, "node="); if(anode != NULL) anode = anode + 5; name = ostrstr(param, "name="); if(name != NULL) name = name + 5; begin = ostrstr(param, "begin="); if(begin != NULL) begin = begin + 6; end = ostrstr(param, "end="); if(end != NULL) end = end + 4; type = ostrstr(param, "type="); if(type != NULL) type = type + 5; channelname = ostrstr(param, "channel="); if(channelname != NULL) channelname = channelname + 8; sid = ostrstr(param, "sid="); if(sid != NULL) sid = sid + 4; tid = ostrstr(param, "tid="); if(tid != NULL) tid = tid + 4; ext = ostrstr(param, "ext="); if(ext != NULL) ext = ext + 4; afterevent = ostrstr(param, "afterevent="); if(afterevent != NULL) afterevent = afterevent + 11; repeat = ostrstr(param, "repeat="); if(repeat != NULL) repeat = repeat + 7; string = param; while(string != NULL) { string = strchr(string, '&'); if(string != NULL) *string++ = '\0'; } if((sid == NULL && tid != NULL) || (sid != NULL && tid == NULL)) { buf = ostrcat(buf, "ERROR: sid and tid required or only channel", 1, 0); return buf; } if(channelname != NULL && sid == NULL) { channelfind = 0; channel1 = channel; while(channel1 != NULL) { if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1)) { channelfind = 1; break; } channel1 = channel1->next; } if(channelfind == 0) { channel1 = channel; while(channel1 != NULL) { if(ostrstr(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1)) { channelfind = 1; break; } channel1 = channel1->next; } } if(channelfind == 0) { buf = ostrcat(buf, "ERROR: channel not found", 1, 0); return buf; } } newnode = 0; node = getrectimerbytimestamp(anode); if(node == NULL) { node = addrectimernode(NULL, NULL); if(node != NULL) { newnode = 1; node->pincode = ostrcat("0000", NULL, 0, 0); node->recpath = ostrcat(NULL, getconfig("rec_path", NULL), 0, 0); node->afterevent = 0; node->repeate = 0; } } if(node != NULL) { if(channelfind == 1 && channel1 != NULL) { node->serviceid = channel1->serviceid; node->servicetype = channel1->servicetype; node->transponderid = channel1->transponderid; } if(sid != NULL && tid != NULL) { node->serviceid = atoi(sid); node->transponderid = strtoull(tid, NULL, 10); node->servicetype = 0; } free(node->name); node->name = NULL; node->name = ostrcat(name, NULL, 0, 0); if(ostrcmp(type, "record") == 0) node->justplay = 0; else node->justplay = 1; if(afterevent != NULL) { if(ostrcmp(afterevent, "auto") == 0) node->afterevent = 0; else if(ostrcmp(afterevent, "nothing") == 0) node->afterevent = 1; else if(ostrcmp(afterevent, "standby") == 0) node->afterevent = 2; else if(ostrcmp(afterevent, "off") == 0) node->afterevent = 3; } if(repeat != NULL) node->repeate = atoi(repeat); loctime = olocaltime(&node->begin); if(loctime != NULL && begin != NULL) { tmpstr = strptime(begin, "%H:%M %d-%m-%Y", loctime); if(tmpstr != NULL) { loctime->tm_isdst = -1; node->begin = mktime(loctime); } } if(node->justplay == 0 && newnode == 1) node->begin -= getconfigint("recforerun" , NULL) * 60; node->begin -= (node->begin % 60); tmpstr = NULL; free(loctime); loctime = NULL; loctime = olocaltime(&node->end); if(loctime != NULL && end != NULL) { tmpstr = strptime(end, "%H:%M %d-%m-%Y", loctime); if(tmpstr != NULL) { loctime->tm_isdst = -1; node->end = mktime(loctime); } } if(node->justplay == 0 && newnode == 1) node->end += getconfigint("recoverrun" , NULL) * 60; node->end -= (node->end % 60); tmpstr = NULL; free(loctime); loctime = NULL; if(newnode == 1) node->disabled = 0; status.writerectimer = 1; writerectimer(getconfig("rectimerfile", NULL), 0); if(ext == NULL) buf = webgetrectimer(NULL, 0, fmt); else { buf = ostrcat(buf, "ok -> TimerID=", 1, 0); buf = ostrcat(buf, node->timestamp, 1, 0); } } else buf = ostrcat(buf, "Timer not ok", 1, 0); return buf; } char* webeditrectimer(char* param, int fmt) { char* buf = NULL, *buf1 = NULL, *buf2 = NULL; int maxlen = 0, pos = 0; struct rectimer *node = NULL; struct tm* loctime = NULL; node = getrectimerbytimestamp(param); if(node == NULL) return NULL; ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, "


", &maxlen, &pos); ostrcatbig(&buf, "timestamp, &maxlen, &pos); ostrcatbig(&buf, "\">", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); /*ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); */ /*ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); */ buf2 = malloc(20); loctime = olocaltime(&node->begin); if(loctime != NULL && buf2 != NULL) strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime); free(loctime); loctime = NULL; buf1 = ostrcat(buf2, NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(buf1); buf1 = NULL; loctime = olocaltime(&node->end); if(loctime != NULL && buf2 != NULL) strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime); free(loctime); loctime = NULL; buf1 = ostrcat(buf2, NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); free(buf1); buf1 = NULL; free(buf2); buf2 = NULL; ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
Name: name, &maxlen, &pos); ostrcatbig(&buf, "\" />
Type: 
Repeate: 
Repeate type: 
Begin: 
End: 
after event: 


 
", &maxlen, &pos); //ostrcatbig(&buf, param, &maxlen, &pos); return buf; } char* webdelrectimer(char* param, int fmt) { char* buf = NULL, *string = NULL, *timerid = NULL; struct rectimer *node = NULL; int ext = 0; timerid = ostrstr(param, "timerid="); if(timerid != NULL) { timerid = timerid + 8; ext = 1; } node = NULL; if(ext == 1) { string = param; while(string != NULL) { string = strchr(string, '&'); if(string != NULL) *string++ = '\0'; } node = getrectimerbytimestamp(timerid); } else node = getrectimerbytimestamp(param); if(node == NULL) { buf = ostrcat(buf, "ERROR: timer not found", 1, 0); return buf; } delrectimer(node, 1, 0); if(ext == 1) buf = ostrcat(buf, "ok -> timer deleted", 1, 0); else buf = webgetrectimer(NULL, 0, fmt); return buf; } void putxmessage(struct stimerthread* timernode, char* captiontime, char* body) { struct splitstr* ret1 = NULL; char* caption = NULL; int count1 = 0; int timeout = 5; ret1 = strsplit(captiontime, "\t", &count1); if(count1 >= 2) { caption = ostrcat(caption, (&ret1[0])->part, 1, 0); if((&ret1[1])->part != NULL) timeout = atoi((&ret1[1])->part); textbox(caption, body, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 280, timeout, 0); } free(caption); free(body); free(captiontime); free(ret1); } void xmessage(char* filename) { char* param=NULL, *param1 = NULL, *param2 = NULL, *param3 = NULL, *param4 = NULL; char* caption=NULL, *body=NULL; char* timeout=NULL; param4 = ostrstr(filename, "icon="); param3 = ostrstr(filename, "charset="); param2 = ostrstr(filename, "timeout="); param1 = ostrstr(filename, "caption="); param = ostrstr(filename, "body="); if(param4 != NULL) { param4 = param4 - 1; *param4 = '\0'; param4 = param4 + 5; *param4++ = '\0'; } if(param3 != NULL) { param3 = param3 - 1; *param3 = '\0'; param3 = param3 + 8; *param3++ = '\0'; } if(param2 != NULL) { param2 = param2 - 1; *param2 = '\0'; param2 = param2 + 8; *param2++ = '\0'; } if(param1 != NULL) { param1 = param1 - 1; *param1 = '\0'; param1 = param1 + 8; *param1++ = '\0'; } if(param != NULL) { param = param - 1; *param = '\0'; param = param + 5; *param++ = '\0'; body = ostrcat(body, param, 1, 0); } else body = ostrcat(body, " ", 1, 0); if(param2 != NULL) timeout = ostrcat(timeout, param2, 1, 0); else timeout = ostrcat(timeout, "5", 1, 0); if(param1 != NULL) caption = ostrcat(caption, param1, 1, 0); else caption = ostrcat(caption, "XMESSAGE", 1, 0); caption = ostrcat(caption, "\t", 1, 0); caption = ostrcat(caption, timeout, 1, 1); addtimer(&putxmessage, START, 1000, 1, (void*)caption, (void*)body, NULL); return; } char* webgetvol(int fmt) { char* buf = NULL; buf = oitoa(getvol()); return buf; } char* webgetrecsteampath(int fmt) { char* buf = NULL; if(getconfig("rec_streampath", NULL) == NULL) buf = ostrcat(buf, "/var/media/hdd/movie", 1, 0); else buf = ostrcat(buf, getconfig("rec_streampath", NULL), 1, 0); return buf; } char* webgetmute(int fmt) { char* buf = NULL; buf = oitoa(status.mute); return buf; } char* webgetrccodes(int fmt) { int i = 0; char* buf = NULL; struct clist* node = NULL; m_lock(&status.clistmutex, 12); struct clist **clist = rcconfig; for(i = 0; i < LISTHASHSIZE; i++) { node = clist[i]; while(node != NULL) { buf = ostrcat(buf, node->key, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->value, 1, 0); buf = ostrcat(buf, "\n", 1, 0); node = node->next; } } m_unlock(&status.clistmutex, 12); return buf; } char* webgetconfig(int fmt) { char* buf = NULL; struct clist *node = NULL; int i = 0; m_lock(&status.clistmutex, 12); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); } struct clist **clist = config; for(i = 0; i < LISTHASHSIZE; i++) { node = clist[i]; while(node != NULL) { if(node->tmp != NULL && strlen(node->tmp) > 0) { buf = ostrcat(buf, node->key, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->tmp, 1, 0); buf = ostrcat(buf, "\n", 1, 0); } else if(node->value != NULL) { buf = ostrcat(buf, node->key, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->value, 1, 0); buf = ostrcat(buf, "\n", 1, 0); } else { buf = ostrcat(buf, node->key, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, node->def, 1, 0); buf = ostrcat(buf, "\n", 1, 0); } node = node->next; } } buf = string_replace_all("\n", "
\n", buf, 1); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } m_unlock(&status.clistmutex, 12); return buf; } char* webgetsysteminfo(int fmt) { char* buf = NULL; char* imgversion = NULL; if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); } buf = ostrcat(buf, PROGNAME, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, COPYRIGHT, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, OVERSION, 1, 0); buf = ostrcat(buf, "#", 1, 0); if(isfile(getconfig("imagenamefile", NULL)) != 0) imgversion = readsys(getconfig("imagenamefile", NULL), 1); else imgversion = ostrcat("unknown", NULL, 0, 0); buf = ostrcat(buf, imgversion, 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, getboxtype(), 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, ollutoa(time(NULL)), 1, 1); buf = ostrcat(buf, "#", 1, 0); if(status.standby == 0) buf = ostrcat(buf, "0", 1, 0); else buf = ostrcat(buf, "1", 1, 0); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetchannellock(char* param, int fmt) { char* buf = NULL, *param1 = NULL; struct channel* chnode = NULL; if(param == NULL) return NULL; //create param1 param1 = strchr(param, '&'); if(param1 != NULL) *param1++ = '\0'; if(param1 == NULL) return NULL; chnode = getchannel(atoi(param), strtoull(param1, NULL, 10)); if(chnode != NULL) { buf = ostrcat(buf, chnode->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1); buf = ostrcat(buf, "#", 1, 0); if(channelnottunable(chnode) == 1) buf = ostrcat(buf, "1", 1, 0); else buf = ostrcat(buf, "0", 1, 0); } else buf = ostrcat("no data", NULL, 0, 0); return buf; } char* webgetbouquetepg(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL; char* param1 = NULL, *param2 = NULL, *param3 = NULL; struct mainbouquet *mbouquet = NULL; struct bouquet *node = NULL; struct channel* chnode = NULL; struct epg* epgnode = NULL; int longepg = 0; time_t start = 0, end = 0; if(param == NULL) return NULL; //create param1 + 2 + 3 param1 = strchr(param, '&'); if(param1 != NULL) { *param1++ = '\0'; param2 = strchr(param1, '&'); if(param2 != NULL) { *param2++ = '\0'; param3 = strchr(param2, '&'); if(param3 != NULL) *param3++ = '\0'; } } if(param1 == NULL || param2 == NULL || param3 == NULL) return NULL; longepg = atoi(param1); start = atoi(param2); end = atoi(param3); mbouquet = getmainbouquet(param); if(mbouquet != NULL) { node = mbouquet->bouquet; tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0); tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0); tmpstr1 = htmlencode(tmpstr); free(tmpstr); tmpstr = NULL; while(node != NULL) { chnode = getchannel(node->serviceid, node->transponderid); if(chnode != NULL) { buf = ostrcat(buf, "BeginNewChannel", 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, chnode->name, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(chnode->servicetype), 1, 1); buf = ostrcat(buf, "\n", 1, 0); epgnode = chnode->epg; while(epgnode != NULL) { if((epgnode->starttime >= start && epgnode->starttime < end) || (epgnode->endtime > start && epgnode->endtime <= end) || (epgnode->starttime < start && epgnode->endtime > end)) { buf = ostrcat(buf, epgnode->title, 1, 0); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1); buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, epgnode->subtitle, 1, 0); buf = ostrcat(buf, "#", 1, 0); if(longepg == 1) { tmpstr = epgdescunzip(epgnode); if(tmpstr != NULL) buf = ostrcat(buf, tmpstr, 1, 0); free(tmpstr); tmpstr = NULL; } buf = ostrcat(buf, "#", 1, 0); buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1); buf = ostrcat(buf, "\n", 1, 0); } epgnode = epgnode->next; } } node = node->next; } free(tmpstr1); tmpstr1 = NULL; } if(buf == NULL) buf = ostrcat("no data", NULL, 0, 0); return buf; } char* webadjust(char* param, int fmt) { printf("webadjust param: %s\n",param); printf("webadjust fmt: %d\n",fmt); char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *sendstr = NULL; int i = 0, max = 0, count = 0, maxlen = 0, pos = 0; ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); ostrcatbig(&buf, "


", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); // ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "
", &maxlen, &pos); /////////////////// // ostrcatbig(&buf, "", &maxlen, &pos); max = 10; ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, "volbartimeout.value", 1 , 0); /////////////////// // ostrcatbig(&buf, "", &maxlen, &pos); max = 10; ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", infobartimeout.value", 1 , 0); /////////////////// // ostrcatbig(&buf, "", &maxlen, &pos); max = 5; ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", infobarsleep.value", 1 , 0); /////////////////// // ostrcatbig(&buf, "", &maxlen, &pos); max = 5; tmpstr = ostrcat("1\n3\n9\n12\n15\n18\n21\n24\n27\n30", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", spinnerspeed.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// tmpstr = ostrcat("1\n2\n3\n4\n5\n6\n7\n8\n10000", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", spinnertime.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// tmpstr = ostrcat("5\n10\n15\n30\n60\n120\n10000", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", hangtime.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// // ostrcatbig(&buf, "", &maxlen, &pos); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", secondinfobar.value", 1 , 0); /////////////////// if(checkbox("ATEMIO7600") != 1) { ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", nozapclear.value", 1 , 0); } /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", fastzap.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", faststop.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", dirsort.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", poweraktion.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", virtualzap.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", fasttextrender.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", recsplitsize.value", 1 , 0); /////////////////// tmpstr = ostrcat("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", recforerun.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// tmpstr = ostrcat("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", recoverrun.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", skip13.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", skip46.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0); ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", skip79.value", 1 , 0); free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", playertype.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", autochangechannelname.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", def_rectimer_after.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", showchanneltimeline.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", screenanim.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", screenanimspeed.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", channellistview.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", showlastpos.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", recsync.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", recordnamefmt.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", newsletter.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", showhiddenfiles.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", expertmodus.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", infobarprogram.value", 1 , 0); /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", crosscontrol.value", 1 , 0); /////////////////// if(status.security == 1) { ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", emucontrol.value", 1 , 0); } /////////////////// ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", choiceminitv.value", 1 , 0); /////////////////// if(checkbox("ATEMIO510") == 1 || checkbox("UFS912") == 1 || checkbox("ATEMIO7600") == 1 || checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1) { ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", usecec.value", 1 , 0); } /////////////////// if(checkbox("ATEMIO7600") == 1) { ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", sataswitch.value", 1 , 0); } /////////////////// // ostrcatbig(&buf, "", &maxlen, &pos); max = 10; ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", playerbufferseektime.value", 1 , 0); /////////////////// if(checkbox("ATEMIO-NEMESIS") == 1 || checkbox("ATEMIO5200") == 1 || checkbox("ATEMIO6200") == 1) { ostrcatbig(&buf, "", &maxlen, &pos); sendstr = ostrcat(sendstr, ", dualboot.value", 1 , 0); } // ostrcatbig(&buf, "
Volbartimeout: 
", &maxlen, &pos); ostrcatbig(&buf, _("Volumebar Timeout"), &maxlen, &pos); ostrcatbig(&buf, " 
Infobartimeout: 
", &maxlen, &pos); ostrcatbig(&buf, _("Infobar Timeout"), &maxlen, &pos); ostrcatbig(&buf, " 
Infobar Sleep: 
", &maxlen, &pos); ostrcatbig(&buf, _("Infobar Sleep"), &maxlen, &pos); ostrcatbig(&buf, " 
Infobar Sleep: 
", &maxlen, &pos); ostrcatbig(&buf, _("Spinnerspeed"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Spinnertime"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Hangtime"), &maxlen, &pos); ostrcatbig(&buf, " 
Second Infobar: 
", &maxlen, &pos); ostrcatbig(&buf, _("Second Infobar"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Don't clear TV on zap (only with fastzap)"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Fastzap"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Faststop"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Dirsort"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Power aktion"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Virtualzap Timeout"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Fast Text Render"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Record Split Size"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Record Forerun (min)"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Record Overrun (min)"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Skip 1/3"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Skip 4/6"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Skip 7/9"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Player for .ts"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Change Channelname auto."), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Set action after rec"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Show Timeline in Channellist"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Animated Screens"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Animated Speed"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Channellist view"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Show last pos Question"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Resync Recording immediately"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Recording name"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Newsletter"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Show hidden files"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Expert Modus"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Show infobar on program change"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Use cross control for fast zapping and vol"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Deactivate Crypt Support on Media Playback"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Deactivate MiniTV"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Activate CEC"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("SATA Connector"), &maxlen, &pos); ostrcatbig(&buf, " 
Volbartimeout: 
", &maxlen, &pos); ostrcatbig(&buf, _("Time to wait after seek for fill buffer"), &maxlen, &pos); ostrcatbig(&buf, " 
", &maxlen, &pos); ostrcatbig(&buf, _("Dualboot Menu TitanNit / E2"), &maxlen, &pos); ostrcatbig(&buf, " 


 
", &maxlen, &pos); // ostrcatbig(&buf, "

 
", &maxlen, &pos); // sendstr verwenden ostrcatbig(&buf, "

 ", &maxlen, &pos); //writesys("/tmp/tmpstr", buf, 1); //ostrcatbig(&buf, param, &maxlen, &pos); return buf; } char* webadjustsend(char* param, int fmt) { debug(77, "fmt: %d param: %s",fmt , param); char* buf = NULL; char* tmpstr = NULL, *tmpstr1 = NULL; int count, count2, max, i; tmpstr = ostrcat(param, NULL, 0, 0); count = 0; struct splitstr* ret1 = NULL; ret1 = strsplit(tmpstr, "&", &count); max = count - 1; if(ret1 != NULL) { for(i = 0; i <= max; i++) { if(ostrcmp(ret1[i].part, "node=0") == 0 || ostrcmp(ret1[i].part, "send=Send") == 0) { debug(77, "skip: %s", ret1[i].part); continue; } tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); count2 = 0; struct splitstr* ret2 = NULL; ret2 = strsplit(tmpstr1, "=", &count2); if(ret2 != NULL && count2 > 1) { if(ret2[1].part != NULL && ostrcmp(ret2[0].part, "dualboot") == 0) { debug(77, "add %s: %s", ret2[0].part, ret2[1].part); if(ostrcmp(ret2[1].part, "0") == 0) { debug(77, "unlink /mnt/config/dualboot"); unlink("/mnt/config/dualboot"); } else { debug(77, "touch /mnt/config/dualboot"); system("touch /mnt/config/dualboot"); } } else if(ret2[1].part != NULL) { debug(77, "add %s: %s", ret2[0].part, ret2[1].part); addconfigtmp(ret2[0].part, ret2[1].part); } } free(ret2), ret2 = NULL; free(tmpstr1), tmpstr1 = NULL; } } free(ret1), ret1 = NULL; free(tmpstr), tmpstr = NULL; buf = webadjust(NULL, fmt); writeallconfig(1); return buf; } char* webgetparamvalue(char* param, char* searchparam) { char* buf = NULL; char* tmpstr = NULL; tmpstr = ostrcat(param, NULL, 0, 0); if(tmpstr != NULL) buf = ostrstr(tmpstr, searchparam); if(buf != NULL) buf = buf + strlen(searchparam); free(tmpstr); tmpstr = NULL; buf = stringreplacecharonce(buf, '&', '\0'); debug(77, "webgetparamvalue param: %s", param); debug(77, "webgetparamvalue search: %s", searchparam); debug(77, "webgetparamvalue value: %s", buf); return buf; } char* webgetcommand(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL; if(param == NULL) return NULL; if(status.security == 0) return NULL; // if(fmt == 0) // { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); // } debug(10, "cmd: %s", param); tmpstr = command(param); buf = ostrcat(buf, tmpstr, 1, 0); free(tmpstr), tmpstr = NULL; // if(fmt == 0) buf = ostrcat(buf, "", 1, 0); return buf; } char* webgethelp(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *helppath = NULL, *lang = NULL; if(param == NULL) return NULL; // if(fmt == 0) // { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, _(param), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); // } helppath = getconfig("helppath", NULL); if(helppath == NULL) return NULL; //get language lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0); lang = string_replace("po/", "", lang, 1); //create full filename tmpstr = ostrcat(helppath, "/", 0, 0); tmpstr = ostrcat(tmpstr, lang, 1, 1); tmpstr = ostrcat(tmpstr, "/", 1, 0); tmpstr = ostrcat(tmpstr, param, 1, 0); tmpstr = ostrcat(tmpstr, ".txt", 1, 0); debug(10, "file: %s", tmpstr); tmpstr1 = readfiletomem(tmpstr, 1); buf = ostrcat(buf, _(tmpstr1), 1, 0); // segfault ?? // free(helppath), helppath = NULL; free(tmpstr), tmpstr = NULL; free(tmpstr1), tmpstr1 = NULL; // if(fmt == 0) buf = ostrcat(buf, "", 1, 0); return buf; } char* webgethelpchoices(int fmt) { char* buf = NULL, *tmpstr = NULL, *helppath = NULL, *lang = NULL, *cmd = NULL; // if(fmt == 0) // { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); // } helppath = getconfig("helppath", NULL); if(helppath == NULL) return NULL; //get language lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0); lang = string_replace("po/", "", lang, 1); //create full filename cmd = ostrcat("ls -1 ", helppath, 0, 0); cmd = ostrcat(cmd, "/", 1, 0); cmd = ostrcat(cmd, lang, 1, 1); cmd = ostrcat(cmd, "/", 1, 0); debug(10, "cmd: %s", cmd); tmpstr = command(cmd); int count, i, max; count = 0; struct splitstr* ret1 = NULL; ret1 = strsplit(tmpstr, "\n", &count); max = count - 1; buf = ostrcat(buf, "
", 1, 0); if(ret1 != NULL) { for(i = 0; i <= max; i++) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "

", 1, 0); } } // segfault ?? // free(helppath), helppath = NULL; free(tmpstr), tmpstr = NULL; free(ret1), ret1 = NULL; // if(fmt == 0) buf = ostrcat(buf, "
", 1, 0); return buf; } char* webgettestpage(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL; if(param == NULL) return NULL; if(status.security == 0) return NULL; // if(fmt == 0) // { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); // } debug(10, "file: %s", param); tmpstr = readfiletomem(param, 1); buf = ostrcat(buf, tmpstr, 1, 0); free(tmpstr), tmpstr = NULL; // if(fmt == 0) buf = ostrcat(buf, "", 1, 0); debug(10, "buf: %s", buf); return buf; } char* webgetsysteminfos(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL; int mode; mode = atoi(param); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); if(mode == 0) buf = ostrcat(buf, _("System Status"), 1, 0); else if(mode == 1) buf = ostrcat(buf, _("Free Space"), 1, 0); else if(mode == 2) buf = ostrcat(buf, _("Kernel"), 1, 0); else if(mode == 3) buf = ostrcat(buf, _("Mounts"), 1, 0); else if(mode == 4) buf = ostrcat(buf, _("Network"), 1, 0); else if(mode == 5) buf = ostrcat(buf, _("Ram"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } tmpstr = system_infos(mode); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 0); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetsysinfos(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL; int mode; mode = atoi(param); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); if(mode == 0) buf = ostrcat(buf, _("CPU"), 1, 0); else if(mode == 1) buf = ostrcat(buf, _("Memory"), 1, 0); else if(mode == 2) buf = ostrcat(buf, _("MTD"), 1, 0); else if(mode == 3) buf = ostrcat(buf, _("Module"), 1, 0); else if(mode == 4) buf = ostrcat(buf, _("Devices"), 1, 0); else if(mode == 5) buf = ostrcat(buf, _("Swap"), 1, 0); else if(mode == 6) buf = ostrcat(buf, _("Top"), 1, 0); else if(mode == 7) buf = ostrcat(buf, _("Prozesslist"), 1, 0); else if(mode == 8) buf = ostrcat(buf, _("USB"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } tmpstr = system_infos_sysinfo(mode); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 0); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetlogs(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL; int mode; mode = atoi(param); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); if(mode == 0) buf = ostrcat(buf, _("Hotline"), 1, 0); else if(mode == 1) buf = ostrcat(buf, _("Svn Changelog"), 1, 0); else if(mode == 2) buf = ostrcat(buf, _("Git Changelog"), 1, 0); else if(mode == 3) buf = ostrcat(buf, _("titan Log"), 1, 0); else if(mode == 4) buf = ostrcat(buf, _("Svn Changelog Full"), 1, 0); else if(mode == 5) buf = ostrcat(buf, _("Git Changelog Full"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } tmpstr = system_logs(mode); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 0); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetabout(int fmt) { char* buf = NULL, *tmpstr = NULL; if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, _("About"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } tmpstr = getabout(); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 1); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetserviceinfo(int fmt) { char* buf = NULL, *tmpstr = NULL; if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, _("Service"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } // tmpstr = getabout(); // readnewsletter(); tmpstr = readfiletomem("/tmp/Service.txt", 0); tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 1); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetstreaming(int fmt) { char* buf = NULL, *tmpstr = NULL; if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, _("Streaming"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } // tmpstr = getabout(); // readnewsletter(); tmpstr = readfiletomem("/tmp/streaming.txt", 0); tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 1); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } char* webgetnewsletterchoices(int fmt) { char* buf = NULL, *tmpstr = NULL; if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, _("Newsletter"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } buf = ostrcat(buf, "
", 1, 0); struct skin* tmp = NULL; struct newsletter* node = NULL; char* tmpstr = NULL; m_lock(&status.newslettermutex, 19); long unsigned lastnewsletter = getconfiglu("lastnewsletter", NULL); readnewsletter(); node = newsletter; while(node != NULL) { tmp = addlistbox(skinnewsletter, listbox, tmp, 1); if(tmp != NULL) { buf = ostrcat(buf, "nr, 1, 0); buf = ostrcat(buf, " target=main>", 1, 0); buf = ostrcat(buf, node->title, 1, 0); buf = ostrcat(buf, " - ", 1, 0); buf = ostrcat(buf, node->date, 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "

", 1, 0); tmp->del = 1; tmp->handle = (char*)node; } if(node->nr > lastnewsletter) addconfiglu("lastnewsletter", node->nr); node = node->next; } if(fmt == 0) buf = ostrcat(buf, "
", 1, 0); return buf; } char* webgetnewsletter(char* param, int fmt) { char* buf = NULL, *tmpstr = NULL; if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "", 1, 0); buf = ostrcat(buf, "
", 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, _("param"), 1, 0); buf = ostrcat(buf, "

", 1, 0); buf = ostrcat(buf, "
", 1, 0); } // tmpstr = getabout(); // readnewsletter(); tmpstr = readfiletomem("/tmp/streaming.txt", 0); tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0); tmpstr = string_replace_all("\n", "
\n", tmpstr, 1); buf = ostrcat(buf, tmpstr, 1, 1); if(fmt == 0) { buf = ostrcat(buf, "", 1, 0); } return buf; } #endif