source: titan/titan/httpdfunc.h @ 30028

Last change on this file since 30028 was 30028, checked in by obi, 10 years ago

webif add help screen

File size: 156.1 KB
Line 
1#ifndef HTTPDFUNC_H
2#define HTTPDFUNC_H
3
4time_t webcreatetimeline(char** buf, int* maxlen, int* pos)
5{
6        int i = 0;
7        struct tm *loctime = NULL;
8        int timeadd = 15 * 60;
9        char* buf1 = NULL;
10        time_t akttimeadd = 0;
11
12#ifdef SIMULATE
13        time_t akttime = 1307871000;
14        akttime = 1315614961;
15#else
16        time_t akttime = time(NULL);
17#endif
18
19        akttime -= (((akttime) % 100));
20        akttime -= (((akttime / 60) % 15) * 60);
21        akttimeadd = akttime;
22
23        buf1 = malloc(6);
24        if(buf1 == NULL)
25        {
26                err("no mem");
27                return akttime;
28        }
29
30        //not shown
31        ostrcatbig(buf, "<th class=gepgchannel1> </th><th style=\"width: 1px; max-width: 1px; min-width: 1px;\"></th>", maxlen, pos);
32        for(i = 0; i < 96; i++)
33        {
34                loctime = olocaltime(&akttimeadd);
35                if(loctime != NULL)
36                        strftime(buf1, 6, "%H:%M", loctime);
37                else
38                        snprintf(buf1, 6, "00:00");
39                free(loctime); loctime = NULL;
40
41                ostrcatbig(buf, "<th class=gepgtimelinecell><div class=gepgcellborder>", maxlen, pos);
42                ostrcatbig(buf, buf1, maxlen, pos);
43                ostrcatbig(buf, "</div></th>", maxlen, pos);
44
45                akttimeadd += timeadd;
46        }
47
48        free(buf1);
49        return akttime / 60;
50}
51
52void webcreatetailbig(char** buf, int* maxlen, int* pos, int flag)
53{
54        ostrcatbig(buf, "</table></font></center></body></html>", maxlen, pos);
55}
56
57
58char* webcreatetail(char* buf, int flag)
59{
60        buf = ostrcat(buf, "</table></font></center></body></html>", 1, 0);
61        return buf;
62}
63
64void webcreateheadbig(char** buf, int* maxlen, char* meta, int* pos, int flag)
65{
66        ostrcatbig(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css>", maxlen, pos);
67        if(meta != NULL)
68                ostrcatbig(buf, meta, maxlen, pos);
69        ostrcatbig(buf, "</head><body class=body>", maxlen, pos);
70        if(flag == 0)
71                ostrcatbig(buf, "<center><table border=0 width=100%>", maxlen, pos);
72        else
73                ostrcatbig(buf, "<center><table border=0 width=100% height=100%>", maxlen, pos);
74}
75
76char* webcreatehead(char* buf, char* meta, int flag)
77{
78        buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css>", 1, 0);
79        if(meta != NULL)
80                buf = ostrcat(buf, meta, 1, 0);
81        buf = ostrcat(buf, "</head><body class=body>", 1, 0);
82        if(flag == 0)
83                buf = ostrcat(buf, "<center><table border=0 width=100%>", 1, 0);
84        else
85                buf = ostrcat(buf, "<center><table border=0 width=100% height=100%>", 1, 0);
86        return buf;
87}
88
89void webcreatechannelbody(char** buf, int line, struct channel* chnode, char* channellist, int* maxlen, int* pos, int flag, int fmt)
90{
91        char* tmpstr = NULL, *buf1 = NULL, *serviceid = NULL, *transponderid = NULL;
92        struct epg* epgnode = getepgakt(chnode);
93        int ret = 0, proz = 0;
94        struct tm *loctime = NULL;
95        time_t max = 0, akt = 0;
96
97        if(chnode == NULL) return;
98        ret = channelnottunable(chnode);
99
100        buf1 = malloc(MINMALLOC);
101        if(buf1 == NULL)
102        {
103                err("no mem");
104                return;
105        }
106
107        if(fmt == 0)
108        {
109                if(line == 0)
110                        ostrcatbig(buf, "<tr class=line1>", maxlen, pos);
111                else
112                        ostrcatbig(buf, "<tr class=line2>", maxlen, pos);
113        }
114
115        if(epgnode != NULL)
116        {
117                proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime);
118                if(proz > 100) proz = 100;
119                if(proz < 0) proz = 0;
120        }
121
122        if(fmt == 0)
123        {
124                ostrcatbig(buf, "<td width=100% valign=middle nowrap class=link><div class=timelineborder><div class=timelinebar style=\"width: ", maxlen, pos);
125                tmpstr = oitoa(proz);
126                ostrcatbig(buf, tmpstr, maxlen, pos);
127                free(tmpstr); tmpstr = NULL;
128                ostrcatbig(buf, "%;\"> </div></div>", maxlen, pos);
129        }
130
131        serviceid = oitoa(chnode->serviceid);
132        transponderid = ollutoa(chnode->transponderid);
133
134        if(fmt == 0 && ret == 0)
135        {
136                ostrcatbig(buf, "<a target=aktservice class=link href=query?switch&", maxlen, pos);
137                ostrcatbig(buf, serviceid, maxlen, pos);
138                ostrcatbig(buf, "&", maxlen, pos);
139                ostrcatbig(buf, transponderid, maxlen, pos);
140                ostrcatbig(buf, "&", maxlen, pos);
141                ostrcatbig(buf, channellist, maxlen, pos);
142                ostrcatbig(buf, ">", maxlen, pos);
143        }
144
145        if(fmt == 0)
146        {
147                ostrcatbig(buf, chnode->name, maxlen, pos);
148                if(ret == 0)
149                        ostrcatbig(buf, "</a>", maxlen, pos);
150        }
151        else
152        {
153                *buf = ostrcat(*buf, chnode->name, 1, 0);
154                *buf = ostrcat(*buf, "#", 1, 0);
155                *buf = ostrcat(*buf, oitoa(proz), 1, 1);
156                *buf = ostrcat(*buf, "#", 1, 0);
157                *buf = ostrcat(*buf, serviceid, 1, 0);
158                *buf = ostrcat(*buf, "#", 1, 0);
159                *buf = ostrcat(*buf, transponderid, 1, 0);
160                *buf = ostrcat(*buf, "#", 1, 0);
161                *buf = ostrcat(*buf, channellist, 1, 0);
162                *buf = ostrcat(*buf, "#", 1, 0);
163                *buf = ostrcat(*buf, oitoa(chnode->servicetype), 1, 1);
164                *buf = ostrcat(*buf, "#", 1, 0);
165                if(epgnode != NULL)
166                {
167                        *buf = ostrcat(*buf, oitoa(epgnode->eventid), 1, 1);
168                        *buf = ostrcat(*buf, "#", 1, 0);
169                        *buf = ostrcat(*buf, olutoa(epgnode->starttime), 1, 1);
170                        *buf = ostrcat(*buf, "#", 1, 0);
171                        *buf = ostrcat(*buf, epgnode->title, 1, 0);
172                        *buf = ostrcat(*buf, "#", 1, 0);
173                        if(epgnode->next != NULL)
174                        {
175                                *buf = ostrcat(*buf, olutoa(epgnode->next->starttime), 1, 1);
176                                *buf = ostrcat(*buf, "#", 1, 0);
177                                *buf = ostrcat(*buf, olutoa(epgnode->next->endtime), 1, 1);
178                                *buf = ostrcat(*buf, "#", 1, 0);
179                                *buf = ostrcat(*buf, epgnode->next->title, 1, 0);
180                                *buf = ostrcat(*buf, "#", 1, 0);
181                                *buf = ostrcat(*buf, oitoa(epgnode->next->eventid), 1, 1);
182                        }
183                        else
184                        {
185                                *buf = ostrcat(*buf, olutoa(epgnode->endtime), 1, 1);
186                                *buf = ostrcat(*buf, "#", 1, 0);
187                                *buf = ostrcat(*buf, "#", 1, 0);
188                                *buf = ostrcat(*buf, "#", 1, 0);
189                                *buf = ostrcat(*buf, "0", 1, 0);
190                        }
191                }
192                else
193                {
194                        *buf = ostrcat(*buf, "0", 1, 0);
195                        *buf = ostrcat(*buf, "#", 1, 0);
196                        *buf = ostrcat(*buf, "#", 1, 0);
197                        *buf = ostrcat(*buf, "#", 1, 0);
198                        *buf = ostrcat(*buf, "#", 1, 0);
199                        *buf = ostrcat(*buf, "#", 1, 0);
200                        *buf = ostrcat(*buf, "#", 1, 0);
201                        *buf = ostrcat(*buf, "0", 1, 0);
202                }
203                *buf = ostrcat(*buf, "#", 1, 0);
204
205                if(ret == 1)
206                        *buf = ostrcat(*buf, "1", 1, 0);
207                else
208                        *buf = ostrcat(*buf, "0", 1, 0);
209
210                *buf = ostrcat(*buf, "\n", 1, 0);
211        }
212
213        //akt epg
214        if(fmt == 0 && epgnode != NULL)
215        {
216                if(flag == 0)
217                        ostrcatbig(buf, "<br><a target=main class=smalllink href=query?getepg&", maxlen, pos);
218                else
219                        ostrcatbig(buf, " <a target=main class=smalllink href=query?getepg&", maxlen, pos);
220
221                ostrcatbig(buf, serviceid, maxlen, pos);
222                ostrcatbig(buf, "&", maxlen, pos);
223                ostrcatbig(buf, transponderid, maxlen, pos);
224                ostrcatbig(buf, "&", maxlen, pos);
225                tmpstr = oitoa(epgnode->eventid);
226                ostrcatbig(buf, tmpstr, maxlen, pos);
227                free(tmpstr); tmpstr = NULL;
228                ostrcatbig(buf, ">", maxlen, pos);
229
230                loctime = olocaltime(&epgnode->starttime);
231                if(loctime != NULL)
232                        strftime(buf1, MINMALLOC, "%H:%M -", loctime);
233                free(loctime); loctime = NULL;
234                loctime = olocaltime(&epgnode->endtime);
235                if(loctime != NULL)
236                        strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
237                free(loctime); loctime = NULL;
238
239                ostrcatbig(buf, buf1, maxlen, pos);
240                ostrcatbig(buf, epgnode->title, maxlen, pos);
241
242                max = (epgnode->endtime - epgnode->starttime) / 60;
243                akt = (time(NULL) - epgnode->starttime) / 60;
244                if(max < 0) max = 0;
245                if(akt < 0) akt = 0;
246                snprintf(buf1, MINMALLOC, " (%ld from %ld min, %d%%)", akt, max, proz);
247                ostrcatbig(buf, buf1, maxlen, pos);
248
249                ostrcatbig(buf, "</a>", maxlen, pos);
250
251                //next epg
252                epgnode = epgnode->next;
253                if(flag == 0 && epgnode != NULL)
254                {
255                        ostrcatbig(buf, "<br><a target=main class=smalllink href=query?getepg&", maxlen, pos);
256                        ostrcatbig(buf, serviceid, maxlen, pos);
257                        ostrcatbig(buf, "&", maxlen, pos);
258                        ostrcatbig(buf, transponderid, maxlen, pos);
259                        ostrcatbig(buf, "&", maxlen, pos);
260                        tmpstr = oitoa(epgnode->eventid);
261                        ostrcatbig(buf, tmpstr, maxlen, pos);
262                        free(tmpstr); tmpstr = NULL;
263                        ostrcatbig(buf, ">", maxlen, pos);
264
265                        loctime = olocaltime(&epgnode->starttime);
266                        if(loctime != NULL)
267                                strftime(buf1, 8, "%H:%M -", loctime);
268                        free(loctime); loctime = NULL;
269                        loctime = olocaltime(&epgnode->endtime);
270                        if(loctime != NULL)
271                                strftime(&buf1[7], 8, " %H:%M ", loctime);
272                        free(loctime); loctime = NULL;
273
274                        ostrcatbig(buf, buf1, maxlen, pos);
275                        ostrcatbig(buf, epgnode->title, maxlen, pos);
276                        ostrcatbig(buf, "</a>", maxlen, pos);
277                }
278        }
279
280        //tv - radio
281        if(fmt == 0)
282        {
283                if(chnode->servicetype == 0)
284                        ostrcatbig(buf, "</td><td width=100 align=right valign=middle nowrap><img style=\"margin-left: 5\" border=0 src=img/tv.png alt=TV width=16 height=16>", maxlen, pos);
285                else
286                        ostrcatbig(buf, "</td><td width=100 align=right valign=middle nowrap><img style=\"margin-left: 5\" border=0 src=img/radio.png alt=Radio width=16 height=16>", maxlen, pos);
287
288                //single epg
289                ostrcatbig(buf, "<a target=main href=query?getsingleepg&", maxlen, pos);
290                ostrcatbig(buf, serviceid, maxlen, pos);
291                ostrcatbig(buf, "&", maxlen, pos);
292                ostrcatbig(buf, transponderid, maxlen, pos);
293                ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/singleepg.png alt=\"Single EPG\" width=16 height=16></a>", maxlen, pos);
294
295                //m3u stream + webstream
296                if(ret == 0)
297                {
298                        ostrcatbig(buf, "<a target=nothing href=query?getm3u&", maxlen, pos);
299                        ostrcatbig(buf, serviceid, maxlen, pos);
300                        ostrcatbig(buf, ",", maxlen, pos);
301                        ostrcatbig(buf, transponderid, maxlen, pos);
302                        ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/stream.png alt=Stream width=16 height=16></a>", maxlen, pos);
303
304                        ostrcatbig(buf, "<a target=_blank href=query?getvideo&", maxlen, pos);
305                        ostrcatbig(buf, serviceid, maxlen, pos);
306                        ostrcatbig(buf, ",", maxlen, pos);
307                        ostrcatbig(buf, transponderid, maxlen, pos);
308                        ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/webstream.png alt=WebStream width=16 height=16></a>", maxlen, pos);
309                }
310                else
311                        ostrcatbig(buf, "<img style=\"margin-left: 5\" border=0 src=img/cross.png alt=\"Channel not availabel\" width=16 height=16>", maxlen, pos);
312                ostrcatbig(buf, "</td></tr>", maxlen, pos);
313        }
314
315        free(buf1);
316        free(serviceid);
317        free(transponderid);
318}
319
320char* webgetbouquetchannel(char* param, int fmt)
321{
322        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
323        struct mainbouquet *mbouquet = NULL;
324        struct bouquet *node = NULL;
325        struct channel* chnode = NULL;
326        int line = 0, maxlen = 0, pos = 0;
327
328        if(param == NULL) return NULL;
329
330        if(fmt == 0) webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=60>", &pos, 0);
331
332        mbouquet = getmainbouquet(param);
333        if(mbouquet != NULL)
334        {
335                node = mbouquet->bouquet;
336                tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
337                tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
338                tmpstr1 = htmlencode(tmpstr);
339                free(tmpstr); tmpstr = NULL;
340                while(node != NULL)
341                {
342                        chnode = getchannel(node->serviceid, node->transponderid);
343                        if(chnode != NULL)
344                        {
345                                webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt);
346                                if(line == 0)
347                                        line = 1;
348                                else
349                                        line = 0;
350                        }
351                        node = node->next;
352                }
353                free(tmpstr1); tmpstr1 = NULL;
354        }
355        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
356
357        return buf;
358}
359
360//flag 0: all
361//flag 1: sat
362//flag 2: provider
363//flag 3: A-Z
364char* webgetchannel(int param, int flag, int page, int fmt)
365{
366        char* buf = NULL, *tmpnr = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
367        struct channel* chnode = channel;
368        int line = 0, maxcount = 0, maxlen = 0, pos = 0;
369
370        if(fmt == 0) webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=60>", &pos, 0);
371
372        if(flag == 0) tmpstr1 = ostrcat(tmpstr1, "(ALL)", 1, 0);
373        if(flag == 1)
374        {
375                struct sat* node = getsatbyorbitalpos(param);
376                if(node != NULL)
377                {
378                        tmpstr = ostrcat(tmpstr, "(SAT)-", 1, 0);
379                        tmpstr = ostrcat(tmpstr, node->name, 1, 0);
380                        tmpstr1 = htmlencode(tmpstr);
381                        free(tmpstr); tmpstr = NULL;
382                }
383        }
384        if(flag == 2)
385        {
386                struct provider* node = getprovider(param);
387                if(node != NULL)
388                {
389                        tmpstr = ostrcat(tmpstr, "(PROVIDER)-", 1, 0);
390                        tmpstr = ostrcat(tmpstr, node->name, 1, 0);
391                        tmpstr1 = htmlencode(tmpstr);
392                        free(tmpstr); tmpstr = NULL;
393                }
394        }
395        if(flag == 3)
396        {
397                tmpstr = malloc(2);
398                if(tmpstr != NULL)
399                        snprintf(tmpstr, 2, "%c", param);
400                tmpstr = ostrcat("(A-Z)-", tmpstr, 0, 1);
401                tmpstr1 = htmlencode(tmpstr);
402                free(tmpstr); tmpstr = NULL;
403        }
404
405        while(chnode != NULL)
406        {
407                if(chnode->transponder == NULL)
408                {
409                        chnode = chnode->next;
410                        continue;
411                }
412                if(chnode->name == NULL)
413                {
414                        chnode = chnode->next;
415                        continue;
416                }
417                if(flag == 1 && chnode->transponder->orbitalpos != param)
418                {
419                        chnode = chnode->next;
420                        continue;
421                }
422                if(flag == 2 && chnode->providerid != param)
423                {
424                        chnode = chnode->next;
425                        continue;
426                }
427                if(flag == 3 && chnode->name[0] != param && chnode->name[0] != param + 32)
428                {
429                        chnode = chnode->next;
430                        continue;
431                }
432
433                maxcount++;
434                if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
435                {
436                        chnode = chnode->next;
437                        continue;
438                }
439                webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt);
440
441                if(line == 0)
442                        line = 1;
443                else
444                        line = 0;
445
446                chnode = chnode->next;
447        }
448        free(tmpstr); tmpstr = NULL;
449
450        if(fmt == 0 && maxcount > MAXHTMLLINE)
451        {
452                int i;
453                ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
454                for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
455                {
456                        if(page == i)
457                                ostrcatbig(&buf, "<a class=pagesellink href=query?getchannelpage&", &maxlen, &pos);
458                        else
459                                ostrcatbig(&buf, "<a class=pagelink href=query?getchannelpage&", &maxlen, &pos);
460                        tmpnr = oitoa(param);
461                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
462                        ostrcatbig(&buf, "&", &maxlen, &pos);
463                        free(tmpnr); tmpnr = NULL;
464                        tmpnr = oitoa(flag);
465                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
466                        ostrcatbig(&buf, "&", &maxlen, &pos);
467                        free(tmpnr); tmpnr = NULL;
468
469                        tmpnr = oitoa(i);
470                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
471                        ostrcatbig(&buf, ">", &maxlen, &pos);
472                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
473                        ostrcatbig(&buf, "</a>", &maxlen, &pos);
474                        free(tmpnr); tmpnr = NULL;
475                }
476                ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
477        }
478
479        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
480        return buf;
481}
482
483char* webgetprovider(int fmt)
484{
485        char* buf = NULL, *tmpstr = NULL;
486        struct provider* node = provider;
487        int line = 0, maxlen = 0, pos = 0;
488
489        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
490
491        while(node != NULL)
492        {
493                if(fmt == 0)
494                {
495                        if(line == 0)
496                        {
497                                ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
498                                tmpstr = oitoa(node->providerid);
499                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
500                                free(tmpstr); tmpstr = NULL;
501                                ostrcatbig(&buf, "\">", &maxlen, &pos);
502                                line = 1;
503                        }
504                        else
505                        {
506                                ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
507                                tmpstr = oitoa(node->providerid);
508                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
509                                free(tmpstr); tmpstr = NULL;
510                                ostrcatbig(&buf, "\">", &maxlen, &pos);
511                                line = 0;
512                        }
513                        ostrcatbig(&buf, node->name, &maxlen, &pos);
514                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
515                }
516                else
517                {
518                        buf = ostrcat(buf, node->name, 1, 0);
519                        buf = ostrcat(buf, "#", 1, 0);
520                        buf = ostrcat(buf, oitoa(node->providerid), 1, 1);
521                        buf = ostrcat(buf, "\n", 1, 0);
522                }
523
524                node = node->next;
525        }
526
527        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
528        return buf;
529}
530
531char* webgetsat(int fmt)
532{
533        char* buf = NULL, *tmpstr = NULL;
534        struct sat* node = sat;
535        int line = 0, maxlen = 0, pos = 0;
536
537        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
538
539        while(node != NULL)
540        {
541                if(fmt == 0)
542                {
543                        if(line == 0)
544                        {
545                                ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
546                                tmpstr = oitoa(node->orbitalpos);
547                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
548                                free(tmpstr); tmpstr = NULL;
549                                ostrcatbig(&buf, "\">", &maxlen, &pos);
550                                line = 1;
551                        }
552                        else
553                        {
554                                ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
555                                tmpstr = oitoa(node->orbitalpos);
556                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
557                                free(tmpstr); tmpstr = NULL;
558                                ostrcatbig(&buf, "\">", &maxlen, &pos);
559                                line = 0;
560                        }
561                        ostrcatbig(&buf, node->name, &maxlen, &pos);
562                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
563                }
564                else
565                {
566                        buf = ostrcat(buf, node->name, 1, 0);
567                        buf = ostrcat(buf, "#", 1, 0);
568                        buf = ostrcat(buf, oitoa(node->orbitalpos), 1, 1);
569                        buf = ostrcat(buf, "\n", 1, 0);
570                }
571
572                node = node->next;
573        }
574
575        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
576        return buf;
577}
578
579char* webgetaz(int fmt)
580{
581        char* buf = NULL, *tmpstr = NULL, *tmpnr = NULL;
582        int line = 0, maxlen = 0, pos = 0, i;
583
584        tmpstr = malloc(2);
585        if(tmpstr == NULL)
586        {
587                err("no memory");
588                return NULL;
589        }
590
591        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
592
593        for(i = 65; i < 91; i++)
594        {
595                if(fmt == 0)
596                {
597                        if(line == 0)
598                        {
599                                ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
600                                tmpnr = oitoa(i);
601                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
602                                free(tmpnr); tmpnr = NULL;
603                                ostrcatbig(&buf, "\">", &maxlen, &pos);
604                                line = 1;
605                        }
606                        else
607                        {
608                                ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
609                                tmpnr = oitoa(i);
610                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
611                                free(tmpnr); tmpnr = NULL;
612                                ostrcatbig(&buf, "\">", &maxlen, &pos);
613                                line = 0;
614                        }
615                        snprintf(tmpstr, 2, "%c", i);
616                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
617                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
618                }
619                else
620                {
621                        snprintf(tmpstr, 2, "%c", i);
622                        buf = ostrcat(buf, tmpstr, 1, 0);
623                        buf = ostrcat(buf, "\n", 1, 0);
624                }
625        }
626
627        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
628        free(tmpstr);
629        return buf;
630}
631
632char* webgetbouquet(int fmt)
633{
634        char* buf = NULL;
635        struct mainbouquet* node = mainbouquet;
636        int line = 0, maxlen = 0, pos = 0;
637
638        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
639
640        while(node != NULL)
641        {
642                if(fmt == 0)
643                {
644                        if(line == 0)
645                        {
646                                ostrcatbig(&buf, "<tr class=line1><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
647                                ostrcatbig(&buf, node->name, &maxlen, &pos);
648                                ostrcatbig(&buf, "\">", &maxlen, &pos);
649                                line = 1;
650                        }
651                        else
652                        {
653                                ostrcatbig(&buf, "<tr class=line2><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
654                                ostrcatbig(&buf, node->name, &maxlen, &pos);
655                                ostrcatbig(&buf, "\">", &maxlen, &pos);
656                                line = 0;
657                        }
658                        ostrcatbig(&buf, node->name, &maxlen, &pos);
659                        ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
660
661                        ostrcatbig(&buf, "<td width=50 nowrap align=right valign=middle><img style=\"margin-left: 5\" border=0 src=", &maxlen, &pos);
662
663                        if(node->type == 0)
664                                ostrcatbig(&buf, "img/tv.png width=16 height=16 alt=TV>", &maxlen, &pos);
665                        else
666                                ostrcatbig(&buf, "img/radio.png width=16 height=16 alt=Radio>", &maxlen, &pos);
667                        ostrcatbig(&buf, "<a href=\"query?getgmultiepg&", &maxlen, &pos);
668                        ostrcatbig(&buf, node->name, &maxlen, &pos);
669                        ostrcatbig(&buf, "\">", &maxlen, &pos);
670                        ostrcatbig(&buf, "<img style=\"margin-left: 5\" border=0 width=16 height=16 alt=\"Graphical Multi EPG\" src=img/gmultiepg.png></a>", &maxlen, &pos);
671                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
672                }
673                else
674                {
675                        buf = ostrcat(buf, node->name, 1, 0);
676                        buf = ostrcat(buf, "#", 1, 0);
677                        buf = ostrcat(buf, oitoa(node->type), 1, 1);
678                        buf = ostrcat(buf, "\n", 1, 0);
679                }
680
681                node = node->next;
682        }
683
684        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
685        return buf;
686}
687
688char* websetmute(char* param, int fmt)
689{
690        char* buf = NULL;
691        int mute = status.mute;
692
693        if(param != NULL)
694                mute = atoi(param);
695
696        if(fmt == 0)
697        {
698                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css></head><body class=body><center>", 1, 0);
699                if(mute == 0)
700                        buf = ostrcat(buf, "<a href=query?setmute&1><img src=img/speak_on.png border=0 alt=\"Mute on\"></img></a>", 1, 0);
701                else
702                        buf = ostrcat(buf, "<a href=query?setmute&0><img src=img/speak_off.png border=0 alt=\"Mute off\"></img></a>", 1, 0);
703                buf = ostrcat(buf, "</center></body></html>", 1, 0);
704        }
705        else
706        {
707                if(mute == 0)
708                        buf = ostrcat(buf, "0", 1, 0);
709                else
710                        buf = ostrcat(buf, "1", 1, 0);
711        }
712
713        if(mute != status.mute)
714                screenmute(NULL, NULL, 0);
715       
716        return buf;
717}
718
719char* websetvol(char* param, int fmt)
720{
721        char* buf = NULL;
722        int vol = 30;
723
724        if(param == NULL)
725                vol = getvol();
726        else
727                vol = atoi(param);
728
729        if(fmt == 0)
730        {
731                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css></head><body class=body><center>", 1, 0);
732                if(vol >=10)
733                        buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_on.png border=0></img></a> ", 1, 0);
734                else
735                        buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_off.png border=0></img></a> ", 1, 0);
736                if(vol >=20)
737                        buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_on.png border=0></img></a> ", 1, 0);
738                else
739                        buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_off.png border=0></img></a> ", 1, 0);
740                if(vol >=30)
741                        buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_on.png border=0></img></a> ", 1, 0);
742                else
743                        buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_off.png border=0></img></a> ", 1, 0);
744                if(vol >=40)
745                        buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_on.png border=0></img></a> ", 1, 0);
746                else
747                        buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_off.png border=0></img></a> ", 1, 0);
748                if(vol >=50)
749                        buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_on.png border=0></img></a> ", 1, 0);
750                else
751                        buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_off.png border=0></img></a> ", 1, 0);
752                if(vol >=60)
753                        buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_on.png border=0></img></a> ", 1, 0);
754                else
755                        buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_off.png border=0></img></a> ", 1, 0);
756                if(vol >=70)
757                        buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_on.png border=0></img></a> ", 1, 0);
758                else
759                        buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_off.png border=0></img></a> ", 1, 0);
760                if(vol >=80)
761                        buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_on.png border=0></img></a> ", 1, 0);
762                else
763                        buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_off.png border=0></img></a> ", 1, 0);
764                if(vol >=90)
765                        buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_on.png border=0></img></a> ", 1, 0);
766                else
767                        buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_off.png border=0></img></a> ", 1, 0);
768                if(vol >=100)
769                        buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_on.png border=0></img></a> ", 1, 0);
770                else
771                        buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_off.png border=0></img></a> ", 1, 0);
772                buf = ostrcat(buf, "</center></body></html>", 1, 0);
773        }
774        else
775                buf = ostrcat(buf, oitoa(vol), 1, 1);
776
777        if(param != NULL)
778        {
779                setvol(vol);
780                if(status.mute == 1)
781                        screenmute(NULL, NULL, 0);
782        }
783        return buf;
784}
785
786char* webgetaktservice(int fmt)
787{
788        char* buf = NULL;
789        struct channel* chnode = status.aktservice->channel;
790        int line = 0, maxlen = 0, pos = 0;
791
792        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
793        webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt);
794        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1);
795
796        return buf;
797}
798
799char* webgetservice(char* param, int fmt)
800{
801        char* buf = NULL, *param1 = NULL;
802        struct channel* chnode = NULL;
803        int line = 0, maxlen = 0, pos = 0;
804
805        if(param == NULL) return NULL;
806
807        //create param1
808        param1 = strchr(param, '&');
809        if(param1 != NULL)
810                *param1++ = '\0';
811
812        if(param1 == NULL) return NULL;
813
814        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
815
816        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
817        webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt);
818        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1);
819
820        return buf;
821}
822
823char* webswitch(char* param, int fmt)
824{
825        if(status.channelswitch == 1) goto end;
826
827        int ret = 0;
828        char* param1 = NULL, *param2 = NULL;
829        struct channel* chnode = NULL;
830
831        if(param == NULL) goto end;
832
833        //create param1
834        param1 = strchr(param, '&');
835        if(param1 != NULL)
836        {
837                *param1++ = '\0';
838                param2 = strchr(param1, '&');
839                if(param2 != NULL)
840                        *param2++ = '\0';
841        }
842
843        if(param1 == NULL && param2 == NULL) goto end;
844
845        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
846        if(chnode != NULL)
847        {
848                ret = channelnottunable(chnode);
849                if(ret == 0)
850                        ret = servicestart(chnode, param2, NULL, 0);
851        }
852
853end:
854        return webgetaktservice(fmt);
855}
856
857char* webgetm3u(char* param, int connfd, int fmt)
858{
859        int extip = 1;
860        char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
861        struct sockaddr_in sin;
862        socklen_t len = sizeof(sin);
863
864        if(param == NULL) return NULL;
865
866        if(getconfigint("webifip", NULL) == 1)
867                ip = getispip();
868
869        if(ip == NULL)
870        {
871                if(getsockname(connfd, &sin, &len) < 0)
872                {
873                        perr("getsockname");
874                        return NULL;
875                }
876
877                extip = 0;
878                ip = inet_ntoa(sin.sin_addr);
879                        if(ip == NULL) return NULL;
880        }
881
882        buf = ostrcat(buf, "#EXTM3U\n", 1, 0);
883        buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0);
884        buf = ostrcat(buf, "http://", 1, 0);
885        buf = ostrcat(buf, ip, 1, 0);
886        buf = ostrcat(buf, ":", 1, 0);
887        buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
888        buf = ostrcat(buf, "/", 1, 0);
889
890        tmpbuf = htmlencode(param);
891        if(tmpbuf != NULL)
892                param = tmpbuf;
893
894        buf = ostrcat(buf, param, 1, 0);
895        free(tmpbuf); tmpbuf = NULL;
896
897        if(extip == 1) free(ip);
898        return buf;
899}
900
901char* webgetvideo(char* param, int connfd, int fmt)
902{
903        int extip = 1;
904        char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
905        struct sockaddr_in sin;
906        socklen_t len = sizeof(sin);
907
908        if(param == NULL) return NULL;
909
910        if(getconfigint("webifip", NULL) == 1)
911                ip = getispip();
912
913        if(ip == NULL)
914        {
915                if(getsockname(connfd, &sin, &len) < 0)
916                {
917                        perr("getsockname");
918                        return NULL;
919                }
920
921                extip = 0;
922                ip = inet_ntoa(sin.sin_addr);
923                if(ip == NULL) return NULL;
924        }
925
926        if(fmt == 0)
927        {
928                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css></head><body class=body><table border=0 width=100% height=100%><tr><td align=center valign=middle>", 1, 0);
929                buf = ostrcat(buf, "<embed width=100% height=100% type=application/x-vlc-plugin name=video autoplay=yes target=\"http://", 1, 0);
930        }
931        else
932                buf = ostrcat(buf, "http://", 1, 0);
933
934        buf = ostrcat(buf, ip, 1, 0);
935        buf = ostrcat(buf, ":", 1, 0);
936        buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
937        buf = ostrcat(buf, "/", 1, 0);
938
939        tmpbuf = htmlencode(param);
940        if(tmpbuf != NULL)
941                param = tmpbuf;
942
943        buf = ostrcat(buf, param, 1, 0);
944        free(tmpbuf); tmpbuf = NULL;
945
946        if(fmt == 0)
947        {
948                buf = ostrcat(buf, "\" />", 1, 0);
949                //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.play()'>Play</a>", 1, 0);
950                //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.stop()'>Stop</a>", 1, 0);
951                //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.fullscreen()'>Fullscreen</a>", 1, 0);
952                buf = ostrcat(buf, "</td></tr></body></html>", 1, 0);
953        }
954
955        if(extip == 1) free(ip);
956        return buf;
957}
958
959char* webvideo(char* param, int fmt)
960{
961        char* buf = NULL, *param1 = NULL, *tmpbuf = NULL;
962
963        if(param == NULL) return NULL;
964 
965        //create param1
966        param1 = strchr(param, '&');
967        if(param1 != NULL)
968                *param1++ = '\0';
969
970        if(param1 == NULL) return NULL;
971
972        htmldecode(param1, param1);
973        if(param1 != NULL)
974        {
975                if(status.play == 0 && status.webplayfile == NULL)
976                {
977                        if(ostrstr(param1, "url=") == param1)
978                                status.webplayfile = ostrcat(param1 + 4, NULL, 0, 0);
979                        else if(ostrstr(param1, "hosterurl=") == param1)
980                        {
981                                status.webplayfile = ostrcat(param1 + 10, NULL, 0, 0);
982
983                                // stream over tithek enable start
984                                printf("status.webplayfile: %s\n",status.webplayfile);
985                                struct skin* tithekplugin = getplugin("TiTan Mediathek");
986                                if(tithekplugin != NULL)
987                                {
988                                        struct tithek* (*startplugin)(char*);
989               
990                                        startplugin = dlsym(tithekplugin->pluginhandle, "hoster");
991                                        if(startplugin != NULL)
992                                        {
993                                                status.webplayfile = startplugin(status.webplayfile);
994                                                printf("status.webplayfile changed: %s\n",status.webplayfile);
995                                        }
996                                }
997                                // stream over tithek enable end
998                        }
999                        else
1000                                status.webplayfile = ostrcat(param1, NULL, 0, 0);
1001                }
1002        }
1003        tmpbuf = ostrcat("not in play mode", NULL, 0, 0);
1004   
1005        int count = 0;
1006        if(status.timeshift == 0 && status.play == 0 && (ostrcmp("play", param) == 0 || ostrcmp("play=", param) == 0))
1007        {
1008                int count = 0;
1009
1010                int rcret = getrcconfigint("rcwebplay", NULL);
1011                if(rcret == 0) rcret = getrcconfigint("rcarchive", NULL);
1012                if(rcret == 0) rcret = getrcconfigint("rcplay", NULL);
1013                writerc(rcret);
1014                while(status.play == 0 && count < 30)
1015                {
1016                        usleep(100000);
1017                        count++;
1018                }
1019        }
1020        else
1021                count = 31;
1022
1023        if(count >= 30 && status.play == 0)
1024        {
1025                free(status.webplayfile); status.webplayfile = NULL;
1026                free(tmpbuf); tmpbuf = NULL;
1027                tmpbuf = ostrcat("can not start playback", NULL, 0, 0);
1028        }
1029
1030        if(status.timeshift == 0 && status.play == 1)
1031        {
1032                if(ostrcmp("stop", param) == 0 || ostrcmp("stop=", param) == 0)
1033                        writerc(getrcconfigint("rcstop", NULL));
1034
1035                if(ostrcmp("pause", param) == 0 || ostrcmp("pause=", param) == 0)
1036                        writerc(getrcconfigint("rcpause", NULL));
1037   
1038                if(ostrcmp("ff", param) == 0 || ostrcmp("ff=", param) == 0)
1039                        writerc(getrcconfigint("rcff", NULL));
1040   
1041                if(ostrcmp("fr", param) == 0 || ostrcmp("fr=", param) == 0)
1042                        writerc(getrcconfigint("rcfr", NULL));
1043
1044                free(tmpbuf); tmpbuf = NULL;
1045                tmpbuf = ostrcat(param, NULL, 0, 0);
1046
1047                if(ostrcmp("getlen", param) == 0 || ostrcmp("getlen=", param) == 0)
1048                {
1049                        unsigned long len = 0;
1050                        free(tmpbuf); tmpbuf = NULL;
1051   
1052                        len = playergetlength();
1053                        tmpbuf = ostrcat(buf, olutoa(len), 1, 1);
1054                }
1055 
1056                if(ostrcmp("getpos", param) == 0 || ostrcmp("getpos=", param) == 0)
1057                {
1058                        unsigned long pos = 0;
1059                        free(tmpbuf); tmpbuf = NULL;
1060   
1061                        pos = playergetpts() / 90000;
1062                        tmpbuf = ostrcat(buf, olutoa(pos), 1, 1);
1063                }
1064 
1065                if(ostrcmp("getisplaying", param) == 0 || ostrcmp("getisplaying=", param) == 0)
1066                {
1067                        int playing = 0;
1068                        free(tmpbuf); tmpbuf = NULL;
1069   
1070                        playing = playerisplaying();
1071                        tmpbuf = ostrcat(buf, oitoa(playing), 1, 1);
1072                }
1073 
1074                if(ostrcmp("getplayercan", param) == 0 || ostrcmp("getplayercan=", param) == 0)
1075                {
1076                        free(tmpbuf); tmpbuf = NULL;
1077                        tmpbuf = ostrcat(buf, olutoa(status.playercan), 1, 1);
1078                }
1079        }
1080
1081        if(fmt == 0)
1082        {
1083                buf = webcreatehead(buf, NULL, 1);
1084                buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Video ", 1, 0);
1085                buf = ostrcat(buf, tmpbuf, 1, 1);
1086                buf = ostrcat(buf, " !!!</font></td></tr>", 1, 0);
1087                buf = webcreatetail(buf, 1);
1088        }
1089        else
1090                buf = ostrcat(buf, tmpbuf, 1, 1);
1091 
1092        return buf;
1093}
1094
1095char* webgetchannelpage(char* param, int fmt)
1096{
1097        char* param1 = NULL, *param2 = NULL;
1098
1099        if(param == NULL) return NULL;
1100
1101        //create param1 + 2
1102        param1 = strchr(param, '&');
1103        if(param1 != NULL)
1104        {
1105                *param1++ = '\0';
1106                param2 = strchr(param1, '&');
1107                if(param2 != NULL)
1108                        *param2++ = '\0';
1109        }
1110
1111        if(param1 == NULL || param2 == NULL) return NULL;
1112
1113        return webgetchannel(atoi(param), atoi(param1), atoi(param2), fmt);
1114}
1115
1116void webmessage(struct stimerthread* timernode, char* text, int flag)
1117{
1118        textbox(_("Message"), text, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
1119        free(text);
1120}
1121
1122char* websendmessage(char* param, int fmt)
1123{
1124        char* text = NULL, *buf = NULL;
1125
1126        if(param == NULL) return NULL;
1127        param = strchr(param, '=');
1128        if(param != NULL)
1129        {
1130                param++;
1131                stringreplacechar(param, '+', ' ');
1132                text = ostrcat(text, param, 1, 0);
1133        }
1134        addtimer(&webmessage, START, 1000, 1, (void*)text, NULL, NULL);
1135
1136        if(fmt == 0)
1137        {
1138                buf = webcreatehead(buf, NULL, 1);
1139                buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Message Send !!!</font></td></tr>", 1, 0);
1140                buf = webcreatetail(buf, 1);
1141        }
1142        else
1143                buf = ostrcat(buf, "Message Send", 1, 0);
1144               
1145        return buf;
1146}
1147
1148char* webgetsignal(int fmt)
1149{
1150        char* buf = NULL, *tmpnr = NULL;
1151        uint16_t snr = 0, signal = 0;
1152        uint32_t ber = 0, unc = 0;
1153
1154        ber = fereadber(status.aktservice->fedev);
1155        unc = fereaduncorrectedblocks(status.aktservice->fedev);
1156        signal = fereadsignalstrength(status.aktservice->fedev);
1157        snr = fereadsnr(status.aktservice->fedev);
1158        snr = (snr * 100) / 0xffff;
1159
1160        if(fmt == 0)
1161        {
1162                buf = webcreatehead(buf, "<meta http-equiv=refresh content=1>", 0);
1163
1164                buf = ostrcat(buf, "<tr><td align=center><font class=biglabel><br><br>BER: ", 1, 0);
1165                tmpnr = oitoa(ber);
1166                buf = ostrcat(buf, tmpnr, 1, 0);
1167                free(tmpnr); tmpnr = NULL;
1168
1169                buf = ostrcat(buf, "<br>UNC: ", 1, 0);
1170                tmpnr = oitoa(unc);
1171                buf = ostrcat(buf, tmpnr, 1, 0);
1172                free(tmpnr); tmpnr = NULL;
1173
1174                buf = ostrcat(buf, "<br>SIG: ", 1, 0);
1175                tmpnr = oitoa(signal);
1176                buf = ostrcat(buf, tmpnr, 1, 0);
1177                free(tmpnr); tmpnr = NULL;
1178
1179                buf = ostrcat(buf, "<br>SNR: ", 1, 0);
1180                tmpnr = oitoa(snr);
1181                buf = ostrcat(buf, tmpnr, 1, 0);
1182                free(tmpnr); tmpnr = NULL;
1183
1184                buf = ostrcat(buf, "</font></td></tr>", 1, 0);
1185                buf = webcreatetail(buf, 0);
1186        }
1187        else
1188        {
1189                buf = ostrcat(buf, oitoa(ber), 1, 1);
1190                buf = ostrcat(buf, "#", 1, 0);
1191                buf = ostrcat(buf, oitoa(unc), 1, 1);
1192                buf = ostrcat(buf, "#", 1, 0);
1193                buf = ostrcat(buf, oitoa(signal), 1, 1);
1194                buf = ostrcat(buf, "#", 1, 0);
1195                buf = ostrcat(buf, oitoa(snr), 1, 1);
1196        }
1197
1198        return buf;
1199}
1200
1201char* webgetepg(char* param, int fmt)
1202{
1203        char* buf = NULL, *buf1 = NULL, *tmpstr = NULL, *param1 = NULL, *param2 = NULL;
1204        struct epg* epgnode = NULL;
1205        struct channel* chnode = NULL;
1206        struct tm *loctime = NULL;
1207
1208        if(param == NULL) return NULL;
1209
1210        //create param1 + 2
1211        param1 = strchr(param, '&');
1212        if(param1 != NULL)
1213        {
1214                *param1++ = '\0';
1215                param2 = strchr(param1, '&');
1216                if(param2 != NULL)
1217                        *param2++ = '\0';
1218        }
1219
1220        if(param1 == NULL || param2 == NULL) return NULL;
1221
1222        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
1223        if(chnode == NULL) return NULL;
1224
1225        epgnode = getepg(chnode, atoi(param2), 0);
1226        if(epgnode == NULL) return NULL;
1227
1228        if(fmt == 0) buf = webcreatehead(buf, NULL, 0);
1229
1230        buf1 = malloc(MINMALLOC);
1231        if(buf1 == NULL)
1232        {
1233                err("no mem");
1234                return buf;
1235        }
1236
1237        if(fmt == 0) buf = ostrcat(buf, "<tr><td><font class=biglabel>", 1, 0);
1238        if(epgnode->title != NULL)
1239        {
1240                buf = ostrcat(buf, epgnode->title, 1, 0);
1241                if(fmt == 0)
1242                {
1243                        buf = ostrcat(buf, " (", 1, 0);
1244                        loctime = olocaltime(&epgnode->starttime);
1245                        if(loctime != NULL)
1246                                strftime(buf1, MINMALLOC, "%H:%M -", loctime);
1247                        free(loctime); loctime = NULL;
1248                        loctime = olocaltime(&epgnode->endtime);
1249                        if(loctime != NULL)
1250                                strftime(&buf1[7], MINMALLOC - 8, " %H:%M", loctime);
1251                        free(loctime); loctime = NULL;
1252                        buf = ostrcat(buf, buf1, 1, 0);
1253                        buf = ostrcat(buf, ")", 1, 0);
1254                }
1255        }
1256        if(fmt == 0)
1257        {
1258                buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
1259                buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
1260        }
1261        else
1262        {
1263                buf = ostrcat(buf, "#", 1, 0);
1264                buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
1265                buf = ostrcat(buf, "#", 1, 0);
1266                buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
1267                buf = ostrcat(buf, "#", 1, 0);
1268        }
1269
1270        if(epgnode->subtitle != NULL)
1271                buf = ostrcat(buf, epgnode->subtitle, 1, 0);
1272
1273        if(fmt == 0)
1274        {
1275                buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
1276                buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
1277        }
1278        else
1279                buf = ostrcat(buf, "#", 1, 0);
1280
1281        tmpstr = epgdescunzip(epgnode);
1282        if(tmpstr != NULL)
1283                buf = ostrcat(buf, tmpstr, 1, 0);
1284        free(tmpstr); tmpstr = NULL;
1285
1286        if(fmt == 0)
1287        {
1288                buf = ostrcat(buf, "</font></td></tr>", 1, 0);
1289                buf = webcreatetail(buf, 0);
1290        }
1291
1292        free(buf1);
1293        return buf;
1294}
1295
1296char* webgetsingleepg(char* param, int fmt)
1297{
1298        int line = 0, maxlen = 0, pos = 0, longdesc = 1;
1299        char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL, *tmpstr = NULL;
1300        struct epg* epgnode = NULL;
1301        struct channel* chnode = NULL;
1302        struct tm *loctime = NULL;
1303       
1304        if(param == NULL) return NULL;
1305
1306        //create param1 + 2
1307        param1 = strchr(param, '&');
1308        if(param1 != NULL)
1309        {
1310                *param1++ = '\0';
1311                param2 = strchr(param1, '&');
1312                if(param2 != NULL)
1313                        *param2++ = '\0';
1314        }
1315
1316        if(param1 == NULL) return NULL;
1317        if(param2 != NULL) longdesc = atoi(param2);
1318
1319        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
1320        if(chnode == NULL) return NULL;
1321        epgnode = getepgakt(chnode);;
1322
1323        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
1324
1325        buf1 = malloc(MINMALLOC);
1326        if(buf1 == NULL)
1327        {
1328                err("no mem");
1329                return buf;
1330        }
1331
1332        while(epgnode != NULL)
1333        {
1334                if(fmt == 0)
1335                {
1336                        if(line == 0)
1337                        {
1338                                ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
1339                                line = 1;
1340                        }
1341                        else
1342                        {
1343                                ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
1344                                line = 0;
1345                        }
1346
1347                        ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
1348                        tmpstr = oitoa(chnode->serviceid);
1349                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1350                        buf2 = ostrcat("<td nowrap><a target=main class=link href=query?addrectimer&", tmpstr, 0, 0);
1351                        buf2 = ostrcat(buf2, "&", 0, 0);
1352                        free(tmpstr); tmpstr = NULL;
1353                        ostrcatbig(&buf, "&", &maxlen, &pos);
1354                        tmpstr = ollutoa(chnode->transponderid);
1355                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1356                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1357                        buf2 = ostrcat(buf2, "&", 0, 0);
1358                        free(tmpstr); tmpstr = NULL;
1359                        ostrcatbig(&buf, "&", &maxlen, &pos);
1360                        tmpstr = oitoa(epgnode->eventid);
1361                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1362                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1363                        buf2 = ostrcat(buf2, ">", 0, 0);
1364                        free(tmpstr); tmpstr = NULL;
1365                        ostrcatbig(&buf, ">", &maxlen, &pos);
1366
1367                        loctime = olocaltime(&epgnode->starttime);
1368                        if(loctime != NULL)
1369                                strftime(buf1, MINMALLOC, "%d.%m _ %H:%M __ ", loctime);
1370                        //strftime(buf1, MINMALLOC, "%H:%M -", loctime);
1371                        free(loctime); loctime = NULL;
1372                        //loctime = olocaltime(&epgnode->endtime);
1373                        //if(loctime != NULL)
1374                        //      strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
1375                        //free(loctime); loctime = NULL;
1376                        ostrcatbig(&buf, buf1, &maxlen, &pos);
1377                        ostrcatbig(&buf, " ", &maxlen, &pos);
1378                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1379                        if(epgnode->subtitle != NULL)
1380                        {
1381                                ostrcatbig(&buf, " (", &maxlen, &pos);
1382                                ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
1383                                ostrcatbig(&buf, ")", &maxlen, &pos);
1384                        }
1385
1386                        ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
1387                        ostrcatbig(&buf, buf2, &maxlen, &pos);
1388                        ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/timer.png alt=\"set timer\"/>", &maxlen, &pos);
1389                        ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
1390                }
1391                else
1392                {
1393                        buf = ostrcat(buf, epgnode->title, 1, 0);
1394                        buf = ostrcat(buf, "#", 1, 0);
1395                        buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
1396                        buf = ostrcat(buf, "#", 1, 0);
1397                        buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
1398                        buf = ostrcat(buf, "#", 1, 0);
1399                        buf = ostrcat(buf, epgnode->subtitle, 1, 0);
1400                        buf = ostrcat(buf, "#", 1, 0);
1401                        if(longdesc == 1)
1402                        {
1403                                tmpstr = epgdescunzip(epgnode);
1404                                if(tmpstr != NULL)
1405                                        buf = ostrcat(buf, tmpstr, 1, 0);
1406                                free(tmpstr); tmpstr = NULL;
1407                        }
1408      buf = ostrcat(buf, "#", 1, 0);
1409                        buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1);
1410                        buf = ostrcat(buf, "\n", 1, 0);
1411                }
1412       
1413                epgnode = epgnode->next;
1414                free(buf2); buf2 = NULL;
1415        }
1416
1417        if(fmt == 0)
1418                webcreatetailbig(&buf, &maxlen, &pos, 0);
1419        else if(buf == NULL)
1420                buf = ostrcat("no data", NULL, 0, 0);
1421
1422        free(buf1);
1423        return buf;
1424}
1425
1426//TODO: create rectimer line
1427void webcalcrecline(char** buf, int* maxlen, int* pos)
1428{
1429        //ostrcatbig(buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed\"><tr><td width=500 style=\"background-color: c0c0c0; height: 2; border-left: 2px solid #303030;\"></td></tr></table>", maxlen, pos);
1430}
1431
1432char* webgetgmultiepg(char* param, int fmt)
1433{
1434        int page = 1, i, line = 0, treffer = 0, maxlen = 0, pos = 0;
1435        char* buf = NULL, *tmpnr = NULL, *param1 = NULL;
1436        struct mainbouquet *mbouquet = NULL;
1437        struct bouquet *node = NULL;
1438        struct channel* chnode = NULL;
1439        struct epg* epgnode = NULL;
1440        time_t akttime = 0, difftime = 0, starttime = 0, endtime = 0, lastendtime = 0;
1441
1442        if(param == NULL) return NULL;
1443
1444        //create param1
1445        param1 = strchr(param, '&');
1446        if(param1 != NULL)
1447                *param1++ = '\0';
1448
1449        if(param1 != NULL) page = atoi(param1);
1450
1451        ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script></head><body class=body><center><table width=100% height=100%><tr><td height=100%><table cellpadding=0 cellspacing=0 border=0 id=gmultiepg class=scrolltable style=\"table-layout: fixed;\" cellpadding=0><thead><tr>", &maxlen, &pos);
1452
1453        akttime = webcreatetimeline(&buf, &maxlen, &pos);
1454        akttime += ((page - 1) * 1440);
1455        ostrcatbig(&buf, "</tr></thead><tbody>", &maxlen, &pos);
1456
1457        mbouquet = getmainbouquet(param);
1458        if(mbouquet != NULL)
1459        {
1460                node = mbouquet->bouquet;
1461                while(node != NULL)
1462                {
1463                        chnode = getchannel(node->serviceid, node->transponderid);
1464                        if(chnode != NULL)
1465                        {
1466                                if(line == 0)
1467                                {
1468                                        ostrcatbig(&buf, "<tr><th class=gepgchannel1>", &maxlen, &pos);
1469                                        ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1470                                        ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
1471                                        webcalcrecline(&buf, &maxlen, &pos);
1472                                        ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line1>", &maxlen, &pos);
1473                                        line = 1;
1474                                }
1475                                else
1476                                {
1477                                        ostrcatbig(&buf, "<tr><th class=gepgchannel2>", &maxlen, &pos);
1478                                        ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1479                                        ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
1480                                        webcalcrecline(&buf, &maxlen, &pos);
1481
1482                                        ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line2>", &maxlen, &pos);
1483                                        line = 0;
1484                                }
1485
1486                                treffer = 0;
1487                                lastendtime = 0;
1488                                epgnode = getepgakt(chnode);
1489                                while(epgnode != NULL)
1490                                {
1491                                        treffer = 1;
1492                                        starttime = epgnode->starttime / 60;
1493                                        endtime = epgnode->endtime / 60;
1494
1495                                        if(endtime <= starttime || starttime >= akttime + 1440)
1496                                        {
1497                                                epgnode = epgnode->next;
1498                                                continue;
1499                                        }
1500
1501                                        //check if old endtime > new starttime
1502                                        if(lastendtime > 0 && starttime > lastendtime)
1503                                        {
1504                                                difftime = (starttime - lastendtime) * 5;
1505
1506                                                if(difftime <= 0)
1507                                                {
1508                                                        epgnode = epgnode->next;
1509                                                        continue;
1510                                                }
1511
1512                                                ostrcatbig(&buf, "<td class=gepgcellblank style=\"", &maxlen, &pos);
1513                                                tmpnr = oitoa(difftime);
1514                                                ostrcatbig(&buf, "width:", &maxlen, &pos);
1515                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1516                                                ostrcatbig(&buf, "px;", &maxlen, &pos);
1517                                                ostrcatbig(&buf, "min-width:", &maxlen, &pos);
1518                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1519                                                ostrcatbig(&buf, "px;", &maxlen, &pos);
1520                                                ostrcatbig(&buf, "max-width:", &maxlen, &pos);
1521                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1522                                                ostrcatbig(&buf, "px;", &maxlen, &pos);
1523                                                free(tmpnr); tmpnr = NULL;
1524
1525                                                ostrcatbig(&buf, "\"> </td>", &maxlen, &pos);
1526                                        }
1527
1528                                        //check if starttime < last endtime
1529                                        if(starttime < lastendtime)
1530                                                starttime = lastendtime;
1531
1532                                        //check if endtime is in next day
1533                                        if(endtime > akttime + 1440)
1534                                                endtime = endtime - (endtime - (akttime + 1440));
1535
1536                                        //check if starttime is in prev day
1537                                        if(starttime < akttime)
1538                                                difftime = (endtime - akttime) * 5;
1539                                        else
1540                                                difftime = (endtime - starttime) * 5;
1541
1542                                        if(difftime <= 0)
1543                                        {
1544                                                epgnode = epgnode->next;
1545                                                continue;
1546                                        }
1547
1548                                        lastendtime = endtime;
1549
1550                                        ostrcatbig(&buf, "<td class=gepgcell style=\"", &maxlen, &pos);
1551                                        tmpnr = oitoa(difftime);
1552                                        ostrcatbig(&buf, "width:", &maxlen, &pos);
1553                                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1554                                        ostrcatbig(&buf, "px;", &maxlen, &pos);
1555                                        ostrcatbig(&buf, "min-width:", &maxlen, &pos);
1556                                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1557                                        ostrcatbig(&buf, "px;", &maxlen, &pos);
1558                                        ostrcatbig(&buf, "max-width:", &maxlen, &pos);
1559                                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1560                                        ostrcatbig(&buf, "px;", &maxlen, &pos);
1561                                        free(tmpnr); tmpnr = NULL;
1562
1563                                        ostrcatbig(&buf, "\"><div class=gepgcellborder>", &maxlen, &pos);
1564                                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1565                                        ostrcatbig(&buf, "</div></div></td>", &maxlen, &pos);
1566                                       
1567                                        epgnode = epgnode->next;
1568                                }
1569                                if(treffer == 0)
1570                                        ostrcatbig(&buf, "<td class=gepgcellblank> </td>", &maxlen, &pos);
1571                        }
1572                        ostrcatbig(&buf, "</tr></table></td></tr>", &maxlen, &pos);
1573
1574                        node = node->next;
1575                }
1576        }
1577        ostrcatbig(&buf, "<script type=text/javascript>if(typeof tableScroll == 'function'){tableScroll('gmultiepg');}</script></tbody></table></td></tr><tr><td align=center>", &maxlen, &pos);
1578
1579        for(i = 1; i <= 14; i++)
1580        {
1581                if(page == i)
1582                        ostrcatbig(&buf, "<a class=pagesellink href=\"query?getgmultiepg&", &maxlen, &pos);
1583                else
1584                        ostrcatbig(&buf, "<a class=pagelink href=\"query?getgmultiepg&", &maxlen, &pos);
1585                ostrcatbig(&buf, param, &maxlen, &pos);
1586                ostrcatbig(&buf, "&", &maxlen, &pos);
1587                tmpnr = oitoa(i);
1588                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1589                ostrcatbig(&buf, "\">", &maxlen, &pos);
1590                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1591                ostrcatbig(&buf, "</a>", &maxlen, &pos);
1592                free(tmpnr); tmpnr = NULL;
1593        }
1594       
1595        ostrcatbig(&buf, "</td></tr></table></center></body></html>", &maxlen, &pos);
1596        return buf;
1597}
1598
1599char* webgetdrawcount(char* param, int fmt)
1600{
1601        return oitoa(status.drawscreencount);
1602}
1603
1604void webgetshoot(char* param, int fmt)
1605{
1606        printf("param: %s\n",param);
1607        printf("parm: %d\n",fmt);
1608        screenshoot(atoi(param));
1609}
1610
1611char* webgetepgsearch(char* query, char* param, int fmt)
1612{
1613        int line = 0, maxlen = 0, pos = 0, maxcount = 0, page = 1, newchannel = 0, longepg = 0;
1614        char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *tmpstr = NULL, *tmpnr = NULL, *param1 = NULL, *param2 = NULL;
1615        struct channel* chnode = channel;
1616        struct epg* epgnode = NULL;
1617        struct tm *loctime = NULL;
1618
1619        if(query == NULL) return NULL;
1620
1621        if(param == NULL)
1622        {
1623                query = strchr(query, '=');
1624                if(query != NULL)
1625                {
1626                        query++;
1627                        stringreplacechar(param, '+', ' ');
1628                        param = query;
1629                }
1630        }
1631        else
1632        {
1633                //create param1 + 2
1634                param1 = strchr(param, '&');
1635                if(param1 != NULL)
1636                {
1637                        *param1++ = '\0';
1638                        param2 = strchr(param1, '&');
1639                        if(param2 != NULL)
1640                                *param2++ = '\0';
1641                }
1642        }
1643
1644        if(param1 != NULL) page = atoi(param1);
1645        if(param2 != NULL) longepg = atoi(param2);
1646
1647        buf1 = malloc(MINMALLOC);
1648        if(buf1 == NULL)
1649        {
1650                err("no mem");
1651                return buf;
1652        }
1653
1654        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
1655        while(chnode != NULL)
1656        {
1657                newchannel = 1;
1658                epgnode = getepgakt(chnode);
1659                while(epgnode != NULL)
1660                {
1661                        if(epgnode->title != NULL && ostrstrcase(epgnode->title, param) != NULL)
1662                        {
1663
1664                                maxcount++;
1665
1666                                if(page >= 0)
1667                                {
1668                                        if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
1669                                        {
1670                                                epgnode = epgnode->next;
1671                                                continue;
1672                                        }
1673                                }
1674
1675                                if(fmt == 0)
1676                                {
1677                                        if(line == 0)
1678                                        {
1679                                                ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
1680                                                line = 1;
1681                                        }
1682                                        else
1683                                        {
1684                                                ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
1685                                                line = 0;
1686                                        }
1687                                }
1688
1689                                if(fmt == 1 && newchannel == 1)
1690                                {
1691                                        newchannel = 0;
1692                                        ostrcatbig(&buf, "BeginNewChannel", &maxlen, &pos);
1693                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1694                                        ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1695                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1696                                        tmpstr = oitoa(chnode->serviceid);
1697                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1698                                        free(tmpstr); tmpstr = NULL;
1699                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1700                                        tmpstr = ollutoa(chnode->transponderid);
1701                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1702                                        free(tmpstr); tmpstr = NULL;
1703                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1704                                        tmpstr = oitoa(chnode->servicetype);
1705                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1706                                        free(tmpstr); tmpstr = NULL;
1707                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
1708                                }
1709
1710                                if(fmt == 0)
1711                                {
1712                                        ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
1713                                        tmpstr = oitoa(chnode->serviceid);
1714                                        buf2 = ostrcat("<td nowrap><a target=main class=link href=query?addrectimer&", tmpstr, 0, 0);
1715                                        buf2 = ostrcat(buf2, "&", 0, 0);
1716                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1717                                        free(tmpstr); tmpstr = NULL;
1718                                        ostrcatbig(&buf, "&", &maxlen, &pos);
1719                                        tmpstr = ollutoa(chnode->transponderid);
1720                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1721                                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1722                                        buf2 = ostrcat(buf2, "&", 0, 0);
1723                                        free(tmpstr); tmpstr = NULL;
1724                                        ostrcatbig(&buf, "&", &maxlen, &pos);
1725                                        tmpstr = oitoa(epgnode->eventid);
1726                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1727                                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1728                                        buf2 = ostrcat(buf2, ">", 0, 0);
1729                                        free(tmpstr); tmpstr = NULL;
1730                                        ostrcatbig(&buf, ">", &maxlen, &pos);
1731       
1732                                        loctime = olocaltime(&epgnode->starttime);
1733                                        if(loctime != NULL)
1734                                                strftime(buf1, MINMALLOC, "%d.%m _ %H:%M __ ", loctime);
1735                                                //strftime(buf1, MINMALLOC, "%H:%M -", loctime);
1736                                        free(loctime); loctime = NULL;
1737                                        //loctime = olocaltime(&epgnode->endtime);
1738                                        //if(loctime != NULL)
1739                                        //      strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
1740                                        //free(loctime); loctime = NULL;
1741                                        ostrcatbig(&buf, buf1, &maxlen, &pos);
1742                                        ostrcatbig(&buf, " ", &maxlen, &pos);
1743       
1744                                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1745                                        if(chnode->name != NULL)
1746                                        {
1747                                                ostrcatbig(&buf, " (", &maxlen, &pos);
1748                                                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1749                                                ostrcatbig(&buf, ")", &maxlen, &pos);
1750                                        }
1751
1752                                        ostrcatbig(&buf, "</a><br><font class=smalllabel1>", &maxlen, &pos);
1753                                        ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
1754
1755                                        ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
1756                                        ostrcatbig(&buf, buf2, &maxlen, &pos);
1757                                        ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/timer.png alt=\"set timer\"/>", &maxlen, &pos);
1758                                        ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
1759                                }
1760                                else
1761                                {
1762                                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1763                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1764
1765                                        tmpstr = olutoa(epgnode->starttime);
1766                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1767                                        free(tmpstr); tmpstr = NULL;
1768                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1769
1770                                        tmpstr = olutoa(epgnode->endtime);
1771                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1772                                        free(tmpstr); tmpstr = NULL;
1773                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1774
1775                                        ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
1776                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1777
1778                                        if(longepg == 1)
1779                                        {
1780                                                tmpstr = epgdescunzip(epgnode);
1781                                                if(tmpstr != NULL)
1782                                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1783                                                free(tmpstr); tmpstr = NULL;
1784                                        }
1785                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1786
1787                                        tmpstr = oitoa(epgnode->eventid);
1788                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1789                                        free(tmpstr); tmpstr = NULL;
1790                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
1791                                }
1792                        }
1793                        epgnode = epgnode->next;
1794                        free(buf2); buf2 = NULL;
1795                }
1796                chnode = chnode->next;
1797        }
1798
1799        if(maxcount > MAXHTMLLINE && fmt == 0)
1800        {
1801                int i;
1802                ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
1803                for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
1804                {
1805                        if(page == i)
1806                                ostrcatbig(&buf, "<a class=pagesellink href=query?getepgsearch&", &maxlen, &pos);
1807                        else
1808                                ostrcatbig(&buf, "<a class=pagelink href=query?getepgsearch&", &maxlen, &pos);
1809                        ostrcatbig(&buf, param, &maxlen, &pos);
1810                        ostrcatbig(&buf, "&", &maxlen, &pos);
1811                        free(tmpnr); tmpnr = NULL;
1812
1813                        tmpnr = oitoa(i);
1814                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1815                        ostrcatbig(&buf, ">", &maxlen, &pos);
1816                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1817                        ostrcatbig(&buf, "</a>", &maxlen, &pos);
1818                        free(tmpnr); tmpnr = NULL;
1819                }
1820                ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
1821        }
1822
1823        if(fmt == 0)
1824                webcreatetailbig(&buf, &maxlen, &pos, 0);
1825        else if(buf == NULL)
1826                buf = ostrcat("no data", NULL, 0, 0);
1827
1828        free(buf1);
1829        return buf;
1830}
1831
1832//flagbit 0: restrict to path
1833//flagbit 1: show epg icon
1834//flagbit 2: show delete icon
1835//flagbit 3: show stream icon
1836//flagbit 4: show websteam icon
1837char* webgetfilelist(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt)
1838{
1839        char* buf = NULL, *tmppath = NULL, *tmpnr = NULL, *param1 = NULL;
1840        int maxlen = 0, pos = 0, line = 0, maxcount = 0, page = 1;
1841        struct skin* webdir = getscreen("webdir");
1842        struct skin* filelist = getscreennode(webdir, "filelist");
1843        struct skin* filelistpath = getscreennode(webdir, "filelistpath");
1844        struct skin* node = NULL;
1845
1846        if(param == NULL) param = path;
1847
1848        //create param1
1849        param1 = strchr(param, '&');
1850        if(param1 != NULL)
1851                *param1++ = '\0';
1852
1853        if(param1 != NULL) page = atoi(param1);
1854
1855        if(strlen(param) == 0 || !isdir(param))
1856                tmppath = ostrcat(path, NULL, 0, 0);
1857        else
1858                tmppath = ostrcat(param, NULL, 0, 0);
1859
1860        char* tmppath1 = createpath(tmppath, "");
1861        free(tmppath); tmppath = tmppath1;
1862
1863        if(checkbit(flag, 0) == 1)
1864        {
1865                if(ostrstr(tmppath, path) != tmppath)
1866                {
1867                        free(tmppath); tmppath = NULL;
1868                        tmppath = ostrcat(path, NULL, 0, 0);
1869                }
1870        }
1871
1872        changemask(filelist, mask);
1873        changeinput(filelist, tmppath);
1874        changetext(filelistpath, filelist->input);
1875
1876        free(tmppath); tmppath = NULL;
1877
1878        delmarkedscreennodes(webdir, FILELISTDELMARK);
1879        createfilelist(webdir, filelist, 0);
1880
1881        if(fmt == 0) ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script></head><body class=body><center><table width=100%>", &maxlen, &pos);
1882
1883        node = filelist;
1884        while(node != NULL)
1885        {
1886                if(node->del == FILELISTDELMARK)
1887                {
1888                        maxcount++;
1889                        if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
1890                        {
1891                                node = node->next;
1892                                continue;
1893                        }
1894
1895                        if(fmt == 0)
1896                        {
1897                                if(line == 0)
1898                                {
1899                                        ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
1900                                        line = 1;
1901                                }
1902                                else
1903                                {
1904                                        ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
1905                                        line = 0;
1906                                }
1907
1908                                ostrcatbig(&buf, "<td>", &maxlen, &pos);
1909                        }
1910                        if(node->input != NULL) //dir
1911                        {
1912                                if(fmt == 0)
1913                                {
1914                                        ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/folder.png alt=Directory> <a class=link href=\"query?", &maxlen, &pos);
1915                                        ostrcatbig(&buf, link, &maxlen, &pos);
1916                                        ostrcatbig(&buf, "&", &maxlen, &pos);
1917                                        ostrcatbig(&buf, node->input, &maxlen, &pos);
1918                                        ostrcatbig(&buf, "\">", &maxlen, &pos);
1919                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
1920                                        ostrcatbig(&buf, "</a><td> </td>", &maxlen, &pos);
1921                                }
1922                                else
1923                                {
1924                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
1925                                        ostrcatbig(&buf, "#0", &maxlen, &pos);
1926                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
1927                                }
1928                        }
1929                        else
1930                        {
1931                                if(fmt == 0)
1932                                {
1933                                        ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
1934                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
1935                                        ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
1936
1937                                        ostrcatbig(&buf, "<td width=80 align=right>", &maxlen, &pos);
1938
1939                                        //epg png
1940                                        if(checkbit(flag, 1) == 1)
1941                                        {
1942                                                ostrcatbig(&buf, "<a href=\"query?getmovieepg&", &maxlen, &pos);
1943                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
1944                                                ostrcatbig(&buf, "/", &maxlen, &pos);
1945                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
1946                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
1947                                                ostrcatbig(&buf, "<img border=0 src=img/movieepg.png width=16 height=16 alt=EPG></a>", &maxlen, &pos);
1948                                        }
1949                                        //delete png
1950                                        if(checkbit(flag, 2) == 1)
1951                                        {
1952                                                ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
1953                                                ostrcatbig(&buf, "query?", &maxlen, &pos);
1954                                                ostrcatbig(&buf, dellink, &maxlen, &pos);
1955                                                ostrcatbig(&buf, "&", &maxlen, &pos);
1956                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
1957                                                ostrcatbig(&buf, "&", &maxlen, &pos);
1958                                                tmpnr = oitoa(page);
1959                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1960                                                free(tmpnr); tmpnr = NULL;
1961                                                ostrcatbig(&buf, "&", &maxlen, &pos);
1962                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
1963                                                ostrcatbig(&buf, "\");'>", &maxlen, &pos);
1964                                        }
1965                                        //stream png
1966                                        if(checkbit(flag, 3) == 1)
1967                                        {
1968                                                ostrcatbig(&buf, "<a target=nothing href=\"query?getm3u&0,0,", &maxlen, &pos);
1969                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
1970                                                ostrcatbig(&buf, "/", &maxlen, &pos);
1971                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
1972                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
1973
1974                                                ostrcatbig(&buf, "<img border=0 src=img/stream.png width=16 height=16 alt=Stream></a>", &maxlen, &pos);
1975                                        }
1976                                        //webstream png
1977                                        if(checkbit(flag, 4) == 1)
1978                                        {
1979                                                ostrcatbig(&buf, "<a target=_blank href=\"query?getvideo&0,0,", &maxlen, &pos);
1980                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
1981                                                ostrcatbig(&buf, "/", &maxlen, &pos);
1982                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
1983                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
1984
1985                                                ostrcatbig(&buf, "<img border=0 src=img/webstream.png width=16 height=16 alt=WebStream></a>", &maxlen, &pos);
1986
1987                                                ostrcatbig(&buf, "<a target=_blank href=\"", &maxlen, &pos);
1988                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
1989                                                ostrcatbig(&buf, "/", &maxlen, &pos);
1990                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
1991                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
1992       
1993                                                ostrcatbig(&buf, "<img border=0 src=img/icon_restart.png width=16 height=16 alt=Download></a>", &maxlen, &pos);
1994                                        }
1995                                }
1996                                else
1997                                {
1998                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
1999                                        ostrcatbig(&buf, "#1", &maxlen, &pos);
2000                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
2001                                }
2002                        }
2003                        if(fmt == 0)
2004                        {
2005                                ostrcatbig(&buf, "</td>", &maxlen, &pos);
2006                                ostrcatbig(&buf, "</tr>", &maxlen, &pos);
2007                        }
2008                }
2009
2010                node = node->next;
2011        }
2012
2013        if(maxcount > MAXHTMLLINE)
2014        {
2015                int i;
2016                ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
2017                for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
2018                {
2019                        if(page == i)
2020                        {
2021                                ostrcatbig(&buf, "<a class=pagesellink href=query?", &maxlen, &pos);
2022                                ostrcatbig(&buf, link, &maxlen, &pos);
2023                                ostrcatbig(&buf, "&", &maxlen, &pos);
2024                        }
2025                        else
2026                        {
2027                                ostrcatbig(&buf, "<a class=pagelink href=query?", &maxlen, &pos);
2028                                ostrcatbig(&buf, link, &maxlen, &pos);
2029                                ostrcatbig(&buf, "&", &maxlen, &pos);
2030                        }
2031                        ostrcatbig(&buf, param, &maxlen, &pos);
2032                        ostrcatbig(&buf, "&", &maxlen, &pos);
2033
2034                        tmpnr = oitoa(i);
2035                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2036                        ostrcatbig(&buf, ">", &maxlen, &pos);
2037                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2038                        ostrcatbig(&buf, "</a>", &maxlen, &pos);
2039                        free(tmpnr); tmpnr = NULL;
2040                }
2041                ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
2042        }
2043
2044        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
2045        delmarkedscreennodes(webdir, FILELISTDELMARK);
2046        return buf;
2047}
2048
2049char* webgetmovieepg(char* param, char* path, int flag, int fmt)
2050{
2051        char* buf = NULL, *tmpstr = NULL;
2052        char tstr[2];
2053        char c = 0;
2054        int first = 1, maxlen = 0, pos = 0;
2055        FILE* fd = NULL;
2056
2057        if(fmt == 0)
2058        {
2059                webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
2060                ostrcatbig(&buf, "<tr><td><font class=biglabel>", &maxlen, &pos);
2061        }
2062
2063        if(flag == 1)
2064        {
2065                if(param != NULL && ostrstr(param, path) == param)
2066                {
2067                        tmpstr = changefilenameext(param, ".epg");
2068                        fd = fopen(tmpstr, "r");
2069                }
2070        }
2071        else
2072        {
2073                tmpstr = changefilenameext(param, ".epg");
2074                fd = fopen(tmpstr, "r");
2075        }
2076
2077        if(fd != NULL)
2078        {
2079                while(c != EOF)
2080                {
2081                        c = fgetc(fd);
2082                        if(fmt == 0 && c == '\n')
2083                        {
2084                                if(first == 1)
2085                                {
2086                                        ostrcatbig(&buf, "</font><br><font class=label>", &maxlen, &pos);
2087                                        first = 0;
2088                                }
2089                                ostrcatbig(&buf, "<br>", &maxlen, &pos);
2090                                continue;
2091                        }
2092                        if(c != EOF)
2093                        {
2094                                sprintf(tstr, "%c", c);
2095                                ostrcatbig(&buf, tstr, &maxlen, &pos);
2096                        }
2097                }
2098                fclose(fd);
2099        }
2100
2101        if(fmt == 0)
2102        {
2103                ostrcatbig(&buf, "</font></td></tr>", &maxlen, &pos);
2104                webcreatetailbig(&buf, &maxlen, &pos, 0);
2105        }
2106
2107        free(tmpstr); tmpstr = NULL;
2108        return buf;
2109}
2110
2111char* webdelfile(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt)
2112{
2113        int del = 0;
2114        char* buf = NULL, *param1 = NULL, *param2 = NULL, *tmpparam = NULL;
2115
2116        if(param == NULL) return NULL;
2117
2118        //create param1 + 2
2119        param1 = strchr(param, '&');
2120        if(param1 != NULL)
2121        {
2122                *param1++ = '\0';
2123                param2 = strchr(param1, '&');
2124                if(param2 != NULL)
2125                        *param2++ = '\0';
2126        }
2127
2128        if(param1 == NULL || param2 == NULL) return NULL;
2129
2130        tmpparam = createpath(param, param2);
2131
2132        if(checkbit(flag, 0) == 1)
2133        {
2134                if(tmpparam != NULL && ostrstr(tmpparam, path) == tmpparam)
2135                        del = 1;
2136        }
2137        else
2138                del = 1;
2139
2140        if(del == 1)
2141        {
2142                char* epgfilename = NULL;
2143
2144                unlink(tmpparam);
2145
2146                if(cmpfilenameext(tmpparam, ".ts") == 0)
2147                {
2148                        epgfilename = changefilenameext(tmpparam, ".epg");
2149                        unlink(epgfilename);
2150                        free(epgfilename); epgfilename = NULL;
2151                        epgfilename = changefilenameext(tmpparam, ".se");
2152                        unlink(epgfilename);
2153                        free(epgfilename); epgfilename = NULL;
2154                        epgfilename = changefilenameext(tmpparam, ".ma");
2155                        unlink(epgfilename);
2156                        free(epgfilename); epgfilename = NULL;
2157                }
2158        }
2159
2160        free(tmpparam); tmpparam = NULL;
2161        tmpparam = ostrcat(tmpparam, param, 1, 0);
2162        tmpparam = ostrcat(tmpparam, "&", 1, 0);
2163        tmpparam = ostrcat(tmpparam, param1, 1, 0);
2164
2165        buf = webgetfilelist(tmpparam, link, dellink, path, mask, flag, fmt);
2166        free(tmpparam); tmpparam = NULL;
2167        return buf;
2168}
2169
2170char* websendrc(char* param, int fmt)
2171{
2172        int rccode = 0;
2173        char* buf = NULL;
2174
2175        rccode = getrcconfigint(param, NULL);
2176        writerc(rccode);
2177
2178        buf = ostrcat("ok", NULL, 0, 0);
2179        return buf;
2180}
2181
2182//flag 0: get aktiv timer
2183//flag 1: get old timer
2184char* webgetrectimer(char* param, int flag, int fmt)
2185{
2186        char* buf = NULL, *buf1 = NULL;
2187        struct rectimer* node = rectimer;
2188        struct channel* chnode = NULL;
2189        int line = 0, maxlen = 0, pos = 0;
2190        struct tm *loctime = NULL;
2191
2192        buf1 = malloc(MINMALLOC);
2193        if(buf1 == NULL)
2194        {
2195                err("no mem");
2196                return NULL;
2197        }
2198
2199        if(fmt == 0) ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script></head><body class=body><center><table width=100%>", &maxlen, &pos);
2200
2201        while(node != NULL)
2202        {
2203                if((flag == 0 && (node->status == 2 || node->status == 3)) || (flag == 1 && (node->status == 0 || node->status == 1)) || node->status == 4 || node->status == 5)
2204                {
2205                        node = node->next;
2206                        continue;
2207                }
2208                if(fmt == 0)
2209                {
2210                        if(line == 0)
2211                        {
2212                                ostrcatbig(&buf, "<tr class=line1><td>", &maxlen, &pos);
2213                                line = 1;
2214                        }
2215                        else
2216                        {
2217                                ostrcatbig(&buf, "<tr class=line2><td>", &maxlen, &pos);
2218                                line = 0;
2219                        }
2220
2221                        loctime = olocaltime(&node->begin);
2222                        if(loctime != NULL)
2223                                strftime(buf1, MINMALLOC, "%d-%m-%Y %H:%M -", loctime);
2224                        free(loctime); loctime = NULL;
2225                        loctime = olocaltime(&node->end);
2226                        if(loctime != NULL)
2227                                strftime(&buf1[18], MINMALLOC - 19, " %H:%M ", loctime);
2228                        free(loctime); loctime = NULL;
2229       
2230                        ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
2231                        ostrcatbig(&buf, buf1, &maxlen, &pos);
2232
2233                        ostrcatbig(&buf, " (", &maxlen, &pos);
2234                        if(node->justplay == 0)
2235                                ostrcatbig(&buf, "rec - ", &maxlen, &pos);
2236                        else
2237                                ostrcatbig(&buf, "switch - ", &maxlen, &pos);
2238                        if(node->repeate == 0)
2239                                ostrcatbig(&buf, "once", &maxlen, &pos);
2240                        else
2241                                ostrcatbig(&buf, "repeate", &maxlen, &pos);
2242
2243                        ostrcatbig(&buf, ")</font><br><font class=smalllabel1>", &maxlen, &pos);
2244                        if(node->name == NULL || strlen(node->name) == 0)
2245                                ostrcatbig(&buf, "---", &maxlen, &pos);
2246                        else
2247                                ostrcatbig(&buf, node->name, &maxlen, &pos);
2248
2249                        chnode = getchannel(node->serviceid, node->transponderid);
2250                        if(chnode != NULL)
2251                        {
2252                                ostrcatbig(&buf, " (", &maxlen, &pos);
2253                                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
2254                                ostrcatbig(&buf, ")", &maxlen, &pos);
2255                        }
2256                        ostrcatbig(&buf, "<br>", &maxlen, &pos);
2257
2258                        if(node->status == 0)
2259                                ostrcatbig(&buf, "waiting", &maxlen, &pos);
2260                        else if(node->status == 1)
2261                                ostrcatbig(&buf, "running", &maxlen, &pos);
2262                        else if(node->status == 2)
2263                                ostrcatbig(&buf, "succes", &maxlen, &pos);
2264                        else if(node->status == 3)
2265                        {
2266                                ostrcatbig(&buf, "error", &maxlen, &pos);
2267                                if(node->errstr != NULL && strlen(node->errstr) > 0)
2268                                {
2269                                        ostrcatbig(&buf, " (", &maxlen, &pos);
2270                                        ostrcatbig(&buf, node->errstr, &maxlen, &pos);
2271                                        ostrcatbig(&buf, ")", &maxlen, &pos);
2272                                }
2273                        }
2274
2275                        ostrcatbig(&buf, "</font>", &maxlen, &pos);
2276
2277                        if(flag == 0)
2278                        {
2279                                ostrcatbig(&buf, "</td><td width=40 align=right>", &maxlen, &pos);
2280
2281                                //edit png
2282                                ostrcatbig(&buf, "<a target=main href=\"query?editrectimer", &maxlen, &pos);
2283                                ostrcatbig(&buf, "&", &maxlen, &pos);
2284                                ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
2285                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2286
2287                                ostrcatbig(&buf, "<img border=0 src=img/edit.png width=16 height=16 alt=\"Edit Timer\"></a>", &maxlen, &pos);
2288
2289                                //delete png
2290                                ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
2291                                ostrcatbig(&buf, "query?delrectimer", &maxlen, &pos);
2292                                ostrcatbig(&buf, "&", &maxlen, &pos);
2293                                ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
2294                                //ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2295                                //ostrcatbig(&buf, "&", &maxlen, &pos);
2296                                //tmpnr = oitoa(page);
2297                                //ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2298                                //free(tmpnr); tmpnr = NULL;
2299                                //ostrcatbig(&buf, "&", &maxlen, &pos);
2300                                //ostrcatbig(&buf, node->text, &maxlen, &pos);
2301                                ostrcatbig(&buf, "\");'>", &maxlen, &pos);
2302                        }
2303
2304                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
2305                }
2306                else
2307                {
2308                        buf = ostrcat(buf, olutoa(node->begin), 1, 1);
2309                        buf = ostrcat(buf, "#", 1, 0);
2310                        buf = ostrcat(buf, olutoa(node->end), 1, 1);
2311                        buf = ostrcat(buf, "#", 1, 0);
2312                        buf = ostrcat(buf, oitoa(node->justplay), 1, 1);
2313                        buf = ostrcat(buf, "#", 1, 0);
2314                        buf = ostrcat(buf, oitoa(node->repeate), 1, 1);
2315                        buf = ostrcat(buf, "#", 1, 0);
2316                        buf = ostrcat(buf, node->name, 1, 0);
2317                        buf = ostrcat(buf, "#", 1, 0);
2318                        buf = ostrcat(buf, oitoa(node->serviceid), 1, 1);
2319                        buf = ostrcat(buf, "#", 1, 0);
2320                        buf = ostrcat(buf, ollutoa(node->transponderid), 1, 1);
2321                        buf = ostrcat(buf, "#", 1, 0);
2322                        buf = ostrcat(buf, oitoa(node->status), 1, 1);
2323                        buf = ostrcat(buf, "#", 1, 0);
2324                        buf = ostrcat(buf, node->errstr, 1, 0);
2325                        buf = ostrcat(buf, "#", 1, 0);
2326                        buf = ostrcat(buf, node->timestamp, 1, 0);
2327                        buf = ostrcat(buf, "#", 1, 0);
2328                        chnode = getchannel(node->serviceid, node->transponderid);
2329                        if(chnode != NULL)
2330                                buf = ostrcat(buf, chnode->name, 1, 0);
2331                        buf = ostrcat(buf, "#", 1, 0);
2332                        buf = ostrcat(buf, oitoa(node->afterevent), 1, 1);
2333                        buf = ostrcat(buf, "\n", 1, 0);
2334                }
2335
2336                node = node->next;
2337        }
2338
2339        if(fmt == 0)
2340                webcreatetailbig(&buf, &maxlen, &pos, 0);
2341        else if(buf == NULL)
2342                buf = ostrcat("no data", NULL, 0, 0);
2343
2344        free(buf1);
2345        return buf;
2346}
2347
2348char* webaddrectimer(char* param, int fmt)
2349{
2350        char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL;
2351        struct channel* chnode = NULL;
2352        struct epg* epgnode = NULL;
2353//      int maxlen = 0, pos = 0, tmpservicetype = 0;
2354        int maxlen = 0, pos = 0;
2355        struct tm* loctime = NULL;
2356        time_t akttime = time(NULL);
2357       
2358        if(param != NULL)
2359        {
2360                //create param1 + 2
2361                param1 = strchr(param, '&');
2362                if(param1 != NULL)
2363                {
2364                        *param1++ = '\0';
2365                        param2 = strchr(param1, '&');
2366                        if(param2 != NULL)
2367                                *param2++ = '\0';
2368                }
2369                if(param1 == NULL || param2 == NULL) return NULL;
2370                chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
2371                if(chnode == NULL) return NULL;
2372
2373                epgnode = getepg(chnode, atoi(param2), 0);
2374                if(epgnode == NULL) return NULL;
2375        }
2376
2377               
2378        ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
2379        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
2380        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
2381        if(chnode == NULL)
2382                ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimercheck&node\" value=\"", &maxlen, &pos);
2383        else
2384                ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
2385        ostrcatbig(&buf, "0", &maxlen, &pos);
2386        ostrcatbig(&buf, "\">", &maxlen, &pos);
2387        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
2388        ostrcatbig(&buf, "<td><font class=label>Name:&nbsp;</font></td>", &maxlen, &pos);
2389        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"name\" value=\"", &maxlen, &pos);
2390        if(epgnode != NULL)
2391                ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
2392        else   
2393                ostrcatbig(&buf, " ", &maxlen, &pos);
2394        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2395        ostrcatbig(&buf, "<td><font class=label>Type:&nbsp;</font></td>", &maxlen, &pos);
2396        ostrcatbig(&buf, "<td><select name=\"type\" border=0><option selected>", &maxlen, &pos);
2397        ostrcatbig(&buf, "record", &maxlen, &pos);
2398        ostrcatbig(&buf, "<option>record<option>switch channel</select></td></tr>", &maxlen, &pos);
2399
2400        buf2 = malloc(MINMALLOC);
2401        if(epgnode != NULL)
2402                loctime =       olocaltime(&epgnode->starttime);
2403        else
2404                loctime = olocaltime(&akttime);
2405        if(loctime != NULL)
2406                strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime);
2407        free(loctime); loctime = NULL;
2408
2409        buf1 = ostrcat(buf2, NULL, 0, 0);
2410        ostrcatbig(&buf, "<td><font class=label>Begin:&nbsp;</font></td>", &maxlen, &pos);
2411        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"begin\" value=\"", &maxlen, &pos);
2412        ostrcatbig(&buf, buf1, &maxlen, &pos);
2413        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2414        free(buf1); buf1 = NULL;
2415       
2416        if(epgnode != NULL)
2417                loctime =       olocaltime(&epgnode->endtime);
2418        else
2419                loctime = olocaltime(&akttime);
2420        if(loctime != NULL)
2421                strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime);
2422        free(loctime); loctime = NULL;
2423       
2424        buf1 = ostrcat(buf2, NULL, 0, 0);
2425        ostrcatbig(&buf, "<td><font class=label>End:&nbsp;</font></td>", &maxlen, &pos);
2426        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"end\" value=\"", &maxlen, &pos);
2427        ostrcatbig(&buf, buf1, &maxlen, &pos);
2428        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2429        free(buf1); buf1 = NULL;
2430        free(buf2); buf2 = NULL;
2431
2432        ostrcatbig(&buf, "<td><font class=label>Channel:&nbsp;</font></td>", &maxlen, &pos);
2433        if(chnode == NULL)
2434                ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"channel\" value=\"", &maxlen, &pos);
2435        else
2436        {
2437                ostrcatbig(&buf, "<td>", &maxlen, &pos);
2438                ostrcatbig(&buf, "<input class=inputbox type=\"hidden\" name=\"sid\" value=\"", &maxlen, &pos);
2439                buf1 = oitoa(chnode->serviceid);
2440                ostrcatbig(&buf, buf1, &maxlen, &pos);
2441                free(buf1); buf1 = NULL;
2442                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2443                ostrcatbig(&buf, "<input class=inputbox type=\"hidden\" name=\"tid\" value=\"", &maxlen, &pos);
2444                buf1 = ollutoa(chnode->transponderid);
2445                ostrcatbig(&buf, buf1, &maxlen, &pos);
2446                free(buf1); buf1 = NULL;
2447                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2448                ostrcatbig(&buf, "<input readonly class=inputbox type=\"text\" name=\"channel\" value=\"", &maxlen, &pos);
2449        }
2450        if(chnode != NULL)
2451                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
2452        else if(status.aktservice->channel != NULL)
2453                ostrcatbig(&buf, status.aktservice->channel->name, &maxlen, &pos);
2454        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2455        free(buf1); buf1 = NULL;
2456       
2457        ostrcatbig(&buf, "<td><font class=label>after event:&nbsp;</font></td>", &maxlen, &pos);
2458        ostrcatbig(&buf, "<td><select name=\"afterevent\" border=0><option selected>", &maxlen, &pos);
2459        ostrcatbig(&buf, "auto", &maxlen, &pos);
2460        ostrcatbig(&buf, "<option>auto<option>nothing<option>standby<option>off</select></td></tr>", &maxlen, &pos);
2461       
2462        ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
2463
2464        //ostrcatbig(&buf, param, &maxlen, &pos);
2465        return buf;
2466}
2467
2468char* webrectimercheck(char* param, int fmt)
2469{
2470        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;
2471        int maxlen = 0, pos = 0, channelfind = 0;
2472        struct channel *channel1 = NULL;
2473       
2474        anode = ostrstr(param, "node=");
2475        if(anode != NULL)
2476                anode = anode + 5;
2477        name = ostrstr(param, "name=");
2478        if(name != NULL)
2479                name = name + 5;
2480        begin = ostrstr(param, "begin=");
2481        if(begin != NULL)
2482                begin = begin + 6;
2483        end = ostrstr(param, "end=");
2484        if(end != NULL)
2485                end = end + 4;
2486        type = ostrstr(param, "type=");
2487        if(type != NULL)
2488                type = type + 5;
2489        channelname = ostrstr(param, "channel=");
2490        if(channelname != NULL)
2491                channelname = channelname + 8;
2492        ext = ostrstr(param, "ext=");
2493        if(ext != NULL)
2494                ext = ext + 4;
2495        afterevent = ostrstr(param, "afterevent=");
2496        if(afterevent != NULL)
2497                afterevent = afterevent + 11;
2498        repeat = ostrstr(param, "repeat=");
2499        if(repeat != NULL)
2500                repeat = repeat + 7;
2501
2502        param1 = ostrcat(param, NULL, 0, 0);
2503        string = param;
2504        while(string != NULL)
2505        {
2506                string = strchr(string, '&');
2507                if(string != NULL)
2508                        *string++ = '\0';
2509        }
2510       
2511        ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
2512        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
2513        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
2514       
2515        if(anode != NULL)
2516        {
2517                ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
2518                ostrcatbig(&buf, anode, &maxlen, &pos);
2519                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2520        }
2521       
2522        if(name != NULL)
2523        {       
2524                ostrcatbig(&buf, "<input type=\"hidden\" name=\"name\" value=\"", &maxlen, &pos);
2525                ostrcatbig(&buf, name, &maxlen, &pos);
2526                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2527        }
2528       
2529        if(begin != NULL)
2530        {
2531                ostrcatbig(&buf, "<input type=\"hidden\" name=\"begin\" value=\"", &maxlen, &pos);
2532                ostrcatbig(&buf, begin, &maxlen, &pos);
2533                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2534        }
2535       
2536        if(end != NULL)
2537        {
2538                ostrcatbig(&buf, "<input type=\"hidden\" name=\"end\" value=\"", &maxlen, &pos);
2539                ostrcatbig(&buf, end, &maxlen, &pos);             
2540                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2541        }
2542       
2543        if(type != NULL)
2544        {
2545                ostrcatbig(&buf, "<input type=\"hidden\" name=\"type\" value=\"", &maxlen, &pos);
2546                ostrcatbig(&buf, type, &maxlen, &pos);
2547                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2548        }
2549       
2550        if(ext != NULL)
2551        {
2552                ostrcatbig(&buf, "<input type=\"hidden\" name=\"ext\" value=\"", &maxlen, &pos);
2553                ostrcatbig(&buf, ext, &maxlen, &pos);
2554                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2555        }
2556       
2557        if(afterevent != NULL)
2558        {
2559                ostrcatbig(&buf, "<input type=\"hidden\" name=\"afterevent\" value=\"", &maxlen, &pos);
2560                ostrcatbig(&buf, afterevent, &maxlen, &pos);
2561                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2562        }
2563       
2564        if(repeat != NULL)
2565        {
2566                ostrcatbig(&buf, "<input type=\"hidden\" name=\"repeat\" value=\"", &maxlen, &pos);
2567                ostrcatbig(&buf, repeat, &maxlen, &pos);
2568                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2569        }
2570       
2571        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
2572        ostrcatbig(&buf, "<td><select name=sid size=10 border=0>", &maxlen, &pos);
2573       
2574        /*
2575        channel1 = channel;             
2576        while(channel1 != NULL)
2577        {
2578                if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1))
2579                {
2580                        if(channelfind == 0)
2581                                ostrcatbig(&buf, "<option selected value=\"", &maxlen, &pos);
2582                        else
2583                                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
2584                       
2585                        buf1 = oitoa(channel1->serviceid);
2586                        ostrcatbig(&buf, buf1, &maxlen, &pos);
2587                        free(buf1); buf1 = NULL;
2588                        ostrcatbig(&buf, "&tid=", &maxlen, &pos);
2589                        buf1 = ollutoa(channel1->transponderid);
2590                        ostrcatbig(&buf, buf1, &maxlen, &pos);
2591                        free(buf1); buf1 = NULL;
2592                        ostrcatbig(&buf, "\">", &maxlen, &pos);
2593                       
2594                        ostrcatbig(&buf, channel1->name, &maxlen, &pos);
2595                        ostrcatbig(&buf, " (", &maxlen, &pos);
2596                       
2597                        //get satname from channel
2598                        if(channel1->transponder != NULL)
2599                        {
2600                                struct sat* snode = getsatbyorbitalpos(channel1->transponder->orbitalpos);
2601                                if(snode != NULL)
2602                                        ostrcatbig(&buf, snode->name, &maxlen, &pos);
2603                                else
2604                                        ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
2605                                       
2606                                if(channel1->provider != NULL)
2607                                        ostrcatbig(&buf, " - ", &maxlen, &pos);                 
2608                        }
2609                       
2610                        //get provider from channel
2611                        if(channel1->provider != NULL)
2612                        {
2613                                if(channel1->provider->name != NULL)
2614                                        ostrcatbig(&buf, channel1->provider->name, &maxlen, &pos);
2615                                else
2616                                        ostrcatbig(&buf, _("unknown"), &maxlen, &pos);                 
2617                        }
2618                       
2619                        ostrcatbig(&buf, ")", &maxlen, &pos);   
2620                       
2621                        channelfind++;
2622                }
2623                channel1 = channel1->next;
2624        }
2625        */
2626       
2627        if(channelfind == 0)
2628        {
2629                channel1 = channel;             
2630                while(channel1 != NULL)
2631                {
2632                        if(ostrstrcase(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1))
2633                        {
2634                                if(channelfind == 0)
2635                                        ostrcatbig(&buf, "<option selected value=\"", &maxlen, &pos);
2636                                else
2637                                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
2638                               
2639                                buf1 = oitoa(channel1->serviceid);
2640                                ostrcatbig(&buf, buf1, &maxlen, &pos);
2641                                free(buf1); buf1 = NULL;
2642                                ostrcatbig(&buf, "&tid=", &maxlen, &pos);
2643                                buf1 = ollutoa(channel1->transponderid);
2644                                ostrcatbig(&buf, buf1, &maxlen, &pos);
2645                                free(buf1); buf1 = NULL;
2646                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2647                               
2648                                ostrcatbig(&buf, channel1->name, &maxlen, &pos);
2649                                ostrcatbig(&buf, " (", &maxlen, &pos);
2650                               
2651                                //get satname from channel
2652                                if(channel1->transponder != NULL)
2653                                {
2654                                        struct sat* snode = getsatbyorbitalpos(channel1->transponder->orbitalpos);
2655                                        if(snode != NULL)
2656                                                ostrcatbig(&buf, snode->name, &maxlen, &pos);
2657                                        else
2658                                                ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
2659                                               
2660                                        if(channel1->provider != NULL)
2661                                                ostrcatbig(&buf, " - ", &maxlen, &pos);                 
2662                                }
2663                               
2664                                //get provider from channel
2665                                if(channel1->provider != NULL)
2666                                {
2667                                        if(channel1->provider->name != NULL)
2668                                                ostrcatbig(&buf, channel1->provider->name, &maxlen, &pos);
2669                                        else
2670                                                ostrcatbig(&buf, _("unknown"), &maxlen, &pos);                 
2671                                }
2672                               
2673                                ostrcatbig(&buf, ")", &maxlen, &pos);   
2674                               
2675                                channelfind++;
2676                        }
2677                        channel1 = channel1->next;
2678                }
2679        }
2680       
2681        ostrcatbig(&buf, "</td></tr></table><br><br></select><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
2682
2683        if(channelfind < 2)
2684        {
2685                free(buf); buf = NULL;
2686                buf = webrectimersend(param1, fmt);     
2687                free(param1); param1 = NULL;
2688        }
2689
2690        return buf;             
2691}
2692
2693char* webrectimersend(char* param, int fmt)
2694{
2695        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;
2696        int newnode = 0, channelfind = 0;
2697        struct rectimer *node = NULL;
2698        char* tmpstr = NULL;
2699        struct tm* loctime = NULL;
2700        struct channel *channel1 = NULL;
2701
2702        anode = ostrstr(param, "node=");
2703        if(anode != NULL)
2704                anode = anode + 5;
2705        name = ostrstr(param, "name=");
2706        if(name != NULL)
2707                name = name + 5;
2708        begin = ostrstr(param, "begin=");
2709        if(begin != NULL)
2710                begin = begin + 6;
2711        end = ostrstr(param, "end=");
2712        if(end != NULL)
2713                end = end + 4;
2714        type = ostrstr(param, "type=");
2715        if(type != NULL)
2716                type = type + 5;
2717        channelname = ostrstr(param, "channel=");
2718        if(channelname != NULL)
2719                channelname = channelname + 8;
2720        sid = ostrstr(param, "sid=");
2721        if(sid != NULL)
2722                sid = sid + 4;
2723        tid = ostrstr(param, "tid=");
2724        if(tid != NULL)
2725                tid = tid + 4;
2726        ext = ostrstr(param, "ext=");
2727        if(ext != NULL)
2728                ext = ext + 4;
2729        afterevent = ostrstr(param, "afterevent=");
2730        if(afterevent != NULL)
2731                afterevent = afterevent + 11;
2732        repeat = ostrstr(param, "repeat=");
2733        if(repeat != NULL)
2734                repeat = repeat + 7;
2735       
2736        string = param;
2737        while(string != NULL)
2738        {       
2739                string = strchr(string, '&');
2740                if(string != NULL)
2741                        *string++ = '\0';
2742        }
2743       
2744        if((sid == NULL && tid != NULL) || (sid != NULL && tid == NULL))
2745        {
2746                buf = ostrcat(buf, "ERROR: sid and tid required or only channel", 1, 0);       
2747                return buf;
2748        }
2749               
2750        if(channelname != NULL && sid == NULL)
2751        {
2752                channelfind = 0;
2753                channel1 = channel;
2754                while(channel1 != NULL)
2755                {
2756                        if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1))
2757                        {
2758                                        channelfind = 1;
2759                                        break;
2760                        }
2761                        channel1 = channel1->next;
2762                }
2763                if(channelfind == 0)
2764                {
2765                        channel1 = channel;             
2766                        while(channel1 != NULL)
2767                        {
2768                                if(ostrstr(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1))
2769                                {
2770                                                channelfind = 1;
2771                                                break;
2772                                }
2773                                channel1 = channel1->next;
2774                        }
2775                }
2776                if(channelfind == 0)
2777                {
2778                        buf = ostrcat(buf, "ERROR: channel not found", 1, 0);   
2779                        return buf;
2780                }
2781        }
2782       
2783        newnode = 0;
2784        node = getrectimerbytimestamp(anode);
2785        if(node == NULL)
2786        {
2787                node = addrectimernode(NULL, NULL);
2788                if(node != NULL)
2789                {
2790                        newnode = 1;
2791                        node->pincode = ostrcat("0000", NULL, 0, 0);
2792                        node->recpath = ostrcat(NULL, getconfig("rec_path", NULL), 0, 0);
2793                        node->afterevent = 0;
2794                        node->repeate = 0;
2795                }
2796        }
2797       
2798        if(node != NULL)
2799        {
2800                if(channelfind == 1 && channel1 != NULL)
2801                {
2802                        node->serviceid = channel1->serviceid;
2803                        node->servicetype = channel1->servicetype;
2804                        node->transponderid = channel1->transponderid;
2805                }
2806       
2807                if(sid != NULL && tid != NULL)
2808                {
2809                        node->serviceid = atoi(sid);
2810                        node->transponderid = strtoull(tid, NULL, 10);
2811                        node->servicetype = 0;
2812                }
2813       
2814                free(node->name); node->name = NULL;
2815                node->name = ostrcat(name, NULL, 0, 0);
2816       
2817                if(ostrcmp(type, "record") == 0)
2818                        node->justplay = 0;
2819                else
2820                        node->justplay = 1;
2821                       
2822                if(afterevent != NULL)
2823                {
2824                        if(ostrcmp(afterevent, "auto") == 0)
2825                                node->afterevent = 0;
2826                        else if(ostrcmp(afterevent, "nothing") == 0)
2827                                node->afterevent = 1;
2828                        else if(ostrcmp(afterevent, "standby") == 0)
2829                                node->afterevent = 2;
2830                        else if(ostrcmp(afterevent, "off") == 0)
2831                                node->afterevent = 3;
2832                }
2833
2834                if(repeat != NULL)
2835                        node->repeate = atoi(repeat);
2836       
2837                loctime = olocaltime(&node->begin);
2838                if(loctime != NULL && begin != NULL)
2839                {
2840                        tmpstr = strptime(begin, "%H:%M %d-%m-%Y", loctime);
2841                        if(tmpstr != NULL) {
2842                                loctime->tm_isdst = -1;
2843                                node->begin = mktime(loctime);
2844                        }
2845                }
2846                if(node->justplay == 0 && newnode == 1) node->begin -= getconfigint("recforerun" , NULL) * 60;
2847                node->begin -= (node->begin % 60);
2848                tmpstr = NULL;
2849                free(loctime); loctime = NULL;
2850
2851                loctime = olocaltime(&node->end);
2852                if(loctime != NULL && end != NULL)
2853                {
2854                        tmpstr = strptime(end, "%H:%M %d-%m-%Y", loctime);
2855                        if(tmpstr != NULL) {
2856                                loctime->tm_isdst = -1;
2857                                node->end = mktime(loctime);
2858                        }
2859                }
2860                if(node->justplay == 0 && newnode == 1) node->end += getconfigint("recoverrun" , NULL) * 60;
2861                node->end -= (node->end % 60);
2862                tmpstr = NULL;
2863                free(loctime); loctime = NULL;
2864
2865                if(newnode == 1)
2866                        node->disabled = 0;
2867       
2868                status.writerectimer = 1;
2869                writerectimer(getconfig("rectimerfile", NULL), 0);
2870               
2871                if(ext == NULL)
2872                        buf = webgetrectimer(NULL, 0, fmt);
2873                else
2874                {
2875                        buf = ostrcat(buf, "ok -> TimerID=", 1, 0);
2876                        buf = ostrcat(buf, node->timestamp, 1, 0);
2877                }
2878        }
2879        else
2880                buf = ostrcat(buf, "Timer not ok", 1, 0);
2881
2882        return buf;
2883}
2884
2885char* webeditrectimer(char* param, int fmt)
2886{
2887        char* buf = NULL, *buf1 = NULL, *buf2 = NULL;
2888        int maxlen = 0, pos = 0;
2889        struct rectimer *node = NULL;
2890        struct tm* loctime = NULL;
2891
2892        node = getrectimerbytimestamp(param);
2893        if(node == NULL) return NULL;
2894               
2895        ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
2896        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
2897        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
2898        ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
2899        ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
2900        ostrcatbig(&buf, "\">", &maxlen, &pos);
2901        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
2902        ostrcatbig(&buf, "<td><font class=label>Name:&nbsp;</font></td>", &maxlen, &pos);
2903        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"name\" value=\"", &maxlen, &pos);
2904        ostrcatbig(&buf, node->name, &maxlen, &pos);
2905        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2906
2907        ostrcatbig(&buf, "<td><font class=label>Type:&nbsp;</font></td>", &maxlen, &pos);
2908        ostrcatbig(&buf, "<td><select name=\"type\" border=0><option selected>", &maxlen, &pos);
2909        if( node->justplay == 0 )
2910                ostrcatbig(&buf, "record", &maxlen, &pos);
2911        else
2912                ostrcatbig(&buf, "switch channel", &maxlen, &pos);
2913        ostrcatbig(&buf, "<option>record<option>switch channel</select></td></tr>", &maxlen, &pos);
2914       
2915        /*ostrcatbig(&buf, "<td><font class=label>Repeate:&nbsp;</font></td>", &maxlen, &pos);
2916        ostrcatbig(&buf, "<td><select name=\"repeate\" border=0><option selected>", &maxlen, &pos);
2917        if( node->repeate == 0 )
2918                ostrcatbig(&buf, "once", &maxlen, &pos);
2919        else
2920                ostrcatbig(&buf, "repeate", &maxlen, &pos);
2921        ostrcatbig(&buf, "<option>once<option>repeate</select></td></tr>", &maxlen, &pos);     
2922        */
2923       
2924        /*ostrcatbig(&buf, "<td><font class=label>Repeate type:&nbsp;</font></td>", &maxlen, &pos);
2925        ostrcatbig(&buf, "<td><select name=\"repeatetype\" border=0><option selected>", &maxlen, &pos);
2926        if( node->repeate == 0 )
2927                ostrcatbig(&buf, "daily", &maxlen, &pos);
2928        else if( node->repeate == 1 )
2929                ostrcatbig(&buf, "weekly", &maxlen, &pos);
2930        else if( node->repeate == 2 )
2931                ostrcatbig(&buf, "workdays", &maxlen, &pos);
2932        else
2933                ostrcatbig(&buf, "user defined", &maxlen, &pos);
2934        ostrcatbig(&buf, "<option>daily<option>weekly<option>workdays<option>user defined</select></td></tr>", &maxlen, &pos); 
2935        */
2936               
2937        buf2 = malloc(20);
2938        loctime = olocaltime(&node->begin);
2939        if(loctime != NULL && buf2 != NULL)
2940                strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime);
2941        free(loctime); loctime = NULL;
2942
2943        buf1 = ostrcat(buf2, NULL, 0, 0);
2944        ostrcatbig(&buf, "<td><font class=label>Begin:&nbsp;</font></td>", &maxlen, &pos);
2945        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"begin\" value=\"", &maxlen, &pos);
2946        ostrcatbig(&buf, buf1, &maxlen, &pos);
2947        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2948        free(buf1); buf1 = NULL;
2949       
2950        loctime = olocaltime(&node->end);
2951        if(loctime != NULL && buf2 != NULL)
2952                strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime);
2953        free(loctime); loctime = NULL;
2954
2955        buf1 = ostrcat(buf2, NULL, 0, 0);
2956        ostrcatbig(&buf, "<td><font class=label>End:&nbsp;</font></td>", &maxlen, &pos);
2957        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"end\" value=\"", &maxlen, &pos);
2958        ostrcatbig(&buf, buf1, &maxlen, &pos);
2959        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2960        free(buf1); buf1 = NULL;
2961        free(buf2); buf2 = NULL;
2962       
2963        ostrcatbig(&buf, "<td><font class=label>after event:&nbsp;</font></td>", &maxlen, &pos);
2964        ostrcatbig(&buf, "<td><select name=\"afterevent\" border=0><option selected>", &maxlen, &pos);
2965        if( node->afterevent == 0 )
2966                ostrcatbig(&buf, "auto", &maxlen, &pos);
2967        else if( node->afterevent == 1 )
2968                ostrcatbig(&buf, "nothing", &maxlen, &pos);
2969        else if( node->afterevent == 2 )
2970                ostrcatbig(&buf, "standby", &maxlen, &pos);
2971        else if( node->afterevent == 3 )
2972                ostrcatbig(&buf, "off", &maxlen, &pos);
2973        else
2974                ostrcatbig(&buf, "auto", &maxlen, &pos);
2975        ostrcatbig(&buf, "<option>auto<option>nothing<option>standby<option>off</select></td></tr>", &maxlen, &pos);
2976       
2977        ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
2978       
2979        //ostrcatbig(&buf, param, &maxlen, &pos);
2980        return buf;
2981}
2982
2983char* webdelrectimer(char* param, int fmt)
2984{
2985        char* buf = NULL, *string = NULL, *timerid = NULL;
2986        struct rectimer *node = NULL;
2987        int ext = 0;
2988       
2989        timerid = ostrstr(param, "timerid=");
2990        if(timerid != NULL)
2991        {
2992                timerid = timerid + 8;
2993                ext = 1;
2994        }
2995
2996        node = NULL;
2997        if(ext == 1)
2998        {
2999                string = param;
3000                while(string != NULL)
3001                {       
3002                        string = strchr(string, '&');
3003                        if(string != NULL)
3004                                *string++ = '\0';
3005                }
3006                node = getrectimerbytimestamp(timerid);
3007        }
3008        else
3009                node = getrectimerbytimestamp(param);
3010
3011        if(node == NULL)
3012        {
3013                buf = ostrcat(buf, "ERROR: timer not found", 1, 0);     
3014                return buf;
3015        }
3016       
3017        delrectimer(node, 1, 0);
3018       
3019        if(ext == 1)
3020                buf = ostrcat(buf, "ok -> timer deleted", 1, 0);
3021        else
3022                buf = webgetrectimer(NULL, 0, fmt);
3023       
3024        return buf;
3025}
3026
3027void putxmessage(struct stimerthread* timernode, char* captiontime, char* body)
3028{
3029        struct splitstr* ret1 = NULL;
3030        char* caption = NULL;
3031        int count1 = 0;
3032        int timeout = 5;
3033
3034        ret1 = strsplit(captiontime, "\t", &count1);
3035
3036        if(count1 >= 2)
3037        {
3038                caption = ostrcat(caption, (&ret1[0])->part, 1, 0);
3039                if((&ret1[1])->part != NULL)
3040                        timeout = atoi((&ret1[1])->part);
3041                textbox(caption, body, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 280, timeout, 0);
3042        }
3043
3044        free(caption); free(body); free(captiontime); free(ret1);
3045}
3046
3047void xmessage(char* filename)
3048{
3049        char* param=NULL, *param1 = NULL, *param2 = NULL, *param3 = NULL, *param4 = NULL;
3050        char* caption=NULL, *body=NULL;
3051        char* timeout=NULL;
3052
3053        param4 = ostrstr(filename, "icon=");
3054        param3 = ostrstr(filename, "charset=");
3055        param2 = ostrstr(filename, "timeout=");
3056        param1 = ostrstr(filename, "caption=");
3057        param = ostrstr(filename, "body=");
3058
3059        if(param4 != NULL)
3060        {
3061                param4 = param4 - 1;
3062                *param4 = '\0';
3063                param4 = param4 + 5;
3064                *param4++ = '\0';
3065        }
3066        if(param3 != NULL)
3067        {
3068                param3 = param3 - 1;
3069                *param3 = '\0';
3070                param3 = param3 + 8;
3071                *param3++ = '\0';
3072        }
3073        if(param2 != NULL)
3074        {
3075                param2 = param2 - 1;
3076                *param2 = '\0';
3077                param2 = param2 + 8;
3078                *param2++ = '\0';
3079        }
3080        if(param1 != NULL)
3081        {
3082                param1 = param1 - 1;
3083                *param1 = '\0';
3084                param1 = param1 + 8;
3085                *param1++ = '\0';
3086        }
3087        if(param != NULL)
3088        {
3089                param = param - 1;
3090                *param = '\0';
3091                param = param + 5;
3092                *param++ = '\0';
3093                body = ostrcat(body, param, 1, 0);
3094        }
3095        else
3096                body = ostrcat(body, " ", 1, 0);
3097               
3098        if(param2 != NULL)
3099                timeout = ostrcat(timeout, param2, 1, 0);
3100        else
3101                timeout = ostrcat(timeout, "5", 1, 0);
3102               
3103        if(param1 != NULL)
3104                caption = ostrcat(caption, param1, 1, 0);
3105        else
3106                caption = ostrcat(caption, "XMESSAGE", 1, 0);
3107       
3108        caption = ostrcat(caption, "\t", 1, 0);
3109        caption = ostrcat(caption, timeout, 1, 1);
3110               
3111        addtimer(&putxmessage, START, 1000, 1, (void*)caption, (void*)body, NULL);
3112        return;
3113}
3114
3115char* webgetvol(int fmt)
3116{
3117        char* buf = NULL;
3118
3119        buf = oitoa(getvol());
3120        return buf;
3121}
3122
3123char* webgetrecsteampath(int fmt)
3124{
3125        char* buf = NULL;
3126       
3127        if(getconfig("rec_streampath", NULL) == NULL)
3128                buf = ostrcat(buf, "/var/media/hdd/movie", 1, 0);
3129        else
3130                buf = ostrcat(buf, getconfig("rec_streampath", NULL), 1, 0);
3131
3132        return buf;
3133}
3134
3135char* webgetmute(int fmt)
3136{
3137        char* buf = NULL;
3138
3139        buf = oitoa(status.mute);
3140        return buf;
3141}
3142
3143char* webgetrccodes(int fmt)
3144{
3145        int i = 0;
3146        char* buf = NULL;
3147        struct clist* node = NULL;
3148
3149        m_lock(&status.clistmutex, 12);
3150        struct clist **clist = rcconfig;
3151
3152        for(i = 0; i < LISTHASHSIZE; i++)
3153        {
3154                node = clist[i];
3155
3156                while(node != NULL)
3157                {
3158                        buf = ostrcat(buf, node->key, 1, 0);
3159                        buf = ostrcat(buf, "#", 1, 0);
3160                        buf = ostrcat(buf, node->value, 1, 0);
3161                        buf = ostrcat(buf, "\n", 1, 0);
3162                        node = node->next;
3163                }
3164        }
3165
3166        m_unlock(&status.clistmutex, 12);
3167        return buf;
3168}
3169
3170char* webgetconfig(int fmt)
3171{
3172        char* buf = NULL;
3173        struct clist *node = NULL;
3174        int i = 0;
3175
3176        m_lock(&status.clistmutex, 12);
3177        if(fmt == 0)
3178        {
3179                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
3180                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
3181                buf = ostrcat(buf, "</head><body class=body id=\"configinfo\">", 1, 0);
3182        }
3183                                                       
3184        struct clist **clist = config;
3185
3186        for(i = 0; i < LISTHASHSIZE; i++)
3187        {
3188                node = clist[i];
3189
3190                while(node != NULL)
3191                {
3192                        if(node->tmp != NULL && strlen(node->tmp) > 0)
3193                        {
3194                                buf = ostrcat(buf, node->key, 1, 0);
3195                                buf = ostrcat(buf, "#", 1, 0);
3196                                buf = ostrcat(buf, node->tmp, 1, 0);
3197                                buf = ostrcat(buf, "\n", 1, 0);
3198                        }
3199                        else if(node->value != NULL)
3200                        {
3201                                buf = ostrcat(buf, node->key, 1, 0);
3202                                buf = ostrcat(buf, "#", 1, 0);
3203                                buf = ostrcat(buf, node->value, 1, 0);
3204                                buf = ostrcat(buf, "\n", 1, 0);
3205                        }
3206                        else
3207                        {
3208                                buf = ostrcat(buf, node->key, 1, 0);
3209                                buf = ostrcat(buf, "#", 1, 0);
3210                                buf = ostrcat(buf, node->def, 1, 0);
3211                                buf = ostrcat(buf, "\n", 1, 0);
3212                        }
3213
3214                        node = node->next;
3215                }
3216        }
3217       
3218        buf = ostrcat(buf, "</body></html>", 1, 0);
3219
3220        m_unlock(&status.clistmutex, 12);
3221        return buf;
3222}
3223
3224char* webgetsysteminfo(int fmt)
3225{
3226        char* buf = NULL;
3227        char* imgversion = NULL;
3228
3229        if(fmt == 0)
3230        {
3231                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
3232                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
3233                buf = ostrcat(buf, "</head><body class=body id=\"systeminfo\">", 1, 0);
3234        }
3235
3236        buf = ostrcat(buf, PROGNAME, 1, 0);
3237        buf = ostrcat(buf, "#", 1, 0);
3238        buf = ostrcat(buf, COPYRIGHT, 1, 0);
3239        buf = ostrcat(buf, "#", 1, 0);
3240        buf = ostrcat(buf, OVERSION, 1, 0);
3241        buf = ostrcat(buf, "#", 1, 0);
3242       
3243        if(isfile(getconfig("imagenamefile", NULL))     != 0)
3244                imgversion = readsys(getconfig("imagenamefile", NULL), 1);
3245        else
3246                imgversion = ostrcat("unknown", NULL, 0, 0);
3247       
3248        buf = ostrcat(buf, imgversion, 1, 1);
3249        buf = ostrcat(buf, "#", 1, 0);
3250        buf = ostrcat(buf, getboxtype(), 1, 0);
3251        buf = ostrcat(buf, "#", 1, 0);
3252        buf = ostrcat(buf, ollutoa(time(NULL)), 1, 1);
3253        buf = ostrcat(buf, "#", 1, 0);
3254
3255        if(status.standby == 0)
3256                buf = ostrcat(buf, "0", 1, 0);
3257        else
3258                buf = ostrcat(buf, "1", 1, 0);
3259       
3260        buf = ostrcat(buf, "</body></html>", 1, 0);
3261
3262        return buf;
3263}
3264
3265char* webgetchannellock(char* param, int fmt)
3266{
3267        char* buf = NULL, *param1 = NULL;
3268        struct channel* chnode = NULL;
3269
3270        if(param == NULL) return NULL;
3271
3272        //create param1
3273        param1 = strchr(param, '&');
3274        if(param1 != NULL)
3275                *param1++ = '\0';
3276
3277        if(param1 == NULL) return NULL;
3278
3279        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
3280        if(chnode != NULL)
3281        {
3282                buf = ostrcat(buf, chnode->name, 1, 0);
3283                buf = ostrcat(buf, "#", 1, 0);
3284                buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
3285                buf = ostrcat(buf, "#", 1, 0);
3286                buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
3287                buf = ostrcat(buf, "#", 1, 0);
3288
3289                if(channelnottunable(chnode) == 1)
3290                        buf = ostrcat(buf, "1", 1, 0);
3291                else
3292                        buf = ostrcat(buf, "0", 1, 0);
3293        }
3294        else
3295                buf = ostrcat("no data", NULL, 0, 0);
3296
3297        return buf;
3298}
3299
3300char* webgetbouquetepg(char* param, int fmt)
3301{
3302        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
3303        char* param1 = NULL, *param2 = NULL, *param3 = NULL;
3304        struct mainbouquet *mbouquet = NULL;
3305        struct bouquet *node = NULL;
3306        struct channel* chnode = NULL;
3307        struct epg* epgnode = NULL;
3308        int longepg = 0;
3309        time_t start = 0, end = 0;
3310
3311        if(param == NULL) return NULL;
3312
3313        //create param1 + 2 + 3
3314        param1 = strchr(param, '&');
3315        if(param1 != NULL)
3316        {
3317                *param1++ = '\0';
3318                param2 = strchr(param1, '&');
3319                if(param2 != NULL)
3320                {
3321                        *param2++ = '\0';
3322                        param3 = strchr(param2, '&');
3323                        if(param3 != NULL)
3324                                *param3++ = '\0';
3325                }
3326        }
3327        if(param1 == NULL || param2 == NULL || param3 == NULL) return NULL;
3328
3329        longepg = atoi(param1);
3330        start = atoi(param2);
3331        end = atoi(param3);
3332
3333        mbouquet = getmainbouquet(param);
3334        if(mbouquet != NULL)
3335        {
3336                node = mbouquet->bouquet;
3337                tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
3338                tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
3339                tmpstr1 = htmlencode(tmpstr);
3340                free(tmpstr); tmpstr = NULL;
3341                while(node != NULL)
3342                {
3343                        chnode = getchannel(node->serviceid, node->transponderid);
3344                        if(chnode != NULL)
3345                        {
3346                                buf = ostrcat(buf, "BeginNewChannel", 1, 0);
3347                                buf = ostrcat(buf, "#", 1, 0);
3348                                buf = ostrcat(buf, chnode->name, 1, 0);
3349                                buf = ostrcat(buf, "#", 1, 0);
3350                                buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
3351                                buf = ostrcat(buf, "#", 1, 0);
3352                                buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
3353                                buf = ostrcat(buf, "#", 1, 0);
3354                                buf = ostrcat(buf, oitoa(chnode->servicetype), 1, 1);
3355                                buf = ostrcat(buf, "\n", 1, 0);
3356
3357                                epgnode = chnode->epg;
3358                                while(epgnode != NULL)
3359                                {
3360                                        if((epgnode->starttime >= start && epgnode->starttime < end) || (epgnode->endtime > start && epgnode->endtime <= end) || (epgnode->starttime < start && epgnode->endtime > end))
3361                                        {
3362                                                buf = ostrcat(buf, epgnode->title, 1, 0);
3363                                                buf = ostrcat(buf, "#", 1, 0);
3364                                                buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
3365                                                buf = ostrcat(buf, "#", 1, 0);
3366                                                buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
3367                                                buf = ostrcat(buf, "#", 1, 0);
3368                                                buf = ostrcat(buf, epgnode->subtitle, 1, 0);
3369                                                buf = ostrcat(buf, "#", 1, 0);
3370
3371                                                if(longepg == 1)
3372                                                {
3373                                                        tmpstr = epgdescunzip(epgnode);
3374                                                        if(tmpstr != NULL)
3375                                                                buf = ostrcat(buf, tmpstr, 1, 0);
3376                                                        free(tmpstr); tmpstr = NULL;
3377                                                }
3378
3379                                                buf = ostrcat(buf, "#", 1, 0);
3380                                                buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1);
3381                                                buf = ostrcat(buf, "\n", 1, 0);
3382                                        }
3383
3384                                        epgnode = epgnode->next;
3385                                }
3386                        }
3387                        node = node->next;
3388                }
3389                free(tmpstr1); tmpstr1 = NULL;
3390        }
3391
3392        if(buf == NULL)
3393                buf = ostrcat("no data", NULL, 0, 0);
3394        return buf;
3395}
3396
3397char* webadjust(char* param, int fmt)
3398{
3399printf("webadjust param: %s\n",param);
3400printf("webadjust fmt: %d\n",fmt);
3401
3402        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *sendstr = NULL;
3403        int i = 0, max = 0, count = 0, maxlen = 0, pos = 0;
3404
3405       
3406        ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
3407        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
3408        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
3409        ostrcatbig(&buf, "<input type=\"hidden\" name=\"adjustsend&node\" value=\"", &maxlen, &pos);
3410        ostrcatbig(&buf, "0", &maxlen, &pos);
3411        ostrcatbig(&buf, "\">", &maxlen, &pos);
3412//      ostrcatbig(&buf, "<input type=\"hidden\" name=\"adjustsend\">", &maxlen, &pos);
3413        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
3414
3415        ostrcatbig(&buf, "<table>", &maxlen, &pos);
3416
3417///////////////////
3418//      ostrcatbig(&buf, "<tr><td><font class=\"label\">Volbartimeout:&nbsp;</font></td><td><select name=\"volbartimeout\" border=\"0\"><option value=\"1\" selected>1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"6\">6</option><option value=\"7\">7</option><option value=\"8\">8</option><option value=\"9\">9</option><option value=\"10\">10</option></select></td></tr>", &maxlen, &pos);
3419        max = 10;
3420        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3421        ostrcatbig(&buf, _("Volumebar Timeout"), &maxlen, &pos);
3422        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"volbartimeout\" border=\"0\">", &maxlen, &pos);
3423        for(i = 1; i <= max; i++)
3424        {
3425                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3426                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);             
3427                if(getconfigint("volbartimeout", NULL) == i)
3428                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3429                else
3430                        ostrcatbig(&buf, "\">", &maxlen, &pos);
3431                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3432                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3433        }
3434        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3435        sendstr = ostrcat(sendstr, "volbartimeout.value", 1 , 0);
3436
3437///////////////////
3438//      ostrcatbig(&buf, "<tr><td><font class=\"label\">Infobartimeout:&nbsp;</font></td><td><select name=\"infobartimeout\" border=\"0\"><option value=\"1\" selected>1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"6\">6</option><option value=\"7\">7</option><option value=\"8\">8</option><option value=\"9\">9</option><option value=\"10\">10</option></select></td></tr>", &maxlen, &pos);
3439        max = 10;
3440        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3441        ostrcatbig(&buf, _("Infobar Timeout"), &maxlen, &pos);
3442        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"infobartimeout\" border=\"0\">", &maxlen, &pos);
3443        for(i = 1; i <= max; i++)
3444        {
3445                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3446                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);     
3447                if(getconfigint("infobartimeout", NULL) == i)
3448                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3449                else
3450                        ostrcatbig(&buf, "\">", &maxlen, &pos);
3451                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3452                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3453        }
3454        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3455        sendstr = ostrcat(sendstr, ", infobartimeout.value", 1 , 0);
3456
3457///////////////////
3458//      ostrcatbig(&buf, "<tr><td><font class=\"label\">Infobar Sleep:&nbsp;</font></td><td><select name=\"infobarsleep\" border=\"0\"><option value=\"0\">0</option><option value=\"1\" selected>1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option></select></td></tr>", &maxlen, &pos);
3459        max = 5;
3460        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3461        ostrcatbig(&buf, _("Infobar Sleep"), &maxlen, &pos);
3462        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"infobarsleep\" border=\"0\">", &maxlen, &pos);
3463        for(i = 0; i <= max; i++)
3464        {
3465                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3466                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);             
3467                if(getconfigint("infobarsleep", NULL) == i)
3468                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3469                else
3470                        ostrcatbig(&buf, "\">", &maxlen, &pos);
3471                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3472                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3473        }
3474        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3475        sendstr = ostrcat(sendstr, ", infobarsleep.value", 1 , 0);
3476
3477///////////////////
3478//      ostrcatbig(&buf, "<tr><td><font class=\"label\">Infobar Sleep:&nbsp;</font></td><td><select name=\"infobarsleep\" border=\"0\"><option value=\"0\">0</option><option value=\"1\" selected>1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option></select></td></tr>", &maxlen, &pos);
3479        max = 5;
3480        tmpstr = ostrcat("1\n3\n9\n12\n15\n18\n21\n24\n27\n30", NULL, 0, 0);
3481
3482        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3483        ostrcatbig(&buf, _("Spinnerspeed"), &maxlen, &pos);
3484        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"spinnerspeed\" border=\"0\">", &maxlen, &pos);
3485
3486        count = 0;
3487        struct splitstr* ret1 = NULL;
3488        ret1 = strsplit(tmpstr, "\n", &count);
3489        max = count - 1;
3490
3491        if(ret1 != NULL)
3492        {
3493                for(i = 0; i <= max; i++)
3494                {
3495                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3496                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3497                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3498                        if(getconfigint("spinnerspeed", NULL) == atoi(tmpstr1))
3499                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3500                        else
3501                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3502                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3503                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3504                }
3505        }
3506        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3507        sendstr = ostrcat(sendstr, ", spinnerspeed.value", 1 , 0);
3508        free(ret1), ret1 = NULL;
3509        free(tmpstr), tmpstr = NULL;
3510        free(tmpstr1), tmpstr1 = NULL;
3511
3512///////////////////
3513        tmpstr = ostrcat("1\n2\n3\n4\n5\n6\n7\n8\n10000", NULL, 0, 0);
3514
3515        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3516        ostrcatbig(&buf, _("Spinnertime"), &maxlen, &pos);
3517        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"spinnertime\" border=\"0\">", &maxlen, &pos);
3518
3519        count = 0;
3520        ret1 = strsplit(tmpstr, "\n", &count);
3521        max = count - 1;
3522
3523        if(ret1 != NULL)
3524        {
3525                for(i = 0; i <= max; i++)
3526                {
3527                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3528                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3529                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3530                        if(getconfigint("spinnertime", NULL) == atoi(tmpstr1)) 
3531                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3532                        else
3533                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3534                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3535                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3536                }
3537        }
3538        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3539        sendstr = ostrcat(sendstr, ", spinnertime.value", 1 , 0);
3540        free(ret1), ret1 = NULL;
3541        free(tmpstr), tmpstr = NULL;
3542        free(tmpstr1), tmpstr1 = NULL;
3543
3544///////////////////
3545        tmpstr = ostrcat("5\n10\n15\n30\n60\n120\n10000", NULL, 0, 0);
3546
3547        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3548        ostrcatbig(&buf, _("Hangtime"), &maxlen, &pos);
3549        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"hangtime\" border=\"0\">", &maxlen, &pos);
3550
3551        count = 0;
3552        ret1 = strsplit(tmpstr, "\n", &count);
3553        max = count - 1;
3554
3555        if(ret1 != NULL)
3556        {
3557                for(i = 0; i <= max; i++)
3558                {
3559                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3560                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);         
3561                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3562                        if(getconfigint("hangtime", NULL) == atoi(tmpstr1))
3563                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3564                        else
3565                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3566                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3567                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3568                }
3569        }
3570        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3571        sendstr = ostrcat(sendstr, ", hangtime.value", 1 , 0);
3572        free(ret1), ret1 = NULL;
3573        free(tmpstr), tmpstr = NULL;
3574        free(tmpstr1), tmpstr1 = NULL;
3575
3576///////////////////
3577//      ostrcatbig(&buf, "<tr><td><font class=\"label\">Second Infobar:&nbsp;</font></td><td><select name=\"secondinfobar\" border=\"0\"><option value=\"0\">no</option><option value=\"1\" selected>infobar</option><option value=\"2\">epg</option><option value=\"3\">channel epg</option></select></td></tr>", &maxlen, &pos);
3578        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3579        ostrcatbig(&buf, _("Second Infobar"), &maxlen, &pos);
3580        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"secondinfobar\" border=\"0\">", &maxlen, &pos);
3581       
3582        if(getconfigint("secondinfobar", NULL) == 0)
3583                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3584        else
3585                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3586        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3587        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3588
3589        if(getconfigint("secondinfobar", NULL) == 1)
3590                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3591        else
3592                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3593        ostrcatbig(&buf, _("infobar"), &maxlen, &pos);
3594        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3595
3596        if(getconfigint("secondinfobar", NULL) == 2)
3597                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
3598        else
3599                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3600        ostrcatbig(&buf, _("epg"), &maxlen, &pos);
3601        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3602
3603        if(getconfigint("secondinfobar", NULL) == 3)
3604                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
3605        else
3606                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
3607        ostrcatbig(&buf, _("Channel EPG"), &maxlen, &pos);
3608        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3609       
3610        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3611        sendstr = ostrcat(sendstr, ", secondinfobar.value", 1 , 0);
3612
3613///////////////////
3614        if(checkbox("ATEMIO7600") != 1)
3615        {
3616                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3617                ostrcatbig(&buf, _("Don't clear TV on zap (only with fastzap)"), &maxlen, &pos);
3618                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"nozapclear\" border=\"0\">", &maxlen, &pos);
3619       
3620                if(getconfigint("nozapclear", NULL) == 0)
3621                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3622                else
3623                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3624                ostrcatbig(&buf, _("no"), &maxlen, &pos);
3625                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3626
3627                if(getconfigint("nozapclear", NULL) == 1)
3628                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3629                else
3630                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3631                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
3632                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3633       
3634                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3635                sendstr = ostrcat(sendstr, ", nozapclear.value", 1 , 0);
3636        }
3637
3638///////////////////
3639        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3640        ostrcatbig(&buf, _("Fastzap"), &maxlen, &pos);
3641        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"fastzap\" border=\"0\">", &maxlen, &pos);
3642       
3643        if(getconfigint("fastzap", NULL) == 0)
3644                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3645        else
3646                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3647        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3648        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3649
3650        if(getconfigint("fastzap", NULL) == 1)
3651                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3652        else
3653                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3654        ostrcatbig(&buf, _("medium"), &maxlen, &pos);
3655        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3656
3657        if(getconfigint("fastzap", NULL) == 2)
3658                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
3659        else
3660                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3661        ostrcatbig(&buf, _("fast"), &maxlen, &pos);
3662        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3663       
3664        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3665        sendstr = ostrcat(sendstr, ", fastzap.value", 1 , 0);
3666
3667///////////////////
3668        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3669        ostrcatbig(&buf, _("Faststop"), &maxlen, &pos);
3670        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"faststop\" border=\"0\">", &maxlen, &pos);
3671       
3672        if(getconfigint("faststop", NULL) == 0)
3673                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3674        else
3675                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3676        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3677        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3678
3679        if(getconfigint("faststop", NULL) == 1)
3680                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3681        else
3682                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3683        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
3684        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3685       
3686        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3687        sendstr = ostrcat(sendstr, ", faststop.value", 1 , 0);
3688
3689///////////////////
3690        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3691        ostrcatbig(&buf, _("Dirsort"), &maxlen, &pos);
3692        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"dirsort\" border=\"0\">", &maxlen, &pos);
3693       
3694        if(getconfigint("dirsort", NULL) == 0)
3695                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3696        else
3697                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3698        ostrcatbig(&buf, _("alpha"), &maxlen, &pos);
3699        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3700
3701        if(getconfigint("dirsort", NULL) == 1)
3702                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3703        else
3704                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3705        ostrcatbig(&buf, _("reverse alpha"), &maxlen, &pos);
3706        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3707
3708        if(getconfigint("dirsort", NULL) == 2)
3709                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
3710        else
3711                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3712        ostrcatbig(&buf, _("size"), &maxlen, &pos);
3713        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3714
3715        if(getconfigint("dirsort", NULL) == 3)
3716                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
3717        else
3718                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
3719        ostrcatbig(&buf, _("reverse size"), &maxlen, &pos);
3720        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3721
3722        if(getconfigint("dirsort", NULL) == 4)
3723                ostrcatbig(&buf, "<option value=\"4\" selected>", &maxlen, &pos);               
3724        else
3725                ostrcatbig(&buf, "<option value=\"4\">", &maxlen, &pos);
3726        ostrcatbig(&buf, _("date"), &maxlen, &pos);
3727        ostrcatbig(&buf, "</option>", &maxlen, &pos);   
3728
3729        if(getconfigint("dirsort", NULL) == 5)
3730                ostrcatbig(&buf, "<option value=\"5\" selected>", &maxlen, &pos);               
3731        else
3732                ostrcatbig(&buf, "<option value=\"5\">", &maxlen, &pos);
3733        ostrcatbig(&buf, _("reverse date"), &maxlen, &pos);
3734        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3735       
3736        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3737        sendstr = ostrcat(sendstr, ", dirsort.value", 1 , 0);
3738
3739///////////////////
3740        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3741        ostrcatbig(&buf, _("Power aktion"), &maxlen, &pos);
3742        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"poweraktion\" border=\"0\">", &maxlen, &pos);
3743       
3744        if(getconfigint("poweraktion", NULL) == 0)
3745                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3746        else
3747                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3748        ostrcatbig(&buf, _("Power Menu"), &maxlen, &pos);
3749        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3750
3751        if(getconfigint("poweraktion", NULL) == 1)
3752                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3753        else
3754                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3755        ostrcatbig(&buf, _("Power Off"), &maxlen, &pos);
3756        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3757
3758        if(getconfigint("poweraktion", NULL) == 2)
3759                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
3760        else
3761                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3762        ostrcatbig(&buf, _("Standby"), &maxlen, &pos);
3763        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3764
3765        if(getconfigint("poweraktion", NULL) == 3)
3766                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
3767        else
3768                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
3769        ostrcatbig(&buf, _("Restart"), &maxlen, &pos);
3770        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3771
3772        if(getconfigint("poweraktion", NULL) == 4)
3773                ostrcatbig(&buf, "<option value=\"4\" selected>", &maxlen, &pos);               
3774        else
3775                ostrcatbig(&buf, "<option value=\"4\">", &maxlen, &pos);
3776        ostrcatbig(&buf, _("Gui Restart"), &maxlen, &pos);
3777        ostrcatbig(&buf, "</option>", &maxlen, &pos);   
3778       
3779        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3780        sendstr = ostrcat(sendstr, ", poweraktion.value", 1 , 0);
3781
3782///////////////////
3783        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3784        ostrcatbig(&buf, _("Virtualzap Timeout"), &maxlen, &pos);
3785        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"virtualzap\" border=\"0\">", &maxlen, &pos);
3786       
3787        if(getconfigint("virtualzap", NULL) == 0)
3788                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3789        else
3790                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3791        ostrcatbig(&buf, _("deaktiv"), &maxlen, &pos);
3792        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3793
3794        if(getconfigint("virtualzap", NULL) == 1)
3795                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3796        else
3797                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3798        ostrcatbig(&buf, _("1 sec"), &maxlen, &pos);
3799        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3800
3801        if(getconfigint("virtualzap", NULL) == 2)
3802                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
3803        else
3804                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3805        ostrcatbig(&buf, _("2 sec"), &maxlen, &pos);
3806        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3807
3808        if(getconfigint("virtualzap", NULL) == 3)
3809                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
3810        else
3811                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
3812        ostrcatbig(&buf, _("endless"), &maxlen, &pos);
3813        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3814       
3815        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3816        sendstr = ostrcat(sendstr, ", virtualzap.value", 1 , 0);
3817       
3818///////////////////
3819        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3820        ostrcatbig(&buf, _("Fast Text Render"), &maxlen, &pos);
3821        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"fasttextrender\" border=\"0\">", &maxlen, &pos);
3822       
3823        if(getconfigint("fasttextrender", NULL) == 0)
3824                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3825        else
3826                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3827        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3828        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3829
3830        if(getconfigint("fasttextrender", NULL) == 1)
3831                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3832        else
3833                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3834        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
3835        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3836       
3837        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3838        sendstr = ostrcat(sendstr, ", fasttextrender.value", 1 , 0);
3839
3840///////////////////
3841        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3842        ostrcatbig(&buf, _("Record Split Size"), &maxlen, &pos);
3843        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recsplitsize\" border=\"0\">", &maxlen, &pos);
3844       
3845        if(getconfigint("recsplitsize", NULL) == 0)
3846                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
3847        else
3848                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3849        ostrcatbig(&buf, _("deaktiv"), &maxlen, &pos);
3850        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3851
3852        if(getconfigint("recsplitsize", NULL) == 1)
3853                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
3854        else
3855                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3856        ostrcatbig(&buf, _("1 GB"), &maxlen, &pos);
3857        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3858
3859        if(getconfigint("recsplitsize", NULL) == 2)
3860                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
3861        else
3862                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3863        ostrcatbig(&buf, _("2 GB"), &maxlen, &pos);
3864        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3865
3866        if(getconfigint("recsplitsize", NULL) == 3)
3867                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
3868        else
3869                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
3870        ostrcatbig(&buf, _("3 GB"), &maxlen, &pos);
3871        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3872
3873        if(getconfigint("recsplitsize", NULL) == 4)
3874                ostrcatbig(&buf, "<option value=\"4\" selected>", &maxlen, &pos);               
3875        else
3876                ostrcatbig(&buf, "<option value=\"4\">", &maxlen, &pos);
3877        ostrcatbig(&buf, _("4 GB"), &maxlen, &pos);
3878        ostrcatbig(&buf, "</option>", &maxlen, &pos);   
3879       
3880        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3881        sendstr = ostrcat(sendstr, ", recsplitsize.value", 1 , 0);
3882
3883///////////////////
3884        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);
3885
3886        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3887        ostrcatbig(&buf, _("Record Forerun (min)"), &maxlen, &pos);
3888        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recforerun\" border=\"0\">", &maxlen, &pos);
3889
3890        count = 0;
3891        ret1 = strsplit(tmpstr, "\n", &count);
3892        max = count - 1;
3893
3894        if(ret1 != NULL)
3895        {
3896                for(i = 0; i <= max; i++)
3897                {
3898                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3899                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);         
3900                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3901                        if(getconfigint("recforerun", NULL) == atoi(tmpstr1))
3902                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3903                        else
3904                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3905                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3906                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3907                }
3908        }
3909        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3910        sendstr = ostrcat(sendstr, ", recforerun.value", 1 , 0);
3911        free(ret1), ret1 = NULL;
3912        free(tmpstr), tmpstr = NULL;
3913        free(tmpstr1), tmpstr1 = NULL;
3914
3915///////////////////
3916        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);
3917
3918        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3919        ostrcatbig(&buf, _("Record Overrun (min)"), &maxlen, &pos);
3920        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recoverrun\" border=\"0\">", &maxlen, &pos);
3921
3922        count = 0;
3923        ret1 = strsplit(tmpstr, "\n", &count);
3924        max = count - 1;
3925
3926        if(ret1 != NULL)
3927        {
3928                for(i = 0; i <= max; i++)
3929                {
3930                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3931                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);         
3932                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3933                        if(getconfigint("recoverrun", NULL) == atoi(tmpstr1))
3934                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3935                        else
3936                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3937                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3938                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3939                }
3940        }
3941        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3942        sendstr = ostrcat(sendstr, ", recoverrun.value", 1 , 0);
3943        free(ret1), ret1 = NULL;
3944        free(tmpstr), tmpstr = NULL;
3945        free(tmpstr1), tmpstr1 = NULL;
3946
3947///////////////////
3948        tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0);
3949
3950        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3951        ostrcatbig(&buf, _("Skip 1/3"), &maxlen, &pos);
3952        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"skip13\" border=\"0\">", &maxlen, &pos);
3953
3954        count = 0;
3955        ret1 = strsplit(tmpstr, "\n", &count);
3956        max = count - 1;
3957
3958        if(ret1 != NULL)
3959        {
3960                for(i = 0; i <= max; i++)
3961                {
3962                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3963                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);         
3964                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3965                        if(getconfigint("skip13", NULL) == atoi(tmpstr1))
3966                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3967                        else
3968                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3969                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3970                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3971                }
3972        }
3973        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3974        sendstr = ostrcat(sendstr, ", skip13.value", 1 , 0);
3975        free(ret1), ret1 = NULL;
3976        free(tmpstr), tmpstr = NULL;
3977        free(tmpstr1), tmpstr1 = NULL;
3978
3979///////////////////
3980        tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0);
3981
3982        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3983        ostrcatbig(&buf, _("Skip 4/6"), &maxlen, &pos);
3984        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"skip46\" border=\"0\">", &maxlen, &pos);
3985
3986        count = 0;
3987        ret1 = strsplit(tmpstr, "\n", &count);
3988        max = count - 1;
3989
3990        if(ret1 != NULL)
3991        {
3992                for(i = 0; i <= max; i++)
3993                {
3994                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3995                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);         
3996                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3997                        if(getconfigint("skip46", NULL) == atoi(tmpstr1))
3998                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
3999                        else
4000                                ostrcatbig(&buf, "\">", &maxlen, &pos);
4001                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4002                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4003                }
4004        }
4005        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4006        sendstr = ostrcat(sendstr, ", skip46.value", 1 , 0);
4007        free(ret1), ret1 = NULL;
4008        free(tmpstr), tmpstr = NULL;
4009        free(tmpstr1), tmpstr1 = NULL;
4010       
4011///////////////////
4012        tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0);
4013
4014        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4015        ostrcatbig(&buf, _("Skip 7/9"), &maxlen, &pos);
4016        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"skip79\" border=\"0\">", &maxlen, &pos);
4017
4018        count = 0;
4019        ret1 = strsplit(tmpstr, "\n", &count);
4020        max = count - 1;
4021
4022        if(ret1 != NULL)
4023        {
4024                for(i = 0; i <= max; i++)
4025                {
4026                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4027                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);         
4028                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4029                        if(getconfigint("skip79", NULL) == atoi(tmpstr1))
4030                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
4031                        else
4032                                ostrcatbig(&buf, "\">", &maxlen, &pos);
4033                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4034                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4035                }
4036        }
4037        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4038        sendstr = ostrcat(sendstr, ", skip79.value", 1 , 0);
4039        free(ret1), ret1 = NULL;
4040        free(tmpstr), tmpstr = NULL;
4041        free(tmpstr1), tmpstr1 = NULL;
4042       
4043///////////////////
4044        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4045        ostrcatbig(&buf, _("Player for .ts"), &maxlen, &pos);
4046        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"playertype\" border=\"0\">", &maxlen, &pos);
4047       
4048        if(getconfigint("playertype", NULL) == 0)
4049                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4050        else
4051                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4052        ostrcatbig(&buf, _("extern"), &maxlen, &pos);
4053        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4054
4055        if(getconfigint("faststop", NULL) == 1)
4056                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4057        else
4058                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4059        ostrcatbig(&buf, _("intern"), &maxlen, &pos);
4060        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4061       
4062        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4063        sendstr = ostrcat(sendstr, ", playertype.value", 1 , 0);
4064
4065///////////////////
4066        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4067        ostrcatbig(&buf, _("Change Channelname auto."), &maxlen, &pos);
4068        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"autochangechannelname\" border=\"0\">", &maxlen, &pos);
4069       
4070        if(getconfigint("autochangechannelname", NULL) == 0)
4071                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4072        else
4073                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4074        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4075        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4076
4077        if(getconfigint("autochangechannelname", NULL) == 1)
4078                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4079        else
4080                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4081        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4082        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4083       
4084        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4085        sendstr = ostrcat(sendstr, ", autochangechannelname.value", 1 , 0);
4086
4087///////////////////
4088        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4089        ostrcatbig(&buf, _("Set action after rec"), &maxlen, &pos);
4090        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"def_rectimer_after\" border=\"0\">", &maxlen, &pos);
4091       
4092        if(getconfigint("def_rectimer_after", NULL) == 0)
4093                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4094        else
4095                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4096        ostrcatbig(&buf, _("auto"), &maxlen, &pos);
4097        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4098
4099        if(getconfigint("def_rectimer_after", NULL) == 1)
4100                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4101        else
4102                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4103        ostrcatbig(&buf, _("nothing"), &maxlen, &pos);
4104        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4105
4106        if(getconfigint("def_rectimer_after", NULL) == 2)
4107                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
4108        else
4109                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4110        ostrcatbig(&buf, _("standby"), &maxlen, &pos);
4111        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4112
4113        if(getconfigint("def_rectimer_after", NULL) == 3)
4114                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
4115        else
4116                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4117        ostrcatbig(&buf, _("power off"), &maxlen, &pos);
4118        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4119       
4120        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4121        sendstr = ostrcat(sendstr, ", def_rectimer_after.value", 1 , 0);
4122
4123///////////////////
4124        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4125        ostrcatbig(&buf, _("Show Timeline in Channellist"), &maxlen, &pos);
4126        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"showchanneltimeline\" border=\"0\">", &maxlen, &pos);
4127       
4128        if(getconfigint("showchanneltimeline", NULL) == 0)
4129                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4130        else
4131                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4132        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4133        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4134
4135        if(getconfigint("showchanneltimeline", NULL) == 1)
4136                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4137        else
4138                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4139        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4140        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4141       
4142        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4143        sendstr = ostrcat(sendstr, ", showchanneltimeline.value", 1 , 0);
4144
4145///////////////////
4146        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4147        ostrcatbig(&buf, _("Animated Screens"), &maxlen, &pos);
4148        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"screenanim\" border=\"0\">", &maxlen, &pos);
4149       
4150        if(getconfigint("screenanim", NULL) == 0)
4151                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4152        else
4153                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4154        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4155        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4156
4157        if(getconfigint("screenanim", NULL) == 1)
4158                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4159        else
4160                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4161        ostrcatbig(&buf, _("anim. width"), &maxlen, &pos);
4162        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4163
4164        if(getconfigint("screenanim", NULL) == 2)
4165                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
4166        else
4167                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4168        ostrcatbig(&buf, _("anim. height"), &maxlen, &pos);
4169        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4170
4171        if(getconfigint("screenanim", NULL) == 3)
4172                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
4173        else
4174                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4175        ostrcatbig(&buf, _("anim. both"), &maxlen, &pos);
4176        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4177       
4178        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4179        sendstr = ostrcat(sendstr, ", screenanim.value", 1 , 0);
4180
4181///////////////////
4182        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4183        ostrcatbig(&buf, _("Animated Speed"), &maxlen, &pos);
4184        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"screenanimspeed\" border=\"0\">", &maxlen, &pos);
4185       
4186        if(getconfigint("screenanimspeed", NULL) == 1)
4187                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4188        else
4189                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4190        ostrcatbig(&buf, _("very fast"), &maxlen, &pos);
4191        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4192
4193        if(getconfigint("screenanimspeed", NULL) == 5)
4194                ostrcatbig(&buf, "<option value=\"5\" selected>", &maxlen, &pos);               
4195        else
4196                ostrcatbig(&buf, "<option value=\"5\">", &maxlen, &pos);
4197        ostrcatbig(&buf, _("fast"), &maxlen, &pos);
4198        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4199
4200        if(getconfigint("screenanimspeed", NULL) == 10)
4201                ostrcatbig(&buf, "<option value=\"10\" selected>", &maxlen, &pos);             
4202        else
4203                ostrcatbig(&buf, "<option value=\"10\">", &maxlen, &pos);
4204        ostrcatbig(&buf, _("normal"), &maxlen, &pos);
4205        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4206
4207        if(getconfigint("screenanimspeed", NULL) == 15)
4208                ostrcatbig(&buf, "<option value=\"15\" selected>", &maxlen, &pos);             
4209        else
4210                ostrcatbig(&buf, "<option value=\"15\">", &maxlen, &pos);
4211        ostrcatbig(&buf, _("slow"), &maxlen, &pos);
4212        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4213
4214        if(getconfigint("screenanimspeed", NULL) == 20)
4215                ostrcatbig(&buf, "<option value=\"20\" selected>", &maxlen, &pos);             
4216        else
4217                ostrcatbig(&buf, "<option value=\"20\">", &maxlen, &pos);
4218        ostrcatbig(&buf, _("very slow"), &maxlen, &pos);
4219        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4220       
4221        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4222        sendstr = ostrcat(sendstr, ", screenanimspeed.value", 1 , 0);
4223
4224///////////////////
4225        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4226        ostrcatbig(&buf, _("Channellist view"), &maxlen, &pos);
4227        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"channellistview\" border=\"0\">", &maxlen, &pos);
4228       
4229        if(getconfigint("channellistview", NULL) == 0)
4230                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4231        else
4232                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4233        ostrcatbig(&buf, _("hidden"), &maxlen, &pos);
4234        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4235
4236        if(getconfigint("channellistview", NULL) == 1)
4237                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4238        else
4239                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4240        ostrcatbig(&buf, _("deaktiv"), &maxlen, &pos);
4241        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4242       
4243        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4244        sendstr = ostrcat(sendstr, ", channellistview.value", 1 , 0);
4245
4246///////////////////
4247        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4248        ostrcatbig(&buf, _("Show last pos Question"), &maxlen, &pos);
4249        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"showlastpos\" border=\"0\">", &maxlen, &pos);
4250       
4251        if(getconfigint("showlastpos", NULL) == 0)
4252                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4253        else
4254                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4255        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4256        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4257
4258        if(getconfigint("showlastpos", NULL) == 1)
4259                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4260        else
4261                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4262        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4263        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4264       
4265        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4266        sendstr = ostrcat(sendstr, ", showlastpos.value", 1 , 0);
4267
4268///////////////////
4269        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4270        ostrcatbig(&buf, _("Resync Recording immediately"), &maxlen, &pos);
4271        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recsync\" border=\"0\">", &maxlen, &pos);
4272       
4273        if(getconfigint("recsync", NULL) == 0)
4274                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4275        else
4276                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4277        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4278        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4279
4280        if(getconfigint("recsync", NULL) == 1)
4281                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4282        else
4283                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4284        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4285        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4286       
4287        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4288        sendstr = ostrcat(sendstr, ", recsync.value", 1 , 0);
4289
4290///////////////////
4291        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4292        ostrcatbig(&buf, _("Recording name"), &maxlen, &pos);
4293        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recordnamefmt\" border=\"0\">", &maxlen, &pos);
4294       
4295        if(getconfigint("recordnamefmt", NULL) == 0)
4296                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4297        else
4298                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4299        ostrcatbig(&buf, _("channel-movie"), &maxlen, &pos);
4300        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4301
4302        if(getconfigint("recordnamefmt", NULL) == 1)
4303                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4304        else
4305                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4306        ostrcatbig(&buf, _("movie-channel"), &maxlen, &pos);
4307        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4308       
4309        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4310        sendstr = ostrcat(sendstr, ", recordnamefmt.value", 1 , 0);
4311
4312///////////////////
4313        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4314        ostrcatbig(&buf, _("Newsletter"), &maxlen, &pos);
4315        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"newsletter\" border=\"0\">", &maxlen, &pos);
4316       
4317        if(getconfigint("newsletter", NULL) == 0)
4318                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4319        else
4320                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4321        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4322        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4323
4324        if(getconfigint("newsletter", NULL) == 1)
4325                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4326        else
4327                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4328        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4329        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4330       
4331        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4332        sendstr = ostrcat(sendstr, ", newsletter.value", 1 , 0);
4333
4334///////////////////
4335        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4336        ostrcatbig(&buf, _("Show hidden files"), &maxlen, &pos);
4337        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"showhiddenfiles\" border=\"0\">", &maxlen, &pos);
4338       
4339        if(getconfigint("showhiddenfiles", NULL) == 0)
4340                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4341        else
4342                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4343        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4344        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4345
4346        if(getconfigint("showhiddenfiles", NULL) == 1)
4347                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4348        else
4349                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4350        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4351        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4352       
4353        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4354        sendstr = ostrcat(sendstr, ", showhiddenfiles.value", 1 , 0);
4355
4356///////////////////
4357        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4358        ostrcatbig(&buf, _("Expert Modus"), &maxlen, &pos);
4359        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"expertmodus\" border=\"0\">", &maxlen, &pos);
4360       
4361        if(getconfigint("expertmodus", NULL) == 0)
4362                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4363        else
4364                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4365        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4366        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4367
4368        if(getconfigint("expertmodus", NULL) == 10)
4369                ostrcatbig(&buf, "<option value=\"10\" selected>", &maxlen, &pos);             
4370        else
4371                ostrcatbig(&buf, "<option value=\"10\">", &maxlen, &pos);
4372        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4373        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4374
4375        if(getconfigint("expertmodus", NULL) == 11)
4376                ostrcatbig(&buf, "<option value=\"11\" selected>", &maxlen, &pos);             
4377        else
4378                ostrcatbig(&buf, "<option value=\"11\">", &maxlen, &pos);
4379        ostrcatbig(&buf, _("expert (11)"), &maxlen, &pos);
4380        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4381       
4382        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4383        sendstr = ostrcat(sendstr, ", expertmodus.value", 1 , 0);
4384
4385///////////////////
4386        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4387        ostrcatbig(&buf, _("Show infobar on program change"), &maxlen, &pos);
4388        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"infobarprogram\" border=\"0\">", &maxlen, &pos);
4389       
4390        if(getconfigint("infobarprogram", NULL) == 0)
4391                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4392        else
4393                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4394        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4395        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4396
4397        if(getconfigint("infobarprogram", NULL) == 1)
4398                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4399        else
4400                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4401        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4402        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4403       
4404        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4405        sendstr = ostrcat(sendstr, ", infobarprogram.value", 1 , 0);
4406
4407///////////////////
4408        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4409        ostrcatbig(&buf, _("Use cross control for fast zapping and vol"), &maxlen, &pos);
4410        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"crosscontrol\" border=\"0\">", &maxlen, &pos);
4411       
4412        if(getconfigint("crosscontrol", NULL) == 0)
4413                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4414        else
4415                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4416        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4417        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4418
4419        if(getconfigint("crosscontrol", NULL) == 1)
4420                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4421        else
4422                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4423        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4424        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4425
4426        if(getconfigint("crosscontrol", NULL) == 2)
4427                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);               
4428        else
4429                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4430        ostrcatbig(&buf, _("yes / vzap 1 sec"), &maxlen, &pos);
4431        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4432
4433        if(getconfigint("crosscontrol", NULL) == 3)
4434                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);               
4435        else
4436                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4437        ostrcatbig(&buf, _("yes / vzap 2 sec"), &maxlen, &pos);
4438        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4439
4440        if(getconfigint("crosscontrol", NULL) == 9999)
4441                ostrcatbig(&buf, "<option value=\"9999\" selected>", &maxlen, &pos);           
4442        else
4443                ostrcatbig(&buf, "<option value=\"9999\">", &maxlen, &pos);
4444        ostrcatbig(&buf, _("yes / vzap endless"), &maxlen, &pos);
4445        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4446       
4447        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4448        sendstr = ostrcat(sendstr, ", crosscontrol.value", 1 , 0);
4449       
4450///////////////////
4451        if(status.security == 1)
4452        {
4453                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4454                ostrcatbig(&buf, _("Deactivate Crypt Support on Media Playback"), &maxlen, &pos);
4455                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"emucontrol\" border=\"0\">", &maxlen, &pos);
4456       
4457                if(getconfigint("emucontrol", NULL) == 0)
4458                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4459                else
4460                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4461                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4462                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4463
4464                if(getconfigint("emucontrol", NULL) == 1)
4465                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4466                else
4467                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4468                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4469                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4470       
4471                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4472                sendstr = ostrcat(sendstr, ", emucontrol.value", 1 , 0);
4473        }
4474
4475///////////////////
4476        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4477        ostrcatbig(&buf, _("Deactivate MiniTV"), &maxlen, &pos);
4478        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"choiceminitv\" border=\"0\">", &maxlen, &pos);
4479       
4480        if(getconfigint("choiceminitv", NULL) == 0)
4481                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4482        else
4483                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4484        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4485        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4486
4487        if(getconfigint("choiceminitv", NULL) == 1)
4488                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4489        else
4490                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4491        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4492        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4493       
4494        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4495        sendstr = ostrcat(sendstr, ", choiceminitv.value", 1 , 0);
4496
4497///////////////////
4498        if(checkbox("ATEMIO510") == 1 || checkbox("UFS912") == 1 || checkbox("ATEMIO7600") == 1 || checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1)
4499        {
4500                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4501                ostrcatbig(&buf, _("Activate CEC"), &maxlen, &pos);
4502                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"usecec\" border=\"0\">", &maxlen, &pos);
4503       
4504                if(getconfigint("usecec", NULL) == 0)
4505                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4506                else
4507                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4508                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4509                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4510
4511                if(getconfigint("usecec", NULL) == 1)
4512                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4513                else
4514                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4515                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4516                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4517       
4518                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4519                sendstr = ostrcat(sendstr, ", usecec.value", 1 , 0);
4520        }
4521
4522///////////////////
4523        if(checkbox("ATEMIO7600") == 1)
4524        {
4525                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4526                ostrcatbig(&buf, _("SATA Connector"), &maxlen, &pos);
4527                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"sataswitch\" border=\"0\">", &maxlen, &pos);
4528       
4529                if(getconfigint("sataswitch", NULL) == 0)
4530                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4531                else
4532                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4533                ostrcatbig(&buf, _("extern"), &maxlen, &pos);
4534                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4535
4536                if(getconfigint("sataswitch", NULL) == 1)
4537                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4538                else
4539                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4540                ostrcatbig(&buf, _("intern"), &maxlen, &pos);
4541                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4542       
4543                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4544                sendstr = ostrcat(sendstr, ", sataswitch.value", 1 , 0);
4545        }
4546
4547///////////////////
4548//      ostrcatbig(&buf, "<tr><td><font class=\"label\">Volbartimeout:&nbsp;</font></td><td><select name=\"volbartimeout\" border=\"0\"><option value=\"1\" selected>1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"6\">6</option><option value=\"7\">7</option><option value=\"8\">8</option><option value=\"9\">9</option><option value=\"10\">10</option></select></td></tr>", &maxlen, &pos);
4549        max = 10;
4550        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4551        ostrcatbig(&buf, _("Time to wait after seek for fill buffer"), &maxlen, &pos);
4552        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"playerbufferseektime\" border=\"0\">", &maxlen, &pos);
4553        for(i = 1; i <= max; i++)
4554        {
4555                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4556                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);             
4557                if(getconfigint("playerbufferseektime", NULL) == i)
4558                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);               
4559                else
4560                        ostrcatbig(&buf, "\">", &maxlen, &pos);
4561                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
4562                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4563        }       
4564        ostrcatbig(&buf, "</select></td></tr>", &maxlen, &pos);
4565        sendstr = ostrcat(sendstr, ", playerbufferseektime.value", 1 , 0);
4566       
4567///////////////////     
4568        if(checkbox("ATEMIO-NEMESIS") == 1 || checkbox("ATEMIO5200") == 1)
4569        {
4570                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4571                ostrcatbig(&buf, _("Dualboot Menu TitanNit / E2"), &maxlen, &pos);
4572                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"dualboot\" border=\"0\">", &maxlen, &pos);
4573       
4574//              if(getconfigint("dualboot", NULL) == 0)
4575                if(!file_exist("/mnt/config/dualboot"))
4576                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);               
4577                else
4578                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4579                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4580                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4581
4582//              if(getconfigint("dualboot", NULL) == 1)
4583                if(file_exist("/mnt/config/dualboot"))
4584                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);               
4585                else
4586                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4587                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4588                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4589       
4590                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos); 
4591                sendstr = ostrcat(sendstr, ", dualboot.value", 1 , 0);
4592        }
4593       
4594
4595//      ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
4596//      ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return volbartimeout.value, infobartimeout.value, infobarsleep.value, spinnerspeed.value, spinnertime.value, hangtime.value, secondinfobar.value, nozapclear.value, fastzap.value, faststop.value, dirsort.value, poweraktion.value, virtualzap.value, fasttextrender.value, recsplitsize.value, recforerun.value, recoverrun.value, skip13.value, skip46.value, skip79.value, playertype.value, autochangechannelname.value, def_rectimer_after.value, showchanneltimeline.value, screenanim.value, screenanimspeed.value, channellistview.value, showlastpos.value, recsync.value, recordnamefmt.value, newsletter.value, showhiddenfiles.value, expertmodus.value, infobarprogram.value, emucontrol.value, choiceminitv.value, usecec.value, playerbufferseektime.value, dualboot.value\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
4597// sendstr verwenden
4598        ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return ", &maxlen, &pos);
4599        ostrcatbig(&buf, sendstr, &maxlen, &pos);
4600        ostrcatbig(&buf, "\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
4601       
4602       
4603//writesys("/tmp/tmpstr", buf, 1);
4604        //ostrcatbig(&buf, param, &maxlen, &pos);
4605        return buf;
4606}
4607
4608char* webadjustsend(char* param, int fmt)
4609{
4610        debug(77, "fmt: %d param: %s",fmt , param);
4611
4612        char* buf = NULL;
4613        char* tmpstr = NULL, *tmpstr1 = NULL;
4614
4615        int count, count2,  max, i;
4616
4617        tmpstr = ostrcat(param, NULL, 0, 0);
4618       
4619        count = 0;
4620        struct splitstr* ret1 = NULL;
4621        ret1 = strsplit(tmpstr, "&", &count);
4622        max = count - 1;
4623       
4624        if(ret1 != NULL)
4625        {
4626                for(i = 0; i <= max; i++)
4627                {
4628                        if(ostrcmp(ret1[i].part, "node=0") == 0 || ostrcmp(ret1[i].part, "send=Send") == 0)
4629                        {
4630                                debug(77, "skip: %s", ret1[i].part);
4631                                continue;
4632                        }
4633                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4634                        count2 = 0;
4635                        struct splitstr* ret2 = NULL;
4636                        ret2 = strsplit(tmpstr1, "=", &count2);
4637                        if(ret2 != NULL && count2 > 1)
4638                        {
4639                                if(ret2[1].part != NULL && ostrcmp(ret2[0].part, "dualboot") == 0)
4640                                {
4641                                        debug(77, "add %s: %s", ret2[0].part, ret2[1].part);
4642                                        if(ostrcmp(ret2[1].part, "0") == 0)
4643                                        {
4644                                                debug(77, "unlink /mnt/config/dualboot");
4645                                                unlink("/mnt/config/dualboot");
4646                                        }
4647                                        else
4648                                        {
4649                                                debug(77, "touch /mnt/config/dualboot");
4650                                                system("touch /mnt/config/dualboot");
4651                                        }
4652                                }
4653                                else if(ret2[1].part != NULL)
4654                                {
4655                                        debug(77, "add %s: %s", ret2[0].part, ret2[1].part);
4656                                        addconfigtmp(ret2[0].part, ret2[1].part);
4657                                }
4658
4659                        }
4660                        free(ret2), ret2 = NULL;
4661                        free(tmpstr1), tmpstr1 = NULL;
4662                }
4663        }
4664        free(ret1), ret1 = NULL;
4665        free(tmpstr), tmpstr = NULL;
4666       
4667        buf = webadjust(NULL, fmt);
4668        writeallconfig(1);
4669
4670        return buf;
4671}
4672
4673char* webgetparamvalue(char* param, char* searchparam)
4674{
4675        char* buf = NULL;
4676        char* tmpstr = NULL;
4677       
4678        tmpstr = ostrcat(param, NULL, 0, 0);
4679        if(tmpstr != NULL) buf = ostrstr(tmpstr, searchparam);
4680        if(buf != NULL) buf = buf + strlen(searchparam);
4681        free(tmpstr); tmpstr = NULL;
4682        buf = stringreplacecharonce(buf, '&', '\0');
4683        debug(77, "webgetparamvalue param: %s", param);
4684        debug(77, "webgetparamvalue search: %s", searchparam);
4685        debug(77, "webgetparamvalue value: %s", buf);
4686        return buf;
4687}
4688
4689char* webgetcommand(char* param, int fmt)
4690{
4691        char* buf = NULL, *tmpstr = NULL;
4692        if(param == NULL) return NULL;
4693        if(status.security == 0) return NULL;
4694
4695        if(fmt == 0)
4696        {
4697                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
4698                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
4699                buf = ostrcat(buf, "</head><body class=body id=\"command\">", 1, 0);
4700        }
4701
4702        debug(10, "cmd: %s", param);
4703        tmpstr = command(param);
4704        buf = ostrcat(buf, tmpstr, 1, 0);
4705        free(tmpstr), tmpstr = NULL;   
4706        buf = ostrcat(buf, "</body></html>", 1, 0);
4707
4708        return buf;
4709}
4710
4711char* webgethelp(char* param, int fmt)
4712{
4713        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *helppath = NULL, *lang = NULL;
4714        if(param == NULL) return NULL;
4715
4716        if(fmt == 0)
4717        {
4718                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
4719                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
4720                buf = ostrcat(buf, "</head><body class=body id=\"help\">", 1, 0);
4721        }
4722
4723        helppath = getconfig("helppath", NULL);
4724        if(helppath == NULL) return NULL;
4725
4726        //get language
4727        lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0);
4728        lang = string_replace("po/", "", lang, 1);
4729
4730        //create full filename
4731        tmpstr = ostrcat(helppath, "/", 0, 0);
4732        tmpstr = ostrcat(tmpstr, lang, 1, 1);
4733        tmpstr = ostrcat(tmpstr, "/", 1, 0);
4734        tmpstr = ostrcat(tmpstr, param, 1, 0);
4735        tmpstr = ostrcat(tmpstr, ".txt", 1, 0);
4736       
4737        debug(10, "file: %s", tmpstr);
4738        tmpstr1 = readsys(tmpstr, 1);
4739
4740        buf = ostrcat(buf, tmpstr1, 1, 0);
4741        free(tmpstr), tmpstr = NULL;   
4742        free(tmpstr1), tmpstr1 = NULL; 
4743
4744        buf = ostrcat(buf, "</body></html>", 1, 0);
4745
4746        return buf;
4747}
4748
4749char* webgethelpchoices(int fmt)
4750{
4751        char* buf = NULL, *tmpstr = NULL, *helppath = NULL, *lang = NULL, *cmd = NULL;
4752       
4753//      if(fmt == 0)
4754//      {
4755                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
4756                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
4757                buf = ostrcat(buf, "</head><body class=body id=\"helpchoices\">", 1, 0);
4758//              buf = ostrcat(buf, "<center><form action=query method=get target=nothing><br><br>", 1, 0);
4759
4760//      }
4761
4762        helppath = getconfig("helppath", NULL);
4763        if(helppath == NULL) return NULL;
4764
4765        //get language
4766        lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0);
4767        lang = string_replace("po/", "", lang, 1);
4768
4769        //create full filename
4770        cmd = ostrcat("ls -1 ", helppath, 0, 0);
4771        cmd = ostrcat(cmd, "/", 1, 0);
4772        cmd = ostrcat(cmd, lang, 1, 1);
4773        cmd = ostrcat(cmd, "/", 1, 0);
4774       
4775        debug(10, "cmd: %s", cmd);
4776        tmpstr = command(cmd);
4777       
4778        int count, i, max;
4779        count = 0;
4780        struct splitstr* ret1 = NULL;
4781        ret1 = strsplit(tmpstr, "\n", &count);
4782        max = count - 1;
4783       
4784
4785       
4786//      buf = ostrcat(buf, "<a class=linelink2 href=query?getprovider target=main>Provider</a>", 1, 0);
4787//      buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gethelp&adjust target=main>Adjust</a>", 1, 0);
4788//      buf = ostrcat(buf, "<a class=linelink2 href=query?getprovider target=main>Provider</a>", 1, 0);
4789
4790        buf = ostrcat(buf, "<center><table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
4791 
4792        int icount = 0;
4793 
4794        if(ret1 != NULL)
4795        {
4796                for(i = 0; i <= max; i++)
4797                {
4798                        icount++;
4799/*
4800                        buf = ostrcat(buf, "<input class=bigbutton type=submit name=gethelp", 1, 0);
4801//                      buf = ostrcat(buf, _(ret1[i].part), 1, 0);
4802                        buf = ostrcat(buf, " value=\"", 1, 0);
4803                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
4804                        buf = ostrcat(buf, "\"></input><br>", 1, 0);
4805*/
4806                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gethelp&", 1, 0);
4807                        buf = ostrcat(buf, stringreplacecharonce(ret1[i].part, '.', '\0'), 1, 0);
4808                        buf = ostrcat(buf, " target=main>", 1, 0);
4809                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
4810                        buf = ostrcat(buf, "</a>", 1, 0);
4811                        buf = ostrcat(buf, "</br></br>", 1, 0);
4812
4813                        if(icount == 4)
4814                        {
4815//                              buf = ostrcat(buf, "</br>", 1, 0);
4816                                icount = 0;
4817                        }
4818//<a class=linelink2 href=query?getallchannel target=main>All</a>
4819                }
4820        }               
4821
4822        free(tmpstr), tmpstr = NULL;   
4823//      buf = ostrcat(buf, "</form></center></body></html>", 1, 0);
4824        buf = ostrcat(buf, "</td></tr></table></center></body></html>", 1, 0);
4825
4826        return buf;
4827}
4828
4829#endif
Note: See TracBrowser for help on using the repository browser.