source: titan/titan/httpdfunc.h @ 40759

Last change on this file since 40759 was 40759, checked in by gost, 7 years ago

Fix last change

File size: 216.5 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                {
285                        ostrcatbig(buf, "</td><td width=100 align=right valign=middle nowrap><img style=\"margin-left: 5\" border=0 src=img/tv.png title=\"", maxlen, pos);
286                        ostrcatbig(buf, _("TV"), maxlen, pos);
287                        ostrcatbig(buf, "\" width=16 height=16>", maxlen, pos);
288                }
289                else
290                {
291                        ostrcatbig(buf, "</td><td width=100 align=right valign=middle nowrap><img style=\"margin-left: 5\" border=0 src=img/radio.png title=\"", maxlen, pos);
292                        ostrcatbig(buf, _("Radio"), maxlen, pos);
293                        ostrcatbig(buf, "\" width=16 height=16>", maxlen, pos);
294                }
295
296                //single epg
297                ostrcatbig(buf, "<a target=main href=query?getsingleepg&", maxlen, pos);
298                ostrcatbig(buf, serviceid, maxlen, pos);
299                ostrcatbig(buf, "&", maxlen, pos);
300                ostrcatbig(buf, transponderid, maxlen, pos);
301                ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/singleepg.png title=\"", maxlen, pos);
302                ostrcatbig(buf, _("Single EPG"), maxlen, pos);
303                ostrcatbig(buf, "\" width=16 height=16></a>", maxlen, pos);
304
305                //m3u stream, transcode stream + webstream
306                if(ret == 0)
307                {
308                        ostrcatbig(buf, "<a target=nothing href=query?getm3u&", maxlen, pos);
309                        ostrcatbig(buf, serviceid, maxlen, pos);
310                        ostrcatbig(buf, ",", maxlen, pos);
311                        ostrcatbig(buf, transponderid, maxlen, pos);
312                        ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/stream.png title=\"", maxlen, pos);
313                        ostrcatbig(buf, _("Stream"), maxlen, pos);
314                        ostrcatbig(buf, "\" width=16 height=16></a>", maxlen, pos);
315
316#ifdef MIPSEL
317                        if(file_exist("/proc/stb/encoder") &&  getconfigint("web_trans_transcode", NULL) == 1)
318                        {
319                                ostrcatbig(buf, "<a target=nothing href=query?gettranscodem3u&", maxlen, pos);
320                                ostrcatbig(buf, serviceid, maxlen, pos);
321                                ostrcatbig(buf, ",", maxlen, pos);
322                                ostrcatbig(buf, transponderid, maxlen, pos);
323                                ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/transstream.png title=\"", maxlen, pos);
324                                ostrcatbig(buf, _("Stream Transcode"), maxlen, pos);
325                                ostrcatbig(buf, "\" width=16 height=16></a>", maxlen, pos);
326                        }
327#endif
328                        ostrcatbig(buf, "<a target=_blank href=query?getvideo&", maxlen, pos);
329                        ostrcatbig(buf, serviceid, maxlen, pos);
330                        ostrcatbig(buf, ",", maxlen, pos);
331                        ostrcatbig(buf, transponderid, maxlen, pos);
332                        ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/webstream.png title=\"", maxlen, pos);
333                        ostrcatbig(buf, _("WebStream"), maxlen, pos);
334                        ostrcatbig(buf, "\" width=16 height=16></a>", maxlen, pos);
335                }
336                else
337                {
338                        ostrcatbig(buf, "<img style=\"margin-left: 5\" border=0 src=img/cross.png title=\"", maxlen, pos);
339                        ostrcatbig(buf, _("Channel not available"), maxlen, pos);
340                        ostrcatbig(buf, "\" width=16 height=16>", maxlen, pos);
341                }
342                ostrcatbig(buf, "</td></tr>", maxlen, pos);
343        }
344
345        free(buf1);
346        free(serviceid);
347        free(transponderid);
348}
349
350char* webgetbouquetchannel(char* param, int fmt)
351{
352        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
353        struct mainbouquet *mbouquet = NULL;
354        struct bouquet *node = NULL;
355        struct channel* chnode = NULL;
356        int line = 0, maxlen = 0, pos = 0;
357
358        if(param == NULL) return NULL;
359
360        if(fmt == 0) webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=60>", &pos, 0);
361
362        mbouquet = getmainbouquet(param);
363        if(mbouquet != NULL)
364        {
365                node = mbouquet->bouquet;
366                tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
367                tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
368                tmpstr1 = htmlencode(tmpstr);
369                free(tmpstr); tmpstr = NULL;
370                while(node != NULL)
371                {
372                        chnode = getchannel(node->serviceid, node->transponderid);
373                        if(chnode != NULL)
374                        {
375                                webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt);
376                                if(line == 0)
377                                        line = 1;
378                                else
379                                        line = 0;
380                        }
381                        node = node->next;
382                }
383                free(tmpstr1); tmpstr1 = NULL;
384        }
385        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
386
387        return buf;
388}
389
390//flag 0: all
391//flag 1: sat
392//flag 2: provider
393//flag 3: A-Z
394char* webgetchannel(int param, int flag, int page, int fmt)
395{
396        char* buf = NULL, *tmpnr = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
397        struct channel* chnode = channel;
398        int line = 0, maxcount = 0, maxlen = 0, pos = 0;
399
400        if(fmt == 0) webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=60>", &pos, 0);
401
402        if(flag == 0) tmpstr1 = ostrcat(tmpstr1, "(ALL)", 1, 0);
403        if(flag == 1)
404        {
405                struct sat* node = getsatbyorbitalpos(param);
406                if(node != NULL)
407                {
408                        tmpstr = ostrcat(tmpstr, "(SAT)-", 1, 0);
409                        tmpstr = ostrcat(tmpstr, node->name, 1, 0);
410                        tmpstr1 = htmlencode(tmpstr);
411                        free(tmpstr); tmpstr = NULL;
412                }
413        }
414        if(flag == 2)
415        {
416                struct provider* node = getprovider(param);
417                if(node != NULL)
418                {
419                        tmpstr = ostrcat(tmpstr, "(PROVIDER)-", 1, 0);
420                        tmpstr = ostrcat(tmpstr, node->name, 1, 0);
421                        tmpstr1 = htmlencode(tmpstr);
422                        free(tmpstr); tmpstr = NULL;
423                }
424        }
425        if(flag == 3)
426        {
427                tmpstr = malloc(2);
428                if(tmpstr != NULL)
429                        snprintf(tmpstr, 2, "%c", param);
430                tmpstr = ostrcat("(A-Z)-", tmpstr, 0, 1);
431                tmpstr1 = htmlencode(tmpstr);
432                free(tmpstr); tmpstr = NULL;
433        }
434
435        while(chnode != NULL)
436        {
437                if(chnode->transponder == NULL)
438                {
439                        chnode = chnode->next;
440                        continue;
441                }
442                if(chnode->name == NULL)
443                {
444                        chnode = chnode->next;
445                        continue;
446                }
447                if(flag == 1 && chnode->transponder->orbitalpos != param)
448                {
449                        chnode = chnode->next;
450                        continue;
451                }
452                if(flag == 2 && chnode->providerid != param)
453                {
454                        chnode = chnode->next;
455                        continue;
456                }
457                if(flag == 3 && chnode->name[0] != param && chnode->name[0] != param + 32)
458                {
459                        chnode = chnode->next;
460                        continue;
461                }
462
463                maxcount++;
464                if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
465                {
466                        chnode = chnode->next;
467                        continue;
468                }
469                webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt);
470
471                if(line == 0)
472                        line = 1;
473                else
474                        line = 0;
475
476                chnode = chnode->next;
477        }
478        free(tmpstr); tmpstr = NULL;
479
480        if(fmt == 0 && maxcount > MAXHTMLLINE)
481        {
482                int i;
483                ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
484                for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
485                {
486                        if(page == i)
487                                ostrcatbig(&buf, "<a class=pagesellink href=query?getchannelpage&", &maxlen, &pos);
488                        else
489                                ostrcatbig(&buf, "<a class=pagelink href=query?getchannelpage&", &maxlen, &pos);
490                        tmpnr = oitoa(param);
491                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
492                        ostrcatbig(&buf, "&", &maxlen, &pos);
493                        free(tmpnr); tmpnr = NULL;
494                        tmpnr = oitoa(flag);
495                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
496                        ostrcatbig(&buf, "&", &maxlen, &pos);
497                        free(tmpnr); tmpnr = NULL;
498
499                        tmpnr = oitoa(i);
500                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
501                        ostrcatbig(&buf, ">", &maxlen, &pos);
502                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
503                        ostrcatbig(&buf, "</a>", &maxlen, &pos);
504                        free(tmpnr); tmpnr = NULL;
505                }
506                ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
507        }
508
509        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
510        return buf;
511}
512
513char* webgetprovider(int fmt)
514{
515        char* buf = NULL, *tmpstr = NULL;
516        struct provider* node = provider;
517        int line = 0, maxlen = 0, pos = 0;
518
519        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
520
521        while(node != NULL)
522        {
523                if(fmt == 0)
524                {
525                        if(line == 0)
526                        {
527                                ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
528                                tmpstr = oitoa(node->providerid);
529                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
530                                free(tmpstr); tmpstr = NULL;
531                                ostrcatbig(&buf, "\">", &maxlen, &pos);
532                                line = 1;
533                        }
534                        else
535                        {
536                                ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
537                                tmpstr = oitoa(node->providerid);
538                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
539                                free(tmpstr); tmpstr = NULL;
540                                ostrcatbig(&buf, "\">", &maxlen, &pos);
541                                line = 0;
542                        }
543                        ostrcatbig(&buf, node->name, &maxlen, &pos);
544                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
545                }
546                else
547                {
548                        buf = ostrcat(buf, node->name, 1, 0);
549                        buf = ostrcat(buf, "#", 1, 0);
550                        buf = ostrcat(buf, oitoa(node->providerid), 1, 1);
551                        buf = ostrcat(buf, "\n", 1, 0);
552                }
553
554                node = node->next;
555        }
556
557        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
558        return buf;
559}
560
561char* webgetsat(int fmt)
562{
563        char* buf = NULL, *tmpstr = NULL;
564        struct sat* node = sat;
565        int line = 0, maxlen = 0, pos = 0;
566
567        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
568
569        while(node != NULL)
570        {
571                if(fmt == 0)
572                {
573                        if(line == 0)
574                        {
575                                ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
576                                tmpstr = oitoa(node->orbitalpos);
577                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
578                                free(tmpstr); tmpstr = NULL;
579                                ostrcatbig(&buf, "\">", &maxlen, &pos);
580                                line = 1;
581                        }
582                        else
583                        {
584                                ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
585                                tmpstr = oitoa(node->orbitalpos);
586                                ostrcatbig(&buf, tmpstr, &maxlen, &pos);
587                                free(tmpstr); tmpstr = NULL;
588                                ostrcatbig(&buf, "\">", &maxlen, &pos);
589                                line = 0;
590                        }
591                        ostrcatbig(&buf, node->name, &maxlen, &pos);
592                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
593                }
594                else
595                {
596                        buf = ostrcat(buf, node->name, 1, 0);
597                        buf = ostrcat(buf, "#", 1, 0);
598                        buf = ostrcat(buf, oitoa(node->orbitalpos), 1, 1);
599                        buf = ostrcat(buf, "\n", 1, 0);
600                }
601
602                node = node->next;
603        }
604
605        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
606        return buf;
607}
608
609char* webgetaz(int fmt)
610{
611        char* buf = NULL, *tmpstr = NULL, *tmpnr = NULL;
612        int line = 0, maxlen = 0, pos = 0, i;
613
614        tmpstr = malloc(2);
615        if(tmpstr == NULL)
616        {
617                err("no memory");
618                return NULL;
619        }
620
621        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
622
623        for(i = 65; i < 91; i++)
624        {
625                if(fmt == 0)
626                {
627                        if(line == 0)
628                        {
629                                ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
630                                tmpnr = oitoa(i);
631                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
632                                free(tmpnr); tmpnr = NULL;
633                                ostrcatbig(&buf, "\">", &maxlen, &pos);
634                                line = 1;
635                        }
636                        else
637                        {
638                                ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
639                                tmpnr = oitoa(i);
640                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
641                                free(tmpnr); tmpnr = NULL;
642                                ostrcatbig(&buf, "\">", &maxlen, &pos);
643                                line = 0;
644                        }
645                        snprintf(tmpstr, 2, "%c", i);
646                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
647                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
648                }
649                else
650                {
651                        snprintf(tmpstr, 2, "%c", i);
652                        buf = ostrcat(buf, tmpstr, 1, 0);
653                        buf = ostrcat(buf, "\n", 1, 0);
654                }
655        }
656
657        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
658        free(tmpstr);
659        return buf;
660}
661
662char* webgetbouquet(int fmt)
663{
664        char* buf = NULL;
665        struct mainbouquet* node = mainbouquet;
666        int line = 0, maxlen = 0, pos = 0;
667
668        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
669
670        while(node != NULL)
671        {
672                if(fmt == 0)
673                {
674                        if(line == 0)
675                        {
676                                ostrcatbig(&buf, "<tr class=line1><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
677                                ostrcatbig(&buf, node->name, &maxlen, &pos);
678                                ostrcatbig(&buf, "\">", &maxlen, &pos);
679                                line = 1;
680                        }
681                        else
682                        {
683                                ostrcatbig(&buf, "<tr class=line2><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
684                                ostrcatbig(&buf, node->name, &maxlen, &pos);
685                                ostrcatbig(&buf, "\">", &maxlen, &pos);
686                                line = 0;
687                        }
688                        ostrcatbig(&buf, node->name, &maxlen, &pos);
689                        ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
690
691                        ostrcatbig(&buf, "<td width=50 nowrap align=right valign=middle><img style=\"margin-left: 5\" border=0 src=", &maxlen, &pos);
692
693                        if(node->type == 0)
694                        {
695                                ostrcatbig(&buf, "img/tv.png title=\"", &maxlen, &pos);
696                                ostrcatbig(&buf, _("TV"), &maxlen, &pos);
697                        }
698                        else
699                        {
700                                ostrcatbig(&buf, "img/radio.png title=\"", &maxlen, &pos);
701                                ostrcatbig(&buf, _("Radio"), &maxlen, &pos);
702                        }
703
704                        ostrcatbig(&buf, "\" width=16 height=16>", &maxlen, &pos);
705
706                        ostrcatbig(&buf, "<a href=\"query?getgmultiepg&", &maxlen, &pos);
707                        ostrcatbig(&buf, node->name, &maxlen, &pos);
708                        ostrcatbig(&buf, "\">", &maxlen, &pos);
709                        ostrcatbig(&buf, "<img style=\"margin-left: 5\" border=0 src=img/gmultiepg.png title=\"", &maxlen, &pos);
710                        ostrcatbig(&buf, _("GRAPHIC MULTI EPG - Bouquets"), &maxlen, &pos);
711                        ostrcatbig(&buf, "\" width=16 height=16></a>", &maxlen, &pos);
712
713                        ostrcatbig(&buf, "<a href=\"query?getbouquetm3u&", &maxlen, &pos);
714                        ostrcatbig(&buf, node->name, &maxlen, &pos);
715                        ostrcatbig(&buf, "\">", &maxlen, &pos);
716                        ostrcatbig(&buf, "<img style=\"margin-left: 5\" border=0 src=img/bouquetstream.png title=\"", &maxlen, &pos);
717                        ostrcatbig(&buf, _("Playlist download"), &maxlen, &pos);
718                        ostrcatbig(&buf, "\" width=16 height=16></a>", &maxlen, &pos);
719
720                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
721                }
722                else
723                {
724                        buf = ostrcat(buf, node->name, 1, 0);
725                        buf = ostrcat(buf, "#", 1, 0);
726                        buf = ostrcat(buf, oitoa(node->type), 1, 1);
727                        buf = ostrcat(buf, "\n", 1, 0);
728                }
729
730                node = node->next;
731        }
732
733        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
734        return buf;
735}
736
737char* websetmute(char* param, int fmt)
738{
739        char* buf = NULL;
740        int mute = status.mute;
741
742        if(param != NULL)
743                mute = atoi(param);
744
745        if(fmt == 0)
746        {
747                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);
748                if(mute == 0)
749                        buf = ostrcat(buf, "<a href=query?setmute&1><img src=img/speak_on.png border=0 alt=\"Mute on\"></img></a>", 1, 0);
750                else
751                        buf = ostrcat(buf, "<a href=query?setmute&0><img src=img/speak_off.png border=0 alt=\"Mute off\"></img></a>", 1, 0);
752                buf = ostrcat(buf, "</center></body></html>", 1, 0);
753        }
754        else
755        {
756                if(mute == 0)
757                        buf = ostrcat(buf, "0", 1, 0);
758                else
759                        buf = ostrcat(buf, "1", 1, 0);
760        }
761
762        if(mute != status.mute)
763                screenmute(NULL, NULL, 0);
764
765        return buf;
766}
767
768char* websetvol(char* param, int fmt)
769{
770        char* buf = NULL;
771        int vol = 30;
772
773        if(param == NULL)
774                vol = getvol();
775        else
776                vol = atoi(param);
777
778        if(fmt == 0)
779        {
780                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);
781                if((vol >=10) && (status.mute == 0))
782                        buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_on.png border=0></img></a> ", 1, 0);
783                else
784                        buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_off.png border=0></img></a> ", 1, 0);
785                if((vol >=20) && (status.mute == 0))
786                        buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_on.png border=0></img></a> ", 1, 0);
787                else
788                        buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_off.png border=0></img></a> ", 1, 0);
789                if((vol >=30) && (status.mute == 0))
790                        buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_on.png border=0></img></a> ", 1, 0);
791                else
792                        buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_off.png border=0></img></a> ", 1, 0);
793                if((vol >=40) && (status.mute == 0))
794                        buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_on.png border=0></img></a> ", 1, 0);
795                else
796                        buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_off.png border=0></img></a> ", 1, 0);
797                if((vol >=50) && (status.mute == 0))
798                        buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_on.png border=0></img></a> ", 1, 0);
799                else
800                        buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_off.png border=0></img></a> ", 1, 0);
801                if((vol >=60) && (status.mute == 0))
802                        buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_on.png border=0></img></a> ", 1, 0);
803                else
804                        buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_off.png border=0></img></a> ", 1, 0);
805                if((vol >=70) && (status.mute == 0))
806                        buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_on.png border=0></img></a> ", 1, 0);
807                else
808                        buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_off.png border=0></img></a> ", 1, 0);
809                if((vol >=80) && (status.mute == 0))
810                        buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_on.png border=0></img></a> ", 1, 0);
811                else
812                        buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_off.png border=0></img></a> ", 1, 0);
813                if((vol >=90) && (status.mute == 0))
814                        buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_on.png border=0></img></a> ", 1, 0);
815                else
816                        buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_off.png border=0></img></a> ", 1, 0);
817                if((vol >=100) && (status.mute == 0))
818                        buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_on.png border=0></img></a> ", 1, 0);
819                else
820                        buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_off.png border=0></img></a> ", 1, 0);
821                buf = ostrcat(buf, "</center></body></html>", 1, 0);
822        }
823        else
824                buf = ostrcat(buf, oitoa(vol), 1, 1);
825
826        if(param != NULL)
827        {
828                setvol(vol);
829                if(status.mute == 1)
830                        screenmute(NULL, NULL, 0);
831        }
832        return buf;
833}
834
835char* webgetaktservice(int fmt)
836{
837        char* buf = NULL;
838        struct channel* chnode = status.aktservice->channel;
839        int line = 0, maxlen = 0, pos = 0;
840
841        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
842        webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt);
843        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1);
844
845        return buf;
846}
847
848char* webgetservice(char* param, int fmt)
849{
850        char* buf = NULL, *param1 = NULL;
851        struct channel* chnode = NULL;
852        int line = 0, maxlen = 0, pos = 0;
853
854        if(param == NULL) return NULL;
855
856        //create param1
857        param1 = strchr(param, '&');
858        if(param1 != NULL)
859                *param1++ = '\0';
860
861        if(param1 == NULL) return NULL;
862
863        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
864
865        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
866        webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt);
867        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1);
868
869        return buf;
870}
871
872char* webswitch(char* param, int fmt)
873{
874        if(status.channelswitch == 1) goto end;
875
876        int ret = 0;
877        char* param1 = NULL, *param2 = NULL;
878        struct channel* chnode = NULL;
879
880        if(param == NULL) goto end;
881
882        //create param1
883        param1 = strchr(param, '&');
884        if(param1 != NULL)
885        {
886                *param1++ = '\0';
887                param2 = strchr(param1, '&');
888                if(param2 != NULL)
889                        *param2++ = '\0';
890        }
891
892        if(param1 == NULL && param2 == NULL) goto end;
893
894        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
895        if(chnode != NULL)
896        {
897                ret = channelnottunable(chnode);
898                if(ret == 0)
899                        ret = servicestart(chnode, param2, NULL, 0);
900        }
901
902end:
903        return webgetaktservice(fmt);
904}
905
906char* webgetm3u(char* param, int connfd, int fmt)
907{
908        int extip = 1;
909        char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
910        struct sockaddr_in sin;
911        socklen_t len = sizeof(sin);
912
913#ifdef MIPSEL
914        status.webencode = 0;
915#endif
916
917        if(param == NULL) return NULL;
918
919        if(getconfigint("webifip", NULL) == 1)
920                ip = getispip();
921
922        if(ip == NULL)
923        {
924                if(getsockname(connfd, &sin, &len) < 0)
925                {
926                        perr("getsockname");
927                        return NULL;
928                }
929
930                extip = 0;
931                ip = inet_ntoa(sin.sin_addr);
932                        if(ip == NULL) return NULL;
933        }
934
935        buf = ostrcat(buf, "#EXTM3U\n", 1, 0);
936        buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0);
937        buf = ostrcat(buf, "http://", 1, 0);
938        buf = ostrcat(buf, ip, 1, 0);
939        buf = ostrcat(buf, ":", 1, 0);
940        buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
941        buf = ostrcat(buf, "/", 1, 0);
942
943        tmpbuf = htmlencode(param);
944        if(tmpbuf != NULL)
945                param = tmpbuf;
946
947        buf = ostrcat(buf, param, 1, 0);
948        free(tmpbuf); tmpbuf = NULL;
949
950        if(extip == 1) free(ip);
951        return buf;
952}
953
954#ifdef MIPSEL
955char* webgettranscodem3u(char* param, int connfd, int fmt)
956{
957        int extip = 1;
958        char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
959        struct sockaddr_in sin;
960        socklen_t len = sizeof(sin);
961
962        status.webencode = 1;
963
964        if(param == NULL) return NULL;
965
966        if(getconfigint("webifip", NULL) == 1)
967                ip = getispip();
968
969        if(ip == NULL)
970        {
971                if(getsockname(connfd, &sin, &len) < 0)
972                {
973                        perr("getsockname");
974                        return NULL;
975                }
976
977                extip = 0;
978                ip = inet_ntoa(sin.sin_addr);
979                        if(ip == NULL) return NULL;
980        }
981
982        buf = ostrcat(buf, "#EXTM3U\n", 1, 0);
983        buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0);
984        buf = ostrcat(buf, "http://", 1, 0);
985        buf = ostrcat(buf, ip, 1, 0);
986        buf = ostrcat(buf, ":", 1, 0);
987        buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
988        buf = ostrcat(buf, "/", 1, 0);
989
990        tmpbuf = htmlencode(param);
991        if(tmpbuf != NULL)
992                param = tmpbuf;
993
994        buf = ostrcat(buf, param, 1, 0);
995        free(tmpbuf); tmpbuf = NULL;
996
997        if(extip == 1) free(ip);
998        return buf;
999}
1000#endif
1001
1002char* webgetbouquetm3u(char* param, int connfd, int fmt)
1003{
1004        int extip = 1;
1005        char* buf = NULL, *ip = NULL, *streamport = NULL;
1006        struct sockaddr_in sin;
1007        struct mainbouquet *mbouquet = NULL;
1008        struct bouquet *node = NULL;
1009        struct channel* chnode = NULL;
1010        socklen_t len = sizeof(sin);
1011
1012        if(param == NULL) return NULL;
1013
1014        if(getconfigint("webifip", NULL) == 1)
1015                ip = getispip();
1016
1017        if(ip == NULL)
1018        {
1019                if(getsockname(connfd, &sin, &len) < 0)
1020                {
1021                        perr("getsockname");
1022                        return NULL;
1023                }
1024
1025                extip = 0;
1026                ip = inet_ntoa(sin.sin_addr);
1027                        if(ip == NULL) return NULL;
1028        }
1029
1030        streamport = getconfig("streamport", NULL);
1031
1032        buf = ostrcat(buf, "#EXTM3U\n", 1, 0);
1033        buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0);
1034
1035        mbouquet = getmainbouquet(param);
1036        if(mbouquet != NULL)
1037        {
1038                node = mbouquet->bouquet;
1039                while(node != NULL)
1040                {
1041                        chnode = getchannel(node->serviceid, node->transponderid);
1042                        if(chnode != NULL)
1043                        {
1044                                buf = ostrcat(buf, "#EXTINF:-1,", 1, 0);
1045                                buf = ostrcat(buf, chnode->name, 1, 0);
1046                                buf = ostrcat(buf, "\n", 1, 0);
1047
1048                                buf = ostrcat(buf, "http://", 1, 0);
1049                                buf = ostrcat(buf, ip, 1, 0);
1050                                buf = ostrcat(buf, ":", 1, 0);
1051                                buf = ostrcat(buf, streamport, 1, 0);
1052                                buf = ostrcat(buf, "/", 1, 0);
1053                                buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
1054                                buf = ostrcat(buf, "%2c", 1, 0);
1055                                buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
1056                                buf = ostrcat(buf, "\n", 1, 0);
1057                        }
1058                        node = node->next;
1059                }
1060        }
1061        if(extip == 1) free(ip);
1062        return buf;
1063}
1064
1065char* webgetvideo(char* param, int connfd, int fmt)
1066{
1067        int extip = 1;
1068        char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
1069        struct sockaddr_in sin;
1070        socklen_t len = sizeof(sin);
1071
1072        if(param == NULL) return NULL;
1073
1074        if(getconfigint("webifip", NULL) == 1)
1075                ip = getispip();
1076
1077        if(ip == NULL)
1078        {
1079                if(getsockname(connfd, &sin, &len) < 0)
1080                {
1081                        perr("getsockname");
1082                        return NULL;
1083                }
1084
1085                extip = 0;
1086                ip = inet_ntoa(sin.sin_addr);
1087                if(ip == NULL) return NULL;
1088        }
1089
1090        if(fmt == 0)
1091        {
1092                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);
1093                buf = ostrcat(buf, "<embed width=100% height=100% type=application/x-vlc-plugin name=video autoplay=yes target=\"http://", 1, 0);
1094        }
1095        else
1096                buf = ostrcat(buf, "http://", 1, 0);
1097
1098        buf = ostrcat(buf, ip, 1, 0);
1099        buf = ostrcat(buf, ":", 1, 0);
1100        buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
1101        buf = ostrcat(buf, "/", 1, 0);
1102
1103        tmpbuf = htmlencode(param);
1104        if(tmpbuf != NULL)
1105                param = tmpbuf;
1106
1107        buf = ostrcat(buf, param, 1, 0);
1108        free(tmpbuf); tmpbuf = NULL;
1109
1110        if(fmt == 0)
1111        {
1112                buf = ostrcat(buf, "\" />", 1, 0);
1113                //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.play()'>Play</a>", 1, 0);
1114                //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.stop()'>Stop</a>", 1, 0);
1115                //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.fullscreen()'>Fullscreen</a>", 1, 0);
1116                buf = ostrcat(buf, "</td></tr></body></html>", 1, 0);
1117        }
1118
1119        if(extip == 1) free(ip);
1120        return buf;
1121}
1122
1123char* webvideo(char* param, int fmt)
1124{
1125        char* buf = NULL, *param1 = NULL, *tmpbuf = NULL;
1126
1127        if(param == NULL) return NULL;
1128
1129        if(ostrcmp("status", param) == 0) // status is only available for queryraw
1130        {
1131                char buf[30];
1132                int active = (status.webplayfile != NULL ? 1 : 0);
1133                int st = 0; // status, 0: paused, 1: playing
1134                unsigned long pos = 0; // current position
1135                unsigned long len = 0; // stream length
1136
1137                if(status.play == 1)
1138                        st = 1;
1139
1140                if(active == 1)
1141                {
1142                        pos = playergetpts() / 90000;
1143                        len = playergetlength();
1144                }
1145
1146                snprintf(buf, 30, "%d#%d#%lu#%lu", active, st, pos, len);
1147
1148                return ostrcat(buf, NULL, 0, 0);
1149        }
1150
1151        //create param1
1152        param1 = strchr(param, '&');
1153        if(param1 != NULL)
1154                *param1++ = '\0';
1155
1156        if(param1 == NULL) return NULL;
1157
1158        htmldecode(param1, param1);
1159        if(param1 != NULL)
1160        {
1161                if(status.play == 0 && status.webplayfile == NULL)
1162                {
1163                        if(ostrstr(param1, "url=") == param1)
1164                                status.webplayfile = ostrcat(param1 + 4, NULL, 0, 0);
1165                        else if(ostrstr(param1, "hosterurl=") == param1)
1166                        {
1167                                status.webplayfile = ostrcat(param1 + 10, NULL, 0, 0);
1168
1169                                // stream over tithek enable start
1170                                printf("status.webplayfile: %s\n",status.webplayfile);
1171                                struct skin* tithekplugin = getplugin("TiTan Mediathek");
1172                                if(tithekplugin != NULL)
1173                                {
1174                                        struct tithek* (*startplugin)(char*);
1175
1176                                        startplugin = dlsym(tithekplugin->pluginhandle, "hoster");
1177                                        if(startplugin != NULL)
1178                                        {
1179                                                status.webplayfile = (char*)startplugin(status.webplayfile);
1180                                                printf("status.webplayfile changed: %s\n",status.webplayfile);
1181                                        }
1182                                }
1183                                // stream over tithek enable end
1184                        }
1185                        else
1186                                status.webplayfile = ostrcat(param1, NULL, 0, 0);
1187                }
1188        }
1189        tmpbuf = ostrcat("not in play mode", NULL, 0, 0);
1190
1191        int count = 0;
1192        if(status.timeshift == 0 && status.play == 0 && (ostrcmp("play", param) == 0 || ostrcmp("play=", param) == 0))
1193        {
1194                int count = 0;
1195
1196                int rcret = getrcconfigint("rcwebplay", NULL);
1197                if(rcret == 0) rcret = getrcconfigint("rcarchive", NULL);
1198                if(rcret == 0) rcret = getrcconfigint("rcplay", NULL);
1199                writerc(rcret);
1200                while(status.play == 0 && count < 30)
1201                {
1202                        usleep(100000);
1203                        count++;
1204                }
1205        }
1206        else
1207                count = 31;
1208
1209        if(count >= 30 && status.play == 0)
1210        {
1211                free(status.webplayfile); status.webplayfile = NULL;
1212                free(tmpbuf); tmpbuf = NULL;
1213                tmpbuf = ostrcat("can not start playback", NULL, 0, 0);
1214        }
1215
1216        if(status.timeshift == 0 && status.play == 1)
1217        {
1218                if(ostrcmp("stop", param) == 0 || ostrcmp("stop=", param) == 0)
1219                        writerc(getrcconfigint("rcstop", NULL));
1220
1221                if(ostrcmp("pause", param) == 0 || ostrcmp("pause=", param) == 0)
1222                        writerc(getrcconfigint("rcpause", NULL));
1223
1224                if(ostrcmp("ff", param) == 0 || ostrcmp("ff=", param) == 0)
1225                        writerc(getrcconfigint("rcff", NULL));
1226
1227                if(ostrcmp("fr", param) == 0 || ostrcmp("fr=", param) == 0)
1228                        writerc(getrcconfigint("rcfr", NULL));
1229
1230                free(tmpbuf); tmpbuf = NULL;
1231                tmpbuf = ostrcat(param, NULL, 0, 0);
1232
1233                if(ostrcmp("getlen", param) == 0 || ostrcmp("getlen=", param) == 0)
1234                {
1235                        unsigned long len = 0;
1236                        free(tmpbuf); tmpbuf = NULL;
1237
1238                        len = playergetlength();
1239                        tmpbuf = ostrcat(buf, olutoa(len), 1, 1);
1240                }
1241
1242                if(ostrcmp("getpos", param) == 0 || ostrcmp("getpos=", param) == 0)
1243                {
1244                        unsigned long pos = 0;
1245                        free(tmpbuf); tmpbuf = NULL;
1246
1247                        pos = playergetpts() / 90000;
1248                        tmpbuf = ostrcat(buf, olutoa(pos), 1, 1);
1249                }
1250
1251                if(ostrcmp("getisplaying", param) == 0 || ostrcmp("getisplaying=", param) == 0)
1252                {
1253                        int playing = 0;
1254                        free(tmpbuf); tmpbuf = NULL;
1255
1256                        playing = playerisplaying();
1257                        tmpbuf = ostrcat(buf, oitoa(playing), 1, 1);
1258                }
1259
1260                if(ostrcmp("getplayercan", param) == 0 || ostrcmp("getplayercan=", param) == 0)
1261                {
1262                        free(tmpbuf); tmpbuf = NULL;
1263                        tmpbuf = ostrcat(buf, olutoa(status.playercan), 1, 1);
1264                }
1265        }
1266
1267        if(fmt == 0)
1268        {
1269                buf = webcreatehead(buf, NULL, 1);
1270                buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Video ", 1, 0);
1271                buf = ostrcat(buf, tmpbuf, 1, 1);
1272                buf = ostrcat(buf, " !!!</font></td></tr>", 1, 0);
1273                buf = webcreatetail(buf, 1);
1274        }
1275        else
1276                buf = ostrcat(buf, tmpbuf, 1, 1);
1277
1278        return buf;
1279}
1280
1281char* webgetchannelpage(char* param, int fmt)
1282{
1283        char* param1 = NULL, *param2 = NULL;
1284
1285        if(param == NULL) return NULL;
1286
1287        //create param1 + 2
1288        param1 = strchr(param, '&');
1289        if(param1 != NULL)
1290        {
1291                *param1++ = '\0';
1292                param2 = strchr(param1, '&');
1293                if(param2 != NULL)
1294                        *param2++ = '\0';
1295        }
1296
1297        if(param1 == NULL || param2 == NULL) return NULL;
1298
1299        return webgetchannel(atoi(param), atoi(param1), atoi(param2), fmt);
1300}
1301
1302void webmessage(struct stimerthread* timernode, char* text, int flag)
1303{
1304        textbox(_("Message"), text, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
1305        free(text);
1306}
1307
1308char* websendmessage(char* param, int fmt)
1309{
1310        char* text = NULL, *buf = NULL;
1311
1312        if(param == NULL) return NULL;
1313        param = strchr(param, '=');
1314        if(param != NULL)
1315        {
1316                param++;
1317                stringreplacechar(param, '+', ' ');
1318                text = ostrcat(text, param, 1, 0);
1319        }
1320        addtimer(&webmessage, START, 1000, 1, (void*)text, NULL, NULL);
1321
1322        if(fmt == 0)
1323        {
1324                buf = webcreatehead(buf, NULL, 1);
1325                buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Message Send !!!</font></td></tr>", 1, 0);
1326                buf = webcreatetail(buf, 1);
1327        }
1328        else
1329                buf = ostrcat(buf, "Message Send", 1, 0);
1330
1331        return buf;
1332}
1333
1334char* webgetsignal(int fmt)
1335{
1336        char* buf = NULL, *tmpnr = NULL;
1337        uint16_t snr = 0, signal = 0;
1338        uint32_t ber = 0, unc = 0;
1339
1340        ber = fereadber(status.aktservice->fedev);
1341        unc = fereaduncorrectedblocks(status.aktservice->fedev);
1342        signal = fereadsignalstrength(status.aktservice->fedev);
1343        snr = fereadsnr(status.aktservice->fedev);
1344        snr = (snr * 100) / 0xffff;
1345
1346        if(fmt == 0)
1347        {
1348                buf = webcreatehead(buf, "<meta http-equiv=refresh content=1>", 0);
1349
1350                buf = ostrcat(buf, "<tr><td align=center><font class=biglabel><br><br>BER: ", 1, 0);
1351                tmpnr = oitoa(ber);
1352                buf = ostrcat(buf, tmpnr, 1, 0);
1353                free(tmpnr); tmpnr = NULL;
1354
1355                buf = ostrcat(buf, "<br>UNC: ", 1, 0);
1356                tmpnr = oitoa(unc);
1357                buf = ostrcat(buf, tmpnr, 1, 0);
1358                free(tmpnr); tmpnr = NULL;
1359
1360                buf = ostrcat(buf, "<br>SIG: ", 1, 0);
1361                tmpnr = oitoa(signal);
1362                buf = ostrcat(buf, tmpnr, 1, 0);
1363                free(tmpnr); tmpnr = NULL;
1364
1365                buf = ostrcat(buf, "<br>SNR: ", 1, 0);
1366                tmpnr = oitoa(snr);
1367                buf = ostrcat(buf, tmpnr, 1, 0);
1368                free(tmpnr); tmpnr = NULL;
1369
1370                buf = ostrcat(buf, "</font></td></tr>", 1, 0);
1371                buf = webcreatetail(buf, 0);
1372        }
1373        else
1374        {
1375                buf = ostrcat(buf, oitoa(ber), 1, 1);
1376                buf = ostrcat(buf, "#", 1, 0);
1377                buf = ostrcat(buf, oitoa(unc), 1, 1);
1378                buf = ostrcat(buf, "#", 1, 0);
1379                buf = ostrcat(buf, oitoa(signal), 1, 1);
1380                buf = ostrcat(buf, "#", 1, 0);
1381                buf = ostrcat(buf, oitoa(snr), 1, 1);
1382        }
1383
1384        return buf;
1385}
1386
1387char* webgetepg(char* param, int fmt)
1388{
1389        char* buf = NULL, *buf1 = NULL, *tmpstr = NULL, *param1 = NULL, *param2 = NULL;
1390        struct epg* epgnode = NULL;
1391        struct channel* chnode = NULL;
1392        struct tm *loctime = NULL;
1393
1394        if(param == NULL) return NULL;
1395
1396        //create param1 + 2
1397        param1 = strchr(param, '&');
1398        if(param1 != NULL)
1399        {
1400                *param1++ = '\0';
1401                param2 = strchr(param1, '&');
1402                if(param2 != NULL)
1403                        *param2++ = '\0';
1404        }
1405
1406        if(param1 == NULL || param2 == NULL) return NULL;
1407
1408        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
1409        if(chnode == NULL) return NULL;
1410
1411        epgnode = getepg(chnode, atoi(param2), 0);
1412        if(epgnode == NULL) return NULL;
1413
1414        if(fmt == 0) buf = webcreatehead(buf, NULL, 0);
1415
1416        buf1 = malloc(MINMALLOC);
1417        if(buf1 == NULL)
1418        {
1419                err("no mem");
1420                return buf;
1421        }
1422
1423        if(fmt == 0)
1424        {
1425                buf = ostrcat(buf, "<tr class=channelname><td><h4 style=\"margin:2px 0px\">", 1, 0);
1426                buf = ostrcat(buf, chnode->name, 1, 0);
1427                buf = ostrcat(buf, "</h4></td></tr>", 1, 0);
1428        }
1429
1430        if(fmt == 0) buf = ostrcat(buf, "<tr><td><font class=biglabel>", 1, 0);
1431        if(epgnode->title != NULL)
1432        {
1433                buf = ostrcat(buf, epgnode->title, 1, 0);
1434                if(fmt == 0)
1435                {
1436                        buf = ostrcat(buf, " (", 1, 0);
1437                        loctime = olocaltime(&epgnode->starttime);
1438                        if(loctime != NULL)
1439                                strftime(buf1, MINMALLOC, "%H:%M -", loctime);
1440                        free(loctime); loctime = NULL;
1441                        loctime = olocaltime(&epgnode->endtime);
1442                        if(loctime != NULL)
1443                                strftime(&buf1[7], MINMALLOC - 8, " %H:%M", loctime);
1444                        free(loctime); loctime = NULL;
1445                        buf = ostrcat(buf, buf1, 1, 0);
1446                        buf = ostrcat(buf, ")", 1, 0);
1447                }
1448        }
1449        if(fmt == 0)
1450        {
1451                buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
1452                buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
1453        }
1454        else
1455        {
1456                buf = ostrcat(buf, "#", 1, 0);
1457                buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
1458                buf = ostrcat(buf, "#", 1, 0);
1459                buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
1460                buf = ostrcat(buf, "#", 1, 0);
1461        }
1462
1463        if(epgnode->subtitle != NULL)
1464                buf = ostrcat(buf, epgnode->subtitle, 1, 0);
1465
1466        if(fmt == 0)
1467        {
1468                buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
1469                buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
1470        }
1471        else
1472                buf = ostrcat(buf, "#", 1, 0);
1473
1474        tmpstr = epgdescunzip(epgnode);
1475        if(tmpstr != NULL)
1476                buf = ostrcat(buf, tmpstr, 1, 0);
1477        free(tmpstr); tmpstr = NULL;
1478
1479        if(fmt == 0)
1480        {
1481                buf = ostrcat(buf, "</font></td></tr>", 1, 0);
1482                buf = webcreatetail(buf, 0);
1483        }
1484
1485        free(buf1);
1486        return buf;
1487}
1488
1489char* webgetsingleepg(char* param, int fmt)
1490{
1491        int line = 0, maxlen = 0, pos = 0, longdesc = 1;
1492        char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL, *tmpstr = NULL;
1493        struct epg* epgnode = NULL;
1494        struct channel* chnode = NULL;
1495        struct tm *loctime = NULL;
1496
1497        if(param == NULL) return NULL;
1498
1499        //create param1 + 2
1500        param1 = strchr(param, '&');
1501        if(param1 != NULL)
1502        {
1503                *param1++ = '\0';
1504                param2 = strchr(param1, '&');
1505                if(param2 != NULL)
1506                        *param2++ = '\0';
1507        }
1508
1509        if(param1 == NULL) return NULL;
1510        if(param2 != NULL) longdesc = atoi(param2);
1511
1512        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
1513        if(chnode == NULL) return NULL;
1514        epgnode = getepgakt(chnode);;
1515
1516        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
1517
1518        buf1 = malloc(MINMALLOC);
1519        if(buf1 == NULL)
1520        {
1521                err("no mem");
1522                return buf;
1523        }
1524
1525        if(fmt == 0)
1526        {
1527                ostrcatbig(&buf, "<tr class=channelname><td colspan=4><h4 style=\"margin:2px 0px\">", &maxlen, &pos);
1528                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1529                ostrcatbig(&buf, "</h4></td></tr>", &maxlen, &pos);
1530                ostrcatbig(&buf, "<tr class=tabledesc><td width=70px align=center>Datum</td><td width=70px align=center>Uhrzeit</td><td align=left>Beschreibung</td><td width=50px align=center>Timer</td></tr>", &maxlen, &pos);
1531        }
1532
1533        while(epgnode != NULL)
1534        {
1535                if(fmt == 0)
1536                {
1537                        if(line == 0)
1538                        {
1539                                ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
1540                                line = 1;
1541                        }
1542                        else
1543                        {
1544                                ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
1545                                line = 0;
1546                        }
1547
1548                        loctime = olocaltime(&epgnode->starttime);
1549                        if(loctime != NULL)
1550                                strftime(buf1, MINMALLOC, "%d.%m", loctime);
1551                        ostrcatbig(&buf, "<td nowrap class=coldate>", &maxlen, &pos);
1552                        ostrcatbig(&buf, buf1, &maxlen, &pos);
1553                        if(loctime != NULL)
1554                                strftime(buf1, MINMALLOC, "%H.%M", loctime);
1555                        ostrcatbig(&buf, "</td><td nowrap class=coltime>", &maxlen, &pos);
1556                        ostrcatbig(&buf, buf1, &maxlen, &pos);
1557                        free(loctime); loctime = NULL;
1558
1559                        ostrcatbig(&buf, "</td><td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
1560                        tmpstr = oitoa(chnode->serviceid);
1561                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1562                        buf2 = ostrcat("<td nowrap class=linkimage><a target=main class=link href=query?addrectimer&", tmpstr, 0, 0);
1563                        buf2 = ostrcat(buf2, "&", 0, 0);
1564                        free(tmpstr); tmpstr = NULL;
1565                        ostrcatbig(&buf, "&", &maxlen, &pos);
1566                        tmpstr = ollutoa(chnode->transponderid);
1567                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1568                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1569                        buf2 = ostrcat(buf2, "&", 0, 0);
1570                        free(tmpstr); tmpstr = NULL;
1571                        ostrcatbig(&buf, "&", &maxlen, &pos);
1572                        tmpstr = oitoa(epgnode->eventid);
1573                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1574                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1575                        buf2 = ostrcat(buf2, ">", 0, 0);
1576                        free(tmpstr); tmpstr = NULL;
1577                        ostrcatbig(&buf, ">", &maxlen, &pos);
1578
1579                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1580                        if(epgnode->subtitle != NULL)
1581                        {
1582                                ostrcatbig(&buf, " (", &maxlen, &pos);
1583                                ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
1584                                ostrcatbig(&buf, ")", &maxlen, &pos);
1585                        }
1586
1587                        ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
1588                        ostrcatbig(&buf, buf2, &maxlen, &pos);
1589
1590                        ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/timer.png alt=\"set timer\"/>", &maxlen, &pos);
1591                        ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
1592                }
1593                else
1594                {
1595                        buf = ostrcat(buf, epgnode->title, 1, 0);
1596                        buf = ostrcat(buf, "#", 1, 0);
1597                        buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
1598                        buf = ostrcat(buf, "#", 1, 0);
1599                        buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
1600                        buf = ostrcat(buf, "#", 1, 0);
1601                        buf = ostrcat(buf, epgnode->subtitle, 1, 0);
1602                        buf = ostrcat(buf, "#", 1, 0);
1603                        if(longdesc == 1)
1604                        {
1605                                tmpstr = epgdescunzip(epgnode);
1606                                if(tmpstr != NULL)
1607                                        buf = ostrcat(buf, tmpstr, 1, 0);
1608                                free(tmpstr); tmpstr = NULL;
1609                        }
1610                        buf = ostrcat(buf, "#", 1, 0);
1611                        buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1);
1612                        buf = ostrcat(buf, "\n", 1, 0);
1613                }
1614
1615                epgnode = epgnode->next;
1616                free(buf2); buf2 = NULL;
1617        }
1618
1619        if(fmt == 0)
1620                webcreatetailbig(&buf, &maxlen, &pos, 0);
1621        else if(buf == NULL)
1622                buf = ostrcat("no data", NULL, 0, 0);
1623
1624        free(buf1);
1625        return buf;
1626}
1627
1628//TODO: create rectimer line
1629void webcalcrecline(char** buf, int* maxlen, int* pos)
1630{
1631        //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);
1632}
1633
1634char* webgetgmultiepg(char* param, int fmt)
1635{
1636        int page = 1, i, line = 0, treffer = 0, maxlen = 0, pos = 0;
1637        char* buf = NULL, *tmpnr = NULL, *param1 = NULL;
1638        struct mainbouquet *mbouquet = NULL;
1639        struct bouquet *node = NULL;
1640        struct channel* chnode = NULL;
1641        struct epg* epgnode = NULL;
1642        time_t akttime = 0, difftime = 0, starttime = 0, endtime = 0, lastendtime = 0;
1643
1644        if(param == NULL) return NULL;
1645
1646        //create param1
1647        param1 = strchr(param, '&');
1648        if(param1 != NULL)
1649                *param1++ = '\0';
1650
1651        if(param1 != NULL) page = atoi(param1);
1652
1653        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);
1654
1655        akttime = webcreatetimeline(&buf, &maxlen, &pos);
1656        akttime += ((page - 1) * 1440);
1657        ostrcatbig(&buf, "</tr></thead><tbody>", &maxlen, &pos);
1658
1659        mbouquet = getmainbouquet(param);
1660        if(mbouquet != NULL)
1661        {
1662                node = mbouquet->bouquet;
1663                while(node != NULL)
1664                {
1665                        chnode = getchannel(node->serviceid, node->transponderid);
1666                        if(chnode != NULL)
1667                        {
1668                                if(line == 0)
1669                                {
1670                                        ostrcatbig(&buf, "<tr><th class=gepgchannel1>", &maxlen, &pos);
1671                                        ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1672                                        ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
1673                                        webcalcrecline(&buf, &maxlen, &pos);
1674                                        ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line1>", &maxlen, &pos);
1675                                        line = 1;
1676                                }
1677                                else
1678                                {
1679                                        ostrcatbig(&buf, "<tr><th class=gepgchannel2>", &maxlen, &pos);
1680                                        ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1681                                        ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
1682                                        webcalcrecline(&buf, &maxlen, &pos);
1683
1684                                        ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line2>", &maxlen, &pos);
1685                                        line = 0;
1686                                }
1687
1688                                treffer = 0;
1689                                lastendtime = 0;
1690                                epgnode = getepgakt(chnode);
1691                                while(epgnode != NULL)
1692                                {
1693                                        treffer = 1;
1694                                        starttime = epgnode->starttime / 60;
1695                                        endtime = epgnode->endtime / 60;
1696
1697                                        if(endtime <= starttime || starttime >= akttime + 1440)
1698                                        {
1699                                                epgnode = epgnode->next;
1700                                                continue;
1701                                        }
1702
1703                                        //check if old endtime > new starttime
1704                                        if(lastendtime > 0 && starttime > lastendtime)
1705                                        {
1706                                                difftime = (starttime - lastendtime) * 5;
1707
1708                                                if(difftime <= 0)
1709                                                {
1710                                                        epgnode = epgnode->next;
1711                                                        continue;
1712                                                }
1713
1714                                                ostrcatbig(&buf, "<td class=gepgcellblank style=\"", &maxlen, &pos);
1715                                                tmpnr = oitoa(difftime);
1716                                                ostrcatbig(&buf, "width:", &maxlen, &pos);
1717                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1718                                                ostrcatbig(&buf, "px;", &maxlen, &pos);
1719                                                ostrcatbig(&buf, "min-width:", &maxlen, &pos);
1720                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1721                                                ostrcatbig(&buf, "px;", &maxlen, &pos);
1722                                                ostrcatbig(&buf, "max-width:", &maxlen, &pos);
1723                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1724                                                ostrcatbig(&buf, "px;", &maxlen, &pos);
1725                                                free(tmpnr); tmpnr = NULL;
1726
1727                                                ostrcatbig(&buf, "\"> </td>", &maxlen, &pos);
1728                                        }
1729
1730                                        //check if starttime < last endtime
1731                                        if(starttime < lastendtime)
1732                                                starttime = lastendtime;
1733
1734                                        //check if endtime is in next day
1735                                        if(endtime > akttime + 1440)
1736                                                endtime = endtime - (endtime - (akttime + 1440));
1737
1738                                        //check if starttime is in prev day
1739                                        if(starttime < akttime)
1740                                                difftime = (endtime - akttime) * 5;
1741                                        else
1742                                                difftime = (endtime - starttime) * 5;
1743
1744                                        if(difftime <= 0)
1745                                        {
1746                                                epgnode = epgnode->next;
1747                                                continue;
1748                                        }
1749
1750                                        lastendtime = endtime;
1751
1752                                        ostrcatbig(&buf, "<td class=gepgcell style=\"", &maxlen, &pos);
1753                                        tmpnr = oitoa(difftime);
1754                                        ostrcatbig(&buf, "width:", &maxlen, &pos);
1755                                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1756                                        ostrcatbig(&buf, "px;", &maxlen, &pos);
1757                                        ostrcatbig(&buf, "min-width:", &maxlen, &pos);
1758                                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1759                                        ostrcatbig(&buf, "px;", &maxlen, &pos);
1760                                        ostrcatbig(&buf, "max-width:", &maxlen, &pos);
1761                                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1762                                        ostrcatbig(&buf, "px;", &maxlen, &pos);
1763                                        free(tmpnr); tmpnr = NULL;
1764
1765                                        ostrcatbig(&buf, "\"><div class=gepgcellborder>", &maxlen, &pos);
1766                                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1767                                        ostrcatbig(&buf, "</div></div></td>", &maxlen, &pos);
1768
1769                                        epgnode = epgnode->next;
1770                                }
1771                                if(treffer == 0)
1772                                        ostrcatbig(&buf, "<td class=gepgcellblank> </td>", &maxlen, &pos);
1773                        }
1774                        ostrcatbig(&buf, "</tr></table></td></tr>", &maxlen, &pos);
1775
1776                        node = node->next;
1777                }
1778        }
1779        ostrcatbig(&buf, "<script type=text/javascript>if(typeof tableScroll == 'function'){tableScroll('gmultiepg');}</script></tbody></table></td></tr><tr><td align=center>", &maxlen, &pos);
1780
1781        for(i = 1; i <= 14; i++)
1782        {
1783                if(page == i)
1784                        ostrcatbig(&buf, "<a class=pagesellink href=\"query?getgmultiepg&", &maxlen, &pos);
1785                else
1786                        ostrcatbig(&buf, "<a class=pagelink href=\"query?getgmultiepg&", &maxlen, &pos);
1787                ostrcatbig(&buf, param, &maxlen, &pos);
1788                ostrcatbig(&buf, "&", &maxlen, &pos);
1789                tmpnr = oitoa(i);
1790                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1791                ostrcatbig(&buf, "\">", &maxlen, &pos);
1792                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
1793                ostrcatbig(&buf, "</a>", &maxlen, &pos);
1794                free(tmpnr); tmpnr = NULL;
1795        }
1796
1797        ostrcatbig(&buf, "</td></tr></table></center></body></html>", &maxlen, &pos);
1798        return buf;
1799}
1800
1801char* webgetdrawcount(char* param, int fmt)
1802{
1803        return oitoa(status.drawscreencount);
1804}
1805
1806void webgetshoot(char* param, int fmt)
1807{
1808        printf("param: %s\n",param);
1809        printf("parm: %d\n",fmt);
1810        screenshoot(atoi(param));
1811}
1812
1813char* webgetepgsearch(char* query, char* param, int fmt)
1814{
1815        int line = 0, maxlen = 0, pos = 0, maxcount = 0, page = 1, newchannel = 0, longepg = 0;
1816        char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *tmpstr = NULL, *tmpnr = NULL, *param1 = NULL, *param2 = NULL;
1817        struct channel* chnode = channel;
1818        struct epg* epgnode = NULL;
1819        struct tm *loctime = NULL;
1820
1821        if(query == NULL) return NULL;
1822
1823        if(param == NULL)
1824        {
1825                query = strchr(query, '=');
1826                if(query != NULL)
1827                {
1828                        query++;
1829                        stringreplacechar(param, '+', ' ');
1830                        param = query;
1831                }
1832        }
1833        else
1834        {
1835                //create param1 + 2
1836                param1 = strchr(param, '&');
1837                if(param1 != NULL)
1838                {
1839                        *param1++ = '\0';
1840                        param2 = strchr(param1, '&');
1841                        if(param2 != NULL)
1842                                *param2++ = '\0';
1843                }
1844        }
1845
1846        if(param1 != NULL) page = atoi(param1);
1847        if(param2 != NULL) longepg = atoi(param2);
1848
1849        buf1 = malloc(MINMALLOC);
1850        if(buf1 == NULL)
1851        {
1852                err("no mem");
1853                return buf;
1854        }
1855
1856        if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
1857        while(chnode != NULL)
1858        {
1859                newchannel = 1;
1860                epgnode = getepgakt(chnode);
1861                while(epgnode != NULL)
1862                {
1863                        if(epgnode->title != NULL && ostrstrcase(epgnode->title, param) != NULL)
1864                        {
1865
1866                                maxcount++;
1867
1868                                if(page >= 0)
1869                                {
1870                                        if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
1871                                        {
1872                                                epgnode = epgnode->next;
1873                                                continue;
1874                                        }
1875                                }
1876
1877                                if(fmt == 0)
1878                                {
1879                                        if(line == 0)
1880                                        {
1881                                                ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
1882                                                line = 1;
1883                                        }
1884                                        else
1885                                        {
1886                                                ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
1887                                                line = 0;
1888                                        }
1889                                }
1890
1891                                if(fmt == 1 && newchannel == 1)
1892                                {
1893                                        newchannel = 0;
1894                                        ostrcatbig(&buf, "BeginNewChannel", &maxlen, &pos);
1895                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1896                                        ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1897                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1898                                        tmpstr = oitoa(chnode->serviceid);
1899                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1900                                        free(tmpstr); tmpstr = NULL;
1901                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1902                                        tmpstr = ollutoa(chnode->transponderid);
1903                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1904                                        free(tmpstr); tmpstr = NULL;
1905                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1906                                        tmpstr = oitoa(chnode->servicetype);
1907                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1908                                        free(tmpstr); tmpstr = NULL;
1909                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
1910                                }
1911
1912                                if(fmt == 0)
1913                                {
1914                                        ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
1915                                        tmpstr = oitoa(chnode->serviceid);
1916                                        buf2 = ostrcat("<td nowrap><a target=main class=link href=query?addrectimer&", tmpstr, 0, 0);
1917                                        buf2 = ostrcat(buf2, "&", 0, 0);
1918                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1919                                        free(tmpstr); tmpstr = NULL;
1920                                        ostrcatbig(&buf, "&", &maxlen, &pos);
1921                                        tmpstr = ollutoa(chnode->transponderid);
1922                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1923                                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1924                                        buf2 = ostrcat(buf2, "&", 0, 0);
1925                                        free(tmpstr); tmpstr = NULL;
1926                                        ostrcatbig(&buf, "&", &maxlen, &pos);
1927                                        tmpstr = oitoa(epgnode->eventid);
1928                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1929                                        buf2 = ostrcat(buf2, tmpstr, 0, 0);
1930                                        buf2 = ostrcat(buf2, ">", 0, 0);
1931                                        free(tmpstr); tmpstr = NULL;
1932                                        ostrcatbig(&buf, ">", &maxlen, &pos);
1933
1934                                        loctime = olocaltime(&epgnode->starttime);
1935                                        if(loctime != NULL)
1936                                                strftime(buf1, MINMALLOC, "%d.%m _ %H:%M __ ", loctime);
1937                                                //strftime(buf1, MINMALLOC, "%H:%M -", loctime);
1938                                        free(loctime); loctime = NULL;
1939                                        //loctime = olocaltime(&epgnode->endtime);
1940                                        //if(loctime != NULL)
1941                                        //      strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
1942                                        //free(loctime); loctime = NULL;
1943                                        ostrcatbig(&buf, buf1, &maxlen, &pos);
1944                                        ostrcatbig(&buf, " ", &maxlen, &pos);
1945
1946                                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1947                                        if(chnode->name != NULL)
1948                                        {
1949                                                ostrcatbig(&buf, " (", &maxlen, &pos);
1950                                                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
1951                                                ostrcatbig(&buf, ")", &maxlen, &pos);
1952                                        }
1953
1954                                        ostrcatbig(&buf, "</a><br><font class=smalllabel1>", &maxlen, &pos);
1955                                        ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
1956
1957                                        ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
1958                                        ostrcatbig(&buf, buf2, &maxlen, &pos);
1959                                        ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/timer.png alt=\"set timer\"/>", &maxlen, &pos);
1960                                        ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
1961                                }
1962                                else
1963                                {
1964                                        ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
1965                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1966
1967                                        tmpstr = olutoa(epgnode->starttime);
1968                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1969                                        free(tmpstr); tmpstr = NULL;
1970                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1971
1972                                        tmpstr = olutoa(epgnode->endtime);
1973                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1974                                        free(tmpstr); tmpstr = NULL;
1975                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1976
1977                                        ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
1978                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1979
1980                                        if(longepg == 1)
1981                                        {
1982                                                tmpstr = epgdescunzip(epgnode);
1983                                                if(tmpstr != NULL)
1984                                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1985                                                free(tmpstr); tmpstr = NULL;
1986                                        }
1987                                        ostrcatbig(&buf, "#", &maxlen, &pos);
1988
1989                                        tmpstr = oitoa(epgnode->eventid);
1990                                        ostrcatbig(&buf, tmpstr, &maxlen, &pos);
1991                                        free(tmpstr); tmpstr = NULL;
1992                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
1993                                }
1994                        }
1995                        epgnode = epgnode->next;
1996                        free(buf2); buf2 = NULL;
1997                }
1998                chnode = chnode->next;
1999        }
2000
2001        if(maxcount > MAXHTMLLINE && fmt == 0)
2002        {
2003                int i;
2004                ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
2005                for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
2006                {
2007                        if(page == i)
2008                                ostrcatbig(&buf, "<a class=pagesellink href=query?getepgsearch&", &maxlen, &pos);
2009                        else
2010                                ostrcatbig(&buf, "<a class=pagelink href=query?getepgsearch&", &maxlen, &pos);
2011                        ostrcatbig(&buf, param, &maxlen, &pos);
2012                        ostrcatbig(&buf, "&", &maxlen, &pos);
2013                        free(tmpnr); tmpnr = NULL;
2014
2015                        tmpnr = oitoa(i);
2016                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2017                        ostrcatbig(&buf, ">", &maxlen, &pos);
2018                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2019                        ostrcatbig(&buf, "</a>", &maxlen, &pos);
2020                        free(tmpnr); tmpnr = NULL;
2021                }
2022                ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
2023        }
2024
2025        if(fmt == 0)
2026                webcreatetailbig(&buf, &maxlen, &pos, 0);
2027        else if(buf == NULL)
2028                buf = ostrcat("no data", NULL, 0, 0);
2029
2030        free(buf1);
2031        return buf;
2032}
2033
2034//flagbit 0: restrict to path
2035//flagbit 1: show epg icon
2036//flagbit 2: show delete icon
2037//flagbit 3: show stream icon
2038//flagbit 4: show websteam icon
2039char* webgetfilelist(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt)
2040{
2041        char* buf = NULL, *tmppath = NULL, *tmpnr = NULL, *param1 = NULL;
2042        int maxlen = 0, pos = 0, line = 0, maxcount = 0, page = 1;
2043        struct skin* webdir = getscreen("webdir");
2044        struct skin* filelist = getscreennode(webdir, "filelist");
2045        struct skin* filelistpath = getscreennode(webdir, "filelistpath");
2046        struct skin* node = NULL;
2047
2048        if(param == NULL) param = path;
2049
2050        //create param1
2051        param1 = strchr(param, '&');
2052        if(param1 != NULL)
2053                *param1++ = '\0';
2054
2055        if(param1 != NULL) page = atoi(param1);
2056
2057        if(strlen(param) == 0 || !isdir(param))
2058                tmppath = ostrcat(path, NULL, 0, 0);
2059        else
2060                tmppath = ostrcat(param, NULL, 0, 0);
2061
2062        char* tmppath1 = createpath(tmppath, "");
2063        free(tmppath); tmppath = tmppath1;
2064
2065        if(checkbit(flag, 0) == 1)
2066        {
2067                if(ostrstr(tmppath, path) != tmppath)
2068                {
2069                        free(tmppath); tmppath = NULL;
2070                        tmppath = ostrcat(path, NULL, 0, 0);
2071                }
2072        }
2073
2074        changemask(filelist, mask);
2075        changeinput(filelist, tmppath);
2076        changetext(filelistpath, filelist->input);
2077
2078        free(tmppath); tmppath = NULL;
2079
2080        delmarkedscreennodes(webdir, FILELISTDELMARK);
2081        createfilelist(webdir, filelist, 0);
2082
2083        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);
2084
2085        node = filelist;
2086        while(node != NULL)
2087        {
2088                if(node->del == FILELISTDELMARK)
2089                {
2090                        maxcount++;
2091                        if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
2092                        {
2093                                node = node->next;
2094                                continue;
2095                        }
2096
2097                        if(fmt == 0)
2098                        {
2099                                if(line == 0)
2100                                {
2101                                        ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
2102                                        line = 1;
2103                                }
2104                                else
2105                                {
2106                                        ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
2107                                        line = 0;
2108                                }
2109
2110                                ostrcatbig(&buf, "<td>", &maxlen, &pos);
2111                        }
2112                        if(node->input != NULL) //dir
2113                        {
2114                                if(fmt == 0)
2115                                {
2116                                        ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/folder.png alt=Directory> <a class=link href=\"query?", &maxlen, &pos);
2117                                        ostrcatbig(&buf, link, &maxlen, &pos);
2118                                        ostrcatbig(&buf, "&", &maxlen, &pos);
2119                                        ostrcatbig(&buf, node->input, &maxlen, &pos);
2120                                        ostrcatbig(&buf, "\">", &maxlen, &pos);
2121                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
2122                                        ostrcatbig(&buf, "</a><td> </td>", &maxlen, &pos);
2123                                }
2124                                else
2125                                {
2126                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
2127                                        ostrcatbig(&buf, "#0", &maxlen, &pos);
2128                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
2129                                }
2130                        }
2131                        else
2132                        {
2133                                if(fmt == 0)
2134                                {
2135                                        ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
2136                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
2137                                        ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
2138
2139                                        ostrcatbig(&buf, "<td width=80 align=right>", &maxlen, &pos);
2140
2141                                        //epg png
2142                                        if(checkbit(flag, 1) == 1)
2143                                        {
2144                                                node->text = string_replace_all("\"", "&#34;", node->text, 1);
2145                                                ostrcatbig(&buf, "<a href=\"query?getmovieepg&", &maxlen, &pos);
2146                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2147                                                ostrcatbig(&buf, "/", &maxlen, &pos);
2148                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
2149                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2150                                                ostrcatbig(&buf, "<img border=0 src=img/movieepg.png width=16 height=16 alt=EPG></a>", &maxlen, &pos);
2151                                        }
2152                                        //delete png
2153                                        if(checkbit(flag, 2) == 1)
2154                                        {
2155                                                node->text = string_replace_all("'", "&#39;", node->text, 1);
2156                                                node->text = string_replace_all("\"", "&#34;", node->text, 1);
2157                                                ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
2158                                                ostrcatbig(&buf, "query?", &maxlen, &pos);
2159                                                ostrcatbig(&buf, dellink, &maxlen, &pos);
2160                                                ostrcatbig(&buf, "&", &maxlen, &pos);
2161                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2162                                                ostrcatbig(&buf, "&", &maxlen, &pos);
2163                                                tmpnr = oitoa(page);
2164                                                ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2165                                                free(tmpnr); tmpnr = NULL;
2166                                                ostrcatbig(&buf, "&", &maxlen, &pos);
2167                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
2168                                                ostrcatbig(&buf, "\");'>", &maxlen, &pos);
2169                                        }
2170                                        //stream png
2171                                        if(checkbit(flag, 3) == 1)
2172                                        {
2173                                                ostrcatbig(&buf, "<a target=nothing href=\"query?getm3u&0,0,", &maxlen, &pos);
2174                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2175                                                ostrcatbig(&buf, "/", &maxlen, &pos);
2176                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
2177                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2178                                                ostrcatbig(&buf, "<img border=0 src=img/stream.png width=16 height=16 alt=Stream></a>", &maxlen, &pos);
2179                                        }
2180                                        //transstream png
2181#ifdef MIPSEL
2182                                        if(checkbit(flag, 3) == 1)
2183                                        {
2184
2185                                                if(file_exist("/proc/stb/encoder") &&  getconfigint("web_trans_transcode", NULL) == 1)
2186                                                {
2187                                                        ostrcatbig(&buf, "<a target=nothing href=\"query?gettranscodem3u&0,0,", &maxlen, &pos);
2188                                                        ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2189                                                        ostrcatbig(&buf, "/", &maxlen, &pos);
2190                                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
2191                                                        ostrcatbig(&buf, "\">", &maxlen, &pos);
2192                                                        ostrcatbig(&buf, "<img border=0 src=img/transstream.png width=16 height=16 alt=Stream Transcode></a>", &maxlen, &pos);
2193                                                }
2194                                        }
2195#endif
2196                                        //webstream png
2197                                        if(checkbit(flag, 4) == 1)
2198                                        {
2199                                                ostrcatbig(&buf, "<a target=_blank href=\"query?getvideo&0,0,", &maxlen, &pos);
2200                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2201                                                ostrcatbig(&buf, "/", &maxlen, &pos);
2202                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
2203                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2204
2205                                                ostrcatbig(&buf, "<img border=0 src=img/webstream.png width=16 height=16 alt=WebStream></a>", &maxlen, &pos);
2206
2207                                                ostrcatbig(&buf, "<a target=_blank href=\"", &maxlen, &pos);
2208                                                ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2209                                                ostrcatbig(&buf, "/", &maxlen, &pos);
2210                                                ostrcatbig(&buf, node->text, &maxlen, &pos);
2211                                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2212
2213                                                ostrcatbig(&buf, "<img border=0 src=img/icon_restart.png width=16 height=16 alt=Download></a>", &maxlen, &pos);
2214                                        }
2215                                }
2216                                else
2217                                {
2218                                        ostrcatbig(&buf, node->text, &maxlen, &pos);
2219                                        ostrcatbig(&buf, "#1", &maxlen, &pos);
2220                                        ostrcatbig(&buf, "\n", &maxlen, &pos);
2221                                }
2222                        }
2223                        if(fmt == 0)
2224                        {
2225                                ostrcatbig(&buf, "</td>", &maxlen, &pos);
2226                                ostrcatbig(&buf, "</tr>", &maxlen, &pos);
2227                        }
2228                }
2229
2230                node = node->next;
2231        }
2232
2233        if(fmt == 0 && maxcount > MAXHTMLLINE)
2234        {
2235                int i;
2236                ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
2237                for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
2238                {
2239                        if(page == i)
2240                        {
2241                                ostrcatbig(&buf, "<a class=pagesellink href=query?", &maxlen, &pos);
2242                                ostrcatbig(&buf, link, &maxlen, &pos);
2243                                ostrcatbig(&buf, "&", &maxlen, &pos);
2244                        }
2245                        else
2246                        {
2247                                ostrcatbig(&buf, "<a class=pagelink href=query?", &maxlen, &pos);
2248                                ostrcatbig(&buf, link, &maxlen, &pos);
2249                                ostrcatbig(&buf, "&", &maxlen, &pos);
2250                        }
2251                        ostrcatbig(&buf, param, &maxlen, &pos);
2252                        ostrcatbig(&buf, "&", &maxlen, &pos);
2253
2254                        tmpnr = oitoa(i);
2255                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2256                        ostrcatbig(&buf, ">", &maxlen, &pos);
2257                        ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2258                        ostrcatbig(&buf, "</a>", &maxlen, &pos);
2259                        free(tmpnr); tmpnr = NULL;
2260                }
2261                ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
2262        }
2263
2264        if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
2265        delmarkedscreennodes(webdir, FILELISTDELMARK);
2266        return buf;
2267}
2268
2269char* webgetmovieepg(char* param, char* path, int flag, int fmt)
2270{
2271        char* buf = NULL, *tmpstr = NULL;
2272        char tstr[2];
2273        char c = 0;
2274        int first = 1, maxlen = 0, pos = 0;
2275        FILE* fd = NULL;
2276
2277        if(fmt == 0)
2278        {
2279                webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
2280                ostrcatbig(&buf, "<tr><td><font class=biglabel>", &maxlen, &pos);
2281        }
2282
2283        if(flag == 1)
2284        {
2285                if(param != NULL && ostrstr(param, path) == param)
2286                {
2287                        tmpstr = changefilenameext(param, ".epg");
2288                        fd = fopen(tmpstr, "r");
2289                }
2290        }
2291        else
2292        {
2293                tmpstr = changefilenameext(param, ".epg");
2294                fd = fopen(tmpstr, "r");
2295        }
2296
2297        if(fd != NULL)
2298        {
2299                while(c != EOF)
2300                {
2301                        c = fgetc(fd);
2302                        if(fmt == 0 && c == '\n')
2303                        {
2304                                if(first == 1)
2305                                {
2306                                        ostrcatbig(&buf, "</font><br><font class=label>", &maxlen, &pos);
2307                                        first = 0;
2308                                }
2309                                ostrcatbig(&buf, "<br>", &maxlen, &pos);
2310                                continue;
2311                        }
2312                        if(c != EOF)
2313                        {
2314                                sprintf(tstr, "%c", c);
2315                                ostrcatbig(&buf, tstr, &maxlen, &pos);
2316                        }
2317                }
2318                fclose(fd);
2319        }
2320
2321        if(fmt == 0)
2322        {
2323                ostrcatbig(&buf, "</font></td></tr>", &maxlen, &pos);
2324                webcreatetailbig(&buf, &maxlen, &pos, 0);
2325        }
2326
2327        free(tmpstr); tmpstr = NULL;
2328        return buf;
2329}
2330
2331char* webdelfile(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt)
2332{
2333        int del = 0;
2334        char* buf = NULL, *param1 = NULL, *param2 = NULL, *tmpparam = NULL;
2335
2336        if(param == NULL) return NULL;
2337
2338        //create param1 + 2
2339        param1 = strchr(param, '&');
2340        if(param1 != NULL)
2341        {
2342                *param1++ = '\0';
2343                param2 = strchr(param1, '&');
2344                if(param2 != NULL)
2345                        *param2++ = '\0';
2346        }
2347
2348        if(param1 == NULL || param2 == NULL) return NULL;
2349
2350        tmpparam = createpath(param, param2);
2351
2352        if(checkbit(flag, 0) == 1)
2353        {
2354                if(tmpparam != NULL && ostrstr(tmpparam, path) == tmpparam)
2355                        del = 1;
2356        }
2357        else
2358                del = 1;
2359
2360        if(del == 1)
2361        {
2362
2363                char* epgfilename = NULL;
2364
2365                unlink(tmpparam);
2366
2367                if(cmpfilenameext(tmpparam, ".ts") == 0)
2368                {
2369
2370                        epgfilename = changefilenameext(tmpparam, ".epg");
2371                        unlink(epgfilename);
2372                        free(epgfilename); epgfilename = NULL;
2373                        epgfilename = changefilenameext(tmpparam, ".se");
2374                        unlink(epgfilename);
2375                        free(epgfilename); epgfilename = NULL;
2376                        epgfilename = changefilenameext(tmpparam, ".ma");
2377                        unlink(epgfilename);
2378                        free(epgfilename); epgfilename = NULL;
2379                }
2380        }
2381
2382        free(tmpparam); tmpparam = NULL;
2383        tmpparam = ostrcat(tmpparam, param, 1, 0);
2384        tmpparam = ostrcat(tmpparam, "&", 1, 0);
2385        tmpparam = ostrcat(tmpparam, param1, 1, 0);
2386
2387        buf = webgetfilelist(tmpparam, link, dellink, path, mask, flag, fmt);
2388        free(tmpparam); tmpparam = NULL;
2389        return buf;
2390}
2391
2392char* websendrc(char* param, int fmt)
2393{
2394        int rccode = 0;
2395        char* buf = NULL;
2396
2397        rccode = getrcconfigint(param, NULL);
2398        writerc(rccode);
2399
2400        buf = ostrcat("ok", NULL, 0, 0);
2401        return buf;
2402}
2403
2404//flag 0: get aktiv timer
2405//flag 1: get old timer
2406char* webgetrectimer(char* param, int flag, int fmt)
2407{
2408        char* buf = NULL, *buf1 = NULL;
2409        struct rectimer* node = rectimer;
2410        struct channel* chnode = NULL;
2411        int line = 0, maxlen = 0, pos = 0;
2412        struct tm *loctime = NULL;
2413
2414        buf1 = malloc(MINMALLOC);
2415        if(buf1 == NULL)
2416        {
2417                err("no mem");
2418                return NULL;
2419        }
2420
2421        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);
2422
2423        while(node != NULL)
2424        {
2425                if((flag == 0 && (node->status == 2 || node->status == 3)) || (flag == 1 && (node->status == 0 || node->status == 1)) || node->status == 4 || node->status == 5)
2426                {
2427                        node = node->next;
2428                        continue;
2429                }
2430                if(fmt == 0)
2431                {
2432                        if(line == 0)
2433                        {
2434                                ostrcatbig(&buf, "<tr class=line1><td>", &maxlen, &pos);
2435                                line = 1;
2436                        }
2437                        else
2438                        {
2439                                ostrcatbig(&buf, "<tr class=line2><td>", &maxlen, &pos);
2440                                line = 0;
2441                        }
2442
2443                        loctime = olocaltime(&node->begin);
2444                        if(loctime != NULL)
2445                                strftime(buf1, MINMALLOC, "%d-%m-%Y %H:%M -", loctime);
2446                        free(loctime); loctime = NULL;
2447                        loctime = olocaltime(&node->end);
2448                        if(loctime != NULL)
2449                                strftime(&buf1[18], MINMALLOC - 19, " %H:%M ", loctime);
2450                        free(loctime); loctime = NULL;
2451
2452                        ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
2453                        ostrcatbig(&buf, buf1, &maxlen, &pos);
2454
2455                        ostrcatbig(&buf, " (", &maxlen, &pos);
2456                        if(node->justplay == 0)
2457                                ostrcatbig(&buf, "rec - ", &maxlen, &pos);
2458                        else
2459                                ostrcatbig(&buf, "switch - ", &maxlen, &pos);
2460                        if(node->repeate == 0)
2461                                ostrcatbig(&buf, "once", &maxlen, &pos);
2462                        else
2463                                ostrcatbig(&buf, "repeate", &maxlen, &pos);
2464
2465                        ostrcatbig(&buf, ")</font><br><font class=smalllabel1>", &maxlen, &pos);
2466                        if(node->name == NULL || strlen(node->name) == 0)
2467                                ostrcatbig(&buf, "---", &maxlen, &pos);
2468                        else
2469                                ostrcatbig(&buf, node->name, &maxlen, &pos);
2470
2471                        chnode = getchannel(node->serviceid, node->transponderid);
2472                        if(chnode != NULL)
2473                        {
2474                                ostrcatbig(&buf, " (", &maxlen, &pos);
2475                                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
2476                                ostrcatbig(&buf, ")", &maxlen, &pos);
2477                        }
2478                        ostrcatbig(&buf, "<br>", &maxlen, &pos);
2479
2480                        if(node->status == 0)
2481                                ostrcatbig(&buf, "waiting", &maxlen, &pos);
2482                        else if(node->status == 1)
2483                                ostrcatbig(&buf, "running", &maxlen, &pos);
2484                        else if(node->status == 2)
2485                                ostrcatbig(&buf, "succes", &maxlen, &pos);
2486                        else if(node->status == 3)
2487                        {
2488                                ostrcatbig(&buf, "error", &maxlen, &pos);
2489                                if(node->errstr != NULL && strlen(node->errstr) > 0)
2490                                {
2491                                        ostrcatbig(&buf, " (", &maxlen, &pos);
2492                                        ostrcatbig(&buf, node->errstr, &maxlen, &pos);
2493                                        ostrcatbig(&buf, ")", &maxlen, &pos);
2494                                }
2495                        }
2496
2497                        ostrcatbig(&buf, "</font>", &maxlen, &pos);
2498
2499                        if(flag == 0)
2500                        {
2501                                ostrcatbig(&buf, "</td><td width=40 align=right>", &maxlen, &pos);
2502
2503                                //edit png
2504                                ostrcatbig(&buf, "<a target=main href=\"query?editrectimer", &maxlen, &pos);
2505                                ostrcatbig(&buf, "&", &maxlen, &pos);
2506                                ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
2507                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2508
2509                                ostrcatbig(&buf, "<img border=0 src=img/edit.png width=16 height=16 alt=\"Edit Timer\"></a>", &maxlen, &pos);
2510
2511                                //delete png
2512                                ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
2513                                ostrcatbig(&buf, "query?delrectimer", &maxlen, &pos);
2514                                ostrcatbig(&buf, "&", &maxlen, &pos);
2515                                ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
2516                                //ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
2517                                //ostrcatbig(&buf, "&", &maxlen, &pos);
2518                                //tmpnr = oitoa(page);
2519                                //ostrcatbig(&buf, tmpnr, &maxlen, &pos);
2520                                //free(tmpnr); tmpnr = NULL;
2521                                //ostrcatbig(&buf, "&", &maxlen, &pos);
2522                                //ostrcatbig(&buf, node->text, &maxlen, &pos);
2523                                ostrcatbig(&buf, "\");'>", &maxlen, &pos);
2524                        }
2525
2526                        ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
2527                }
2528                else
2529                {
2530                        buf = ostrcat(buf, olutoa(node->begin), 1, 1);
2531                        buf = ostrcat(buf, "#", 1, 0);
2532                        buf = ostrcat(buf, olutoa(node->end), 1, 1);
2533                        buf = ostrcat(buf, "#", 1, 0);
2534                        buf = ostrcat(buf, oitoa(node->justplay), 1, 1);
2535                        buf = ostrcat(buf, "#", 1, 0);
2536                        buf = ostrcat(buf, oitoa(node->repeate), 1, 1);
2537                        buf = ostrcat(buf, "#", 1, 0);
2538                        buf = ostrcat(buf, node->name, 1, 0);
2539                        buf = ostrcat(buf, "#", 1, 0);
2540                        buf = ostrcat(buf, oitoa(node->serviceid), 1, 1);
2541                        buf = ostrcat(buf, "#", 1, 0);
2542                        buf = ostrcat(buf, ollutoa(node->transponderid), 1, 1);
2543                        buf = ostrcat(buf, "#", 1, 0);
2544                        buf = ostrcat(buf, oitoa(node->status), 1, 1);
2545                        buf = ostrcat(buf, "#", 1, 0);
2546                        buf = ostrcat(buf, node->errstr, 1, 0);
2547                        buf = ostrcat(buf, "#", 1, 0);
2548                        buf = ostrcat(buf, node->timestamp, 1, 0);
2549                        buf = ostrcat(buf, "#", 1, 0);
2550                        chnode = getchannel(node->serviceid, node->transponderid);
2551                        if(chnode != NULL)
2552                                buf = ostrcat(buf, chnode->name, 1, 0);
2553                        buf = ostrcat(buf, "#", 1, 0);
2554                        buf = ostrcat(buf, oitoa(node->afterevent), 1, 1);
2555                        buf = ostrcat(buf, "\n", 1, 0);
2556                }
2557
2558                node = node->next;
2559        }
2560
2561        if(fmt == 0)
2562                webcreatetailbig(&buf, &maxlen, &pos, 0);
2563        else if(buf == NULL)
2564                buf = ostrcat("no data", NULL, 0, 0);
2565
2566        free(buf1);
2567        return buf;
2568}
2569
2570char* webaddrectimer(char* param, int fmt)
2571{
2572        char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL;
2573        struct channel* chnode = NULL;
2574        struct epg* epgnode = NULL;
2575//      int maxlen = 0, pos = 0, tmpservicetype = 0;
2576        int maxlen = 0, pos = 0;
2577        struct tm* loctime = NULL;
2578        time_t akttime = time(NULL);
2579
2580        if(param != NULL)
2581        {
2582                //create param1 + 2
2583                param1 = strchr(param, '&');
2584                if(param1 != NULL)
2585                {
2586                        *param1++ = '\0';
2587                        param2 = strchr(param1, '&');
2588                        if(param2 != NULL)
2589                                *param2++ = '\0';
2590                }
2591                if(param1 == NULL || param2 == NULL) return NULL;
2592                chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
2593                if(chnode == NULL) return NULL;
2594
2595                epgnode = getepg(chnode, atoi(param2), 0);
2596                if(epgnode == NULL) return NULL;
2597        }
2598
2599
2600        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);
2601        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
2602        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
2603        if(chnode == NULL)
2604                ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimercheck&node\" value=\"", &maxlen, &pos);
2605        else
2606                ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
2607        ostrcatbig(&buf, "0", &maxlen, &pos);
2608        ostrcatbig(&buf, "\">", &maxlen, &pos);
2609        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
2610        ostrcatbig(&buf, "<td><font class=label>Name:&nbsp;</font></td>", &maxlen, &pos);
2611        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"name\" value=\"", &maxlen, &pos);
2612
2613        if(epgnode != NULL)
2614        {
2615                epgnode->title = strstrip(epgnode->title);
2616                delspezchar(epgnode->title, 2);
2617                ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
2618        }
2619        else
2620                ostrcatbig(&buf, " ", &maxlen, &pos);
2621        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2622        ostrcatbig(&buf, "<td><font class=label>Type:&nbsp;</font></td>", &maxlen, &pos);
2623        ostrcatbig(&buf, "<td><select name=\"type\" border=0><option selected>", &maxlen, &pos);
2624        if(status.pvr == 1)
2625        {
2626                ostrcatbig(&buf, "record", &maxlen, &pos);
2627                ostrcatbig(&buf, "<option>record<option>switch channel</select></td></tr>", &maxlen, &pos);
2628        }
2629        else
2630        {
2631                ostrcatbig(&buf, "switch channel", &maxlen, &pos);
2632                ostrcatbig(&buf, "<option>record</select></td></tr>", &maxlen, &pos);
2633        }
2634
2635        buf2 = malloc(MINMALLOC);
2636        if(epgnode != NULL)
2637                loctime =       olocaltime(&epgnode->starttime);
2638        else
2639                loctime = olocaltime(&akttime);
2640        if(loctime != NULL)
2641                strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime);
2642        free(loctime); loctime = NULL;
2643
2644        buf1 = ostrcat(buf2, NULL, 0, 0);
2645        ostrcatbig(&buf, "<td><font class=label>Begin:&nbsp;</font></td>", &maxlen, &pos);
2646        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"begin\" value=\"", &maxlen, &pos);
2647        ostrcatbig(&buf, buf1, &maxlen, &pos);
2648        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2649        free(buf1); buf1 = NULL;
2650
2651        if(epgnode != NULL)
2652                loctime =       olocaltime(&epgnode->endtime);
2653        else
2654                loctime = olocaltime(&akttime);
2655        if(loctime != NULL)
2656                strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime);
2657        free(loctime); loctime = NULL;
2658
2659        buf1 = ostrcat(buf2, NULL, 0, 0);
2660        ostrcatbig(&buf, "<td><font class=label>End:&nbsp;</font></td>", &maxlen, &pos);
2661        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"end\" value=\"", &maxlen, &pos);
2662        ostrcatbig(&buf, buf1, &maxlen, &pos);
2663        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2664        free(buf1); buf1 = NULL;
2665        free(buf2); buf2 = NULL;
2666
2667        ostrcatbig(&buf, "<td><font class=label>Channel:&nbsp;</font></td>", &maxlen, &pos);
2668        if(chnode == NULL)
2669                ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"channel\" value=\"", &maxlen, &pos);
2670        else
2671        {
2672                ostrcatbig(&buf, "<td>", &maxlen, &pos);
2673                ostrcatbig(&buf, "<input class=inputbox type=\"hidden\" name=\"sid\" value=\"", &maxlen, &pos);
2674                buf1 = oitoa(chnode->serviceid);
2675                ostrcatbig(&buf, buf1, &maxlen, &pos);
2676                free(buf1); buf1 = NULL;
2677                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2678                ostrcatbig(&buf, "<input class=inputbox type=\"hidden\" name=\"tid\" value=\"", &maxlen, &pos);
2679                buf1 = ollutoa(chnode->transponderid);
2680                ostrcatbig(&buf, buf1, &maxlen, &pos);
2681                free(buf1); buf1 = NULL;
2682                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2683                ostrcatbig(&buf, "<input readonly class=inputbox type=\"text\" name=\"channel\" value=\"", &maxlen, &pos);
2684        }
2685        if(chnode != NULL)
2686                ostrcatbig(&buf, chnode->name, &maxlen, &pos);
2687        else if(status.aktservice->channel != NULL)
2688                ostrcatbig(&buf, status.aktservice->channel->name, &maxlen, &pos);
2689        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
2690        free(buf1); buf1 = NULL;
2691
2692        ostrcatbig(&buf, "<td><font class=label>after event:&nbsp;</font></td>", &maxlen, &pos);
2693        ostrcatbig(&buf, "<td><select name=\"afterevent\" border=0><option selected>", &maxlen, &pos);
2694        ostrcatbig(&buf, "auto", &maxlen, &pos);
2695        ostrcatbig(&buf, "<option>auto<option>nothing<option>standby<option>off</select></td></tr>", &maxlen, &pos);
2696
2697        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);
2698
2699        //ostrcatbig(&buf, param, &maxlen, &pos);
2700        return buf;
2701}
2702
2703char* webrectimercheck(char* param, int fmt)
2704{
2705        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;
2706        int maxlen = 0, pos = 0, channelfind = 0;
2707        struct channel *channel1 = NULL;
2708
2709        anode = ostrstr(param, "node=");
2710        if(anode != NULL)
2711                anode = anode + 5;
2712        name = ostrstr(param, "name=");
2713        if(name != NULL)
2714                name = name + 5;
2715        begin = ostrstr(param, "begin=");
2716        if(begin != NULL)
2717                begin = begin + 6;
2718        end = ostrstr(param, "end=");
2719        if(end != NULL)
2720                end = end + 4;
2721        type = ostrstr(param, "type=");
2722        if(type != NULL)
2723                type = type + 5;
2724        channelname = ostrstr(param, "channel=");
2725        if(channelname != NULL)
2726                channelname = channelname + 8;
2727        ext = ostrstr(param, "ext=");
2728        if(ext != NULL)
2729                ext = ext + 4;
2730        afterevent = ostrstr(param, "afterevent=");
2731        if(afterevent != NULL)
2732                afterevent = afterevent + 11;
2733        repeat = ostrstr(param, "repeat=");
2734        if(repeat != NULL)
2735                repeat = repeat + 7;
2736
2737        param1 = ostrcat(param, NULL, 0, 0);
2738        string = param;
2739        while(string != NULL)
2740        {
2741                string = strchr(string, '&');
2742                if(string != NULL)
2743                        *string++ = '\0';
2744        }
2745
2746        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);
2747        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
2748        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
2749
2750        if(anode != NULL)
2751        {
2752                ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
2753                ostrcatbig(&buf, anode, &maxlen, &pos);
2754                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2755        }
2756
2757        if(name != NULL)
2758        {
2759                ostrcatbig(&buf, "<input type=\"hidden\" name=\"name\" value=\"", &maxlen, &pos);
2760                ostrcatbig(&buf, name, &maxlen, &pos);
2761                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2762        }
2763
2764        if(begin != NULL)
2765        {
2766                ostrcatbig(&buf, "<input type=\"hidden\" name=\"begin\" value=\"", &maxlen, &pos);
2767                ostrcatbig(&buf, begin, &maxlen, &pos);
2768                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2769        }
2770
2771        if(end != NULL)
2772        {
2773                ostrcatbig(&buf, "<input type=\"hidden\" name=\"end\" value=\"", &maxlen, &pos);
2774                ostrcatbig(&buf, end, &maxlen, &pos);
2775                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2776        }
2777
2778        if(type != NULL)
2779        {
2780                ostrcatbig(&buf, "<input type=\"hidden\" name=\"type\" value=\"", &maxlen, &pos);
2781                ostrcatbig(&buf, type, &maxlen, &pos);
2782                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2783        }
2784
2785        if(ext != NULL)
2786        {
2787                ostrcatbig(&buf, "<input type=\"hidden\" name=\"ext\" value=\"", &maxlen, &pos);
2788                ostrcatbig(&buf, ext, &maxlen, &pos);
2789                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2790        }
2791
2792        if(afterevent != NULL)
2793        {
2794                ostrcatbig(&buf, "<input type=\"hidden\" name=\"afterevent\" value=\"", &maxlen, &pos);
2795                ostrcatbig(&buf, afterevent, &maxlen, &pos);
2796                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2797        }
2798
2799        if(repeat != NULL)
2800        {
2801                ostrcatbig(&buf, "<input type=\"hidden\" name=\"repeat\" value=\"", &maxlen, &pos);
2802                ostrcatbig(&buf, repeat, &maxlen, &pos);
2803                ostrcatbig(&buf, "\" />", &maxlen, &pos);
2804        }
2805
2806        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
2807        ostrcatbig(&buf, "<td><select name=sid size=10 border=0>", &maxlen, &pos);
2808
2809        /*
2810        channel1 = channel;
2811        while(channel1 != NULL)
2812        {
2813                if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1))
2814                {
2815                        if(channelfind == 0)
2816                                ostrcatbig(&buf, "<option selected value=\"", &maxlen, &pos);
2817                        else
2818                                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
2819
2820                        buf1 = oitoa(channel1->serviceid);
2821                        ostrcatbig(&buf, buf1, &maxlen, &pos);
2822                        free(buf1); buf1 = NULL;
2823                        ostrcatbig(&buf, "&tid=", &maxlen, &pos);
2824                        buf1 = ollutoa(channel1->transponderid);
2825                        ostrcatbig(&buf, buf1, &maxlen, &pos);
2826                        free(buf1); buf1 = NULL;
2827                        ostrcatbig(&buf, "\">", &maxlen, &pos);
2828
2829                        ostrcatbig(&buf, channel1->name, &maxlen, &pos);
2830                        ostrcatbig(&buf, " (", &maxlen, &pos);
2831
2832                        //get satname from channel
2833                        if(channel1->transponder != NULL)
2834                        {
2835                                struct sat* snode = getsatbyorbitalpos(channel1->transponder->orbitalpos);
2836                                if(snode != NULL)
2837                                        ostrcatbig(&buf, snode->name, &maxlen, &pos);
2838                                else
2839                                        ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
2840
2841                                if(channel1->provider != NULL)
2842                                        ostrcatbig(&buf, " - ", &maxlen, &pos);
2843                        }
2844
2845                        //get provider from channel
2846                        if(channel1->provider != NULL)
2847                        {
2848                                if(channel1->provider->name != NULL)
2849                                        ostrcatbig(&buf, channel1->provider->name, &maxlen, &pos);
2850                                else
2851                                        ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
2852                        }
2853
2854                        ostrcatbig(&buf, ")", &maxlen, &pos);
2855
2856                        channelfind++;
2857                }
2858                channel1 = channel1->next;
2859        }
2860        */
2861
2862        if(channelfind == 0)
2863        {
2864                channel1 = channel;
2865                while(channel1 != NULL)
2866                {
2867                        if(ostrstrcase(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1))
2868                        {
2869                                if(channelfind == 0)
2870                                        ostrcatbig(&buf, "<option selected value=\"", &maxlen, &pos);
2871                                else
2872                                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
2873
2874                                buf1 = oitoa(channel1->serviceid);
2875                                ostrcatbig(&buf, buf1, &maxlen, &pos);
2876                                free(buf1); buf1 = NULL;
2877                                ostrcatbig(&buf, "&tid=", &maxlen, &pos);
2878                                buf1 = ollutoa(channel1->transponderid);
2879                                ostrcatbig(&buf, buf1, &maxlen, &pos);
2880                                free(buf1); buf1 = NULL;
2881                                ostrcatbig(&buf, "\">", &maxlen, &pos);
2882
2883                                ostrcatbig(&buf, channel1->name, &maxlen, &pos);
2884                                ostrcatbig(&buf, " (", &maxlen, &pos);
2885
2886                                //get satname from channel
2887                                if(channel1->transponder != NULL)
2888                                {
2889                                        struct sat* snode = getsatbyorbitalpos(channel1->transponder->orbitalpos);
2890                                        if(snode != NULL)
2891                                                ostrcatbig(&buf, snode->name, &maxlen, &pos);
2892                                        else
2893                                                ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
2894
2895                                        if(channel1->provider != NULL)
2896                                                ostrcatbig(&buf, " - ", &maxlen, &pos);
2897                                }
2898
2899                                //get provider from channel
2900                                if(channel1->provider != NULL)
2901                                {
2902                                        if(channel1->provider->name != NULL)
2903                                                ostrcatbig(&buf, channel1->provider->name, &maxlen, &pos);
2904                                        else
2905                                                ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
2906                                }
2907
2908                                ostrcatbig(&buf, ")", &maxlen, &pos);
2909
2910                                channelfind++;
2911                        }
2912                        channel1 = channel1->next;
2913                }
2914        }
2915
2916        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);
2917
2918        if(channelfind < 2)
2919        {
2920                free(buf); buf = NULL;
2921                buf = webrectimersend(param1, fmt);
2922                free(param1); param1 = NULL;
2923        }
2924
2925        return buf;
2926}
2927
2928char* webrectimersend(char* param, int fmt)
2929{
2930        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;
2931        int newnode = 0, channelfind = 0;
2932        struct rectimer *node = NULL;
2933        char* tmpstr = NULL;
2934        struct tm* loctime = NULL;
2935        struct channel *channel1 = NULL;
2936
2937        anode = ostrstr(param, "node=");
2938        if(anode != NULL)
2939                anode = anode + 5;
2940        name = ostrstr(param, "name=");
2941        if(name != NULL)
2942                name = name + 5;
2943        begin = ostrstr(param, "begin=");
2944        if(begin != NULL)
2945                begin = begin + 6;
2946        end = ostrstr(param, "end=");
2947        if(end != NULL)
2948                end = end + 4;
2949        type = ostrstr(param, "type=");
2950        if(type != NULL)
2951                type = type + 5;
2952        channelname = ostrstr(param, "channel=");
2953        if(channelname != NULL)
2954                channelname = channelname + 8;
2955        sid = ostrstr(param, "sid=");
2956        if(sid != NULL)
2957                sid = sid + 4;
2958        tid = ostrstr(param, "tid=");
2959        if(tid != NULL)
2960                tid = tid + 4;
2961        ext = ostrstr(param, "ext=");
2962        if(ext != NULL)
2963                ext = ext + 4;
2964        afterevent = ostrstr(param, "afterevent=");
2965        if(afterevent != NULL)
2966                afterevent = afterevent + 11;
2967        repeat = ostrstr(param, "repeat=");
2968        if(repeat != NULL)
2969                repeat = repeat + 7;
2970
2971        string = param;
2972        while(string != NULL)
2973        {
2974                string = strchr(string, '&');
2975                if(string != NULL)
2976                        *string++ = '\0';
2977        }
2978
2979        if((sid == NULL && tid != NULL) || (sid != NULL && tid == NULL))
2980        {
2981                buf = ostrcat(buf, "ERROR: sid and tid required or only channel", 1, 0);
2982                return buf;
2983        }
2984
2985        if(channelname != NULL && sid == NULL)
2986        {
2987                channelfind = 0;
2988                channel1 = channel;
2989                while(channel1 != NULL)
2990                {
2991                        if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1))
2992                        {
2993                                        channelfind = 1;
2994                                        break;
2995                        }
2996                        channel1 = channel1->next;
2997                }
2998                if(channelfind == 0)
2999                {
3000                        channel1 = channel;
3001                        while(channel1 != NULL)
3002                        {
3003                                if(ostrstr(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1))
3004                                {
3005                                                channelfind = 1;
3006                                                break;
3007                                }
3008                                channel1 = channel1->next;
3009                        }
3010                }
3011                if(channelfind == 0)
3012                {
3013                        buf = ostrcat(buf, "ERROR: channel not found", 1, 0);
3014                        return buf;
3015                }
3016        }
3017
3018        newnode = 0;
3019        node = getrectimerbytimestamp(anode);
3020        if(node == NULL)
3021        {
3022                node = addrectimernode(NULL, NULL);
3023                if(node != NULL)
3024                {
3025                        newnode = 1;
3026                        node->pincode = ostrcat("0000", NULL, 0, 0);
3027                        node->recpath = ostrcat(NULL, getconfig("rec_path", NULL), 0, 0);
3028                        node->afterevent = 0;
3029                        node->repeate = 0;
3030                }
3031        }
3032
3033        if(node != NULL)
3034        {
3035                if(channelfind == 1 && channel1 != NULL)
3036                {
3037                        node->serviceid = channel1->serviceid;
3038                        node->servicetype = channel1->servicetype;
3039                        node->transponderid = channel1->transponderid;
3040                }
3041
3042                if(sid != NULL && tid != NULL)
3043                {
3044                        node->serviceid = atoi(sid);
3045                        node->transponderid = strtoull(tid, NULL, 10);
3046                        node->servicetype = 0;
3047                }
3048
3049                free(node->name); node->name = NULL;
3050                node->name = ostrcat(name, NULL, 0, 0);
3051
3052                if(ostrcmp(type, "record") == 0)
3053                        node->justplay = 0;
3054                else
3055                        node->justplay = 1;
3056
3057                if(afterevent != NULL)
3058                {
3059                        if(ostrcmp(afterevent, "auto") == 0)
3060                                node->afterevent = 0;
3061                        else if(ostrcmp(afterevent, "nothing") == 0)
3062                                node->afterevent = 1;
3063                        else if(ostrcmp(afterevent, "standby") == 0)
3064                                node->afterevent = 2;
3065                        else if(ostrcmp(afterevent, "off") == 0)
3066                                node->afterevent = 3;
3067                }
3068
3069                if(repeat != NULL)
3070                        node->repeate = atoi(repeat);
3071
3072                loctime = olocaltime(&node->begin);
3073                if(loctime != NULL && begin != NULL)
3074                {
3075                        tmpstr = strptime(begin, "%H:%M %d-%m-%Y", loctime);
3076                        if(tmpstr != NULL) {
3077                                loctime->tm_isdst = -1;
3078                                node->begin = mktime(loctime);
3079                        }
3080                }
3081                if(node->justplay == 0 && newnode == 1) node->begin -= getconfigint("recforerun" , NULL) * 60;
3082                node->begin -= (node->begin % 60);
3083                tmpstr = NULL;
3084                free(loctime); loctime = NULL;
3085
3086                loctime = olocaltime(&node->end);
3087                if(loctime != NULL && end != NULL)
3088                {
3089                        tmpstr = strptime(end, "%H:%M %d-%m-%Y", loctime);
3090                        if(tmpstr != NULL) {
3091                                loctime->tm_isdst = -1;
3092                                node->end = mktime(loctime);
3093                        }
3094                }
3095                if(node->justplay == 0 && newnode == 1) node->end += getconfigint("recoverrun" , NULL) * 60;
3096                node->end -= (node->end % 60);
3097                tmpstr = NULL;
3098                free(loctime); loctime = NULL;
3099
3100                if(newnode == 1)
3101                        node->disabled = 0;
3102
3103                status.writerectimer = 1;
3104                writerectimer(getconfig("rectimerfile", NULL), 0);
3105
3106                if(ext == NULL)
3107                        buf = webgetrectimer(NULL, 0, fmt);
3108                else
3109                {
3110                        buf = ostrcat(buf, "ok -> TimerID=", 1, 0);
3111                        buf = ostrcat(buf, node->timestamp, 1, 0);
3112                }
3113        }
3114        else
3115                buf = ostrcat(buf, "Timer not ok", 1, 0);
3116
3117        return buf;
3118}
3119
3120char* webeditrectimer(char* param, int fmt)
3121{
3122        char* buf = NULL, *buf1 = NULL, *buf2 = NULL;
3123        int maxlen = 0, pos = 0;
3124        struct rectimer *node = NULL;
3125        struct tm* loctime = NULL;
3126
3127        node = getrectimerbytimestamp(param);
3128        if(node == NULL) return NULL;
3129
3130        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);
3131        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
3132        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
3133        ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
3134        ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
3135        ostrcatbig(&buf, "\">", &maxlen, &pos);
3136        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
3137        ostrcatbig(&buf, "<td><font class=label>Name:&nbsp;</font></td>", &maxlen, &pos);
3138        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"name\" value=\"", &maxlen, &pos);
3139        ostrcatbig(&buf, node->name, &maxlen, &pos);
3140        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
3141
3142        ostrcatbig(&buf, "<td><font class=label>Type:&nbsp;</font></td>", &maxlen, &pos);
3143        ostrcatbig(&buf, "<td><select name=\"type\" border=0><option selected>", &maxlen, &pos);
3144        if(node->justplay == 0 && status.pvr == 1)
3145        {
3146                ostrcatbig(&buf, "record", &maxlen, &pos);
3147                ostrcatbig(&buf, "<option>record<option>switch channel</select></td></tr>", &maxlen, &pos);
3148        }
3149        else
3150        {
3151                ostrcatbig(&buf, "switch channel", &maxlen, &pos);
3152                ostrcatbig(&buf, "<option>switch channel</select></td></tr>", &maxlen, &pos);
3153        }
3154
3155        /*ostrcatbig(&buf, "<td><font class=label>Repeate:&nbsp;</font></td>", &maxlen, &pos);
3156        ostrcatbig(&buf, "<td><select name=\"repeate\" border=0><option selected>", &maxlen, &pos);
3157        if( node->repeate == 0 )
3158                ostrcatbig(&buf, "once", &maxlen, &pos);
3159        else
3160                ostrcatbig(&buf, "repeate", &maxlen, &pos);
3161        ostrcatbig(&buf, "<option>once<option>repeate</select></td></tr>", &maxlen, &pos);
3162        */
3163
3164        /*ostrcatbig(&buf, "<td><font class=label>Repeate type:&nbsp;</font></td>", &maxlen, &pos);
3165        ostrcatbig(&buf, "<td><select name=\"repeatetype\" border=0><option selected>", &maxlen, &pos);
3166        if( node->repeate == 0 )
3167                ostrcatbig(&buf, "daily", &maxlen, &pos);
3168        else if( node->repeate == 1 )
3169                ostrcatbig(&buf, "weekly", &maxlen, &pos);
3170        else if( node->repeate == 2 )
3171                ostrcatbig(&buf, "workdays", &maxlen, &pos);
3172        else
3173                ostrcatbig(&buf, "user defined", &maxlen, &pos);
3174        ostrcatbig(&buf, "<option>daily<option>weekly<option>workdays<option>user defined</select></td></tr>", &maxlen, &pos);
3175        */
3176
3177        buf2 = malloc(20);
3178        loctime = olocaltime(&node->begin);
3179        if(loctime != NULL && buf2 != NULL)
3180                strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime);
3181        free(loctime); loctime = NULL;
3182
3183        buf1 = ostrcat(buf2, NULL, 0, 0);
3184        ostrcatbig(&buf, "<td><font class=label>Begin:&nbsp;</font></td>", &maxlen, &pos);
3185        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"begin\" value=\"", &maxlen, &pos);
3186        ostrcatbig(&buf, buf1, &maxlen, &pos);
3187        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
3188        free(buf1); buf1 = NULL;
3189
3190        loctime = olocaltime(&node->end);
3191        if(loctime != NULL && buf2 != NULL)
3192                strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime);
3193        free(loctime); loctime = NULL;
3194
3195        buf1 = ostrcat(buf2, NULL, 0, 0);
3196        ostrcatbig(&buf, "<td><font class=label>End:&nbsp;</font></td>", &maxlen, &pos);
3197        ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"end\" value=\"", &maxlen, &pos);
3198        ostrcatbig(&buf, buf1, &maxlen, &pos);
3199        ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
3200        free(buf1); buf1 = NULL;
3201        free(buf2); buf2 = NULL;
3202
3203        ostrcatbig(&buf, "<td><font class=label>after event:&nbsp;</font></td>", &maxlen, &pos);
3204        ostrcatbig(&buf, "<td><select name=\"afterevent\" border=0><option selected>", &maxlen, &pos);
3205        if( node->afterevent == 0 )
3206                ostrcatbig(&buf, "auto", &maxlen, &pos);
3207        else if( node->afterevent == 1 )
3208                ostrcatbig(&buf, "nothing", &maxlen, &pos);
3209        else if( node->afterevent == 2 )
3210                ostrcatbig(&buf, "standby", &maxlen, &pos);
3211        else if( node->afterevent == 3 )
3212                ostrcatbig(&buf, "off", &maxlen, &pos);
3213        else
3214                ostrcatbig(&buf, "auto", &maxlen, &pos);
3215        ostrcatbig(&buf, "<option>auto<option>nothing<option>standby<option>off</select></td></tr>", &maxlen, &pos);
3216
3217        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);
3218
3219        //ostrcatbig(&buf, param, &maxlen, &pos);
3220        return buf;
3221}
3222
3223char* webdelrectimer(char* param, int fmt)
3224{
3225        char* buf = NULL, *string = NULL, *timerid = NULL;
3226        struct rectimer *node = NULL;
3227        int ext = 0;
3228
3229        timerid = ostrstr(param, "timerid=");
3230        if(timerid != NULL)
3231        {
3232                timerid = timerid + 8;
3233                ext = 1;
3234        }
3235
3236        node = NULL;
3237        if(ext == 1)
3238        {
3239                string = param;
3240                while(string != NULL)
3241                {
3242                        string = strchr(string, '&');
3243                        if(string != NULL)
3244                                *string++ = '\0';
3245                }
3246                node = getrectimerbytimestamp(timerid);
3247        }
3248        else
3249                node = getrectimerbytimestamp(param);
3250
3251        if(node == NULL)
3252        {
3253                buf = ostrcat(buf, "ERROR: timer not found", 1, 0);
3254                return buf;
3255        }
3256
3257        delrectimer(node, 1, 0);
3258
3259        if(ext == 1)
3260                buf = ostrcat(buf, "ok -> timer deleted", 1, 0);
3261        else
3262                buf = webgetrectimer(NULL, 0, fmt);
3263
3264        return buf;
3265}
3266
3267void putxmessage(struct stimerthread* timernode, char* captiontime, char* body)
3268{
3269        struct splitstr* ret1 = NULL;
3270        char* caption = NULL;
3271        int count1 = 0;
3272        int timeout = 5;
3273
3274        ret1 = strsplit(captiontime, "\t", &count1);
3275
3276        if(count1 >= 2)
3277        {
3278                caption = ostrcat(caption, (&ret1[0])->part, 1, 0);
3279                if((&ret1[1])->part != NULL)
3280                        timeout = atoi((&ret1[1])->part);
3281                if(status.standby == 0)
3282                        textbox(caption, body, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 280, timeout, 0);
3283                else
3284                {
3285                        FILE* datei = fopen("/tmp/textbox_standby", "a");
3286
3287                        body = string_replace_all("\n", "\t", body, 1);
3288                        fprintf(datei, "%s\n%s\n%s\n%i\n%s\n%i\n%i\n%i\n%i\n%i\n%i\n%i\n%i\n%i\n", caption, body, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), 0, 0, 0, 0, 600, 280, timeout, 0);
3289                        fclose(datei);
3290                }
3291        }
3292
3293        free(caption); free(body); free(captiontime); free(ret1);
3294}
3295
3296void xmessage(char* filename)
3297{
3298        char* param=NULL, *param1 = NULL, *param2 = NULL, *param3 = NULL, *param4 = NULL;
3299        char* caption=NULL, *body=NULL;
3300        char* timeout=NULL;
3301
3302        param4 = ostrstr(filename, "icon=");
3303        param3 = ostrstr(filename, "charset=");
3304        param2 = ostrstr(filename, "timeout=");
3305        param1 = ostrstr(filename, "caption=");
3306        param = ostrstr(filename, "body=");
3307
3308        if(param4 != NULL)
3309        {
3310                param4 = param4 - 1;
3311                *param4 = '\0';
3312                param4 = param4 + 5;
3313                *param4++ = '\0';
3314        }
3315        if(param3 != NULL)
3316        {
3317                param3 = param3 - 1;
3318                *param3 = '\0';
3319                param3 = param3 + 8;
3320                *param3++ = '\0';
3321        }
3322        if(param2 != NULL)
3323        {
3324                param2 = param2 - 1;
3325                *param2 = '\0';
3326                param2 = param2 + 8;
3327                *param2++ = '\0';
3328        }
3329        if(param1 != NULL)
3330        {
3331                param1 = param1 - 1;
3332                *param1 = '\0';
3333                param1 = param1 + 8;
3334                *param1++ = '\0';
3335        }
3336        if(param != NULL)
3337        {
3338                param = param - 1;
3339                *param = '\0';
3340                param = param + 5;
3341                *param++ = '\0';
3342                body = ostrcat(body, param, 1, 0);
3343        }
3344        else
3345                body = ostrcat(body, " ", 1, 0);
3346
3347        if(param2 != NULL)
3348                timeout = ostrcat(timeout, param2, 1, 0);
3349        else
3350                timeout = ostrcat(timeout, "5", 1, 0);
3351
3352        if(param1 != NULL)
3353                caption = ostrcat(caption, param1, 1, 0);
3354        else
3355                caption = ostrcat(caption, "XMESSAGE", 1, 0);
3356
3357        caption = ostrcat(caption, "\t", 1, 0);
3358        caption = ostrcat(caption, timeout, 1, 1);
3359
3360        addtimer(&putxmessage, START, 1000, 1, (void*)caption, (void*)body, NULL);
3361        return;
3362}
3363
3364char* webgetvol(int fmt)
3365{
3366        char* buf = NULL;
3367
3368        buf = oitoa(getvol());
3369        return buf;
3370}
3371
3372char* webgetrecsteampath(int fmt)
3373{
3374        char* buf = NULL;
3375
3376        if(getconfig("rec_streampath", NULL) == NULL)
3377                buf = ostrcat(buf, "/var/media/hdd/movie", 1, 0);
3378        else
3379                buf = ostrcat(buf, getconfig("rec_streampath", NULL), 1, 0);
3380
3381        return buf;
3382}
3383
3384char* webgetmute(int fmt)
3385{
3386        char* buf = NULL;
3387
3388        buf = oitoa(status.mute);
3389        return buf;
3390}
3391
3392char* webgetrccodes(int fmt)
3393{
3394        int i = 0;
3395        char* buf = NULL;
3396        struct clist* node = NULL;
3397
3398        m_lock(&status.clistmutex, 12);
3399        struct clist **clist = rcconfig;
3400
3401        for(i = 0; i < LISTHASHSIZE; i++)
3402        {
3403                node = clist[i];
3404
3405                while(node != NULL)
3406                {
3407                        buf = ostrcat(buf, node->key, 1, 0);
3408                        buf = ostrcat(buf, "#", 1, 0);
3409                        buf = ostrcat(buf, node->value, 1, 0);
3410                        buf = ostrcat(buf, "\n", 1, 0);
3411                        node = node->next;
3412                }
3413        }
3414
3415        m_unlock(&status.clistmutex, 12);
3416        return buf;
3417}
3418
3419char* webgetconfig(int fmt)
3420{
3421        char* buf = NULL;
3422        struct clist *node = NULL;
3423        int i = 0;
3424
3425        m_lock(&status.clistmutex, 12);
3426        if(fmt == 0)
3427        {
3428                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
3429                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
3430                buf = ostrcat(buf, "</head><body class=body id=\"configinfo\">", 1, 0);
3431        }
3432
3433        struct clist **clist = config;
3434
3435        for(i = 0; i < LISTHASHSIZE; i++)
3436        {
3437                node = clist[i];
3438
3439                while(node != NULL)
3440                {
3441                        if(node->tmp != NULL && strlen(node->tmp) > 0)
3442                        {
3443                                buf = ostrcat(buf, node->key, 1, 0);
3444                                buf = ostrcat(buf, "#", 1, 0);
3445                                buf = ostrcat(buf, node->tmp, 1, 0);
3446                                buf = ostrcat(buf, "\n", 1, 0);
3447                        }
3448                        else if(node->value != NULL)
3449                        {
3450                                buf = ostrcat(buf, node->key, 1, 0);
3451                                buf = ostrcat(buf, "#", 1, 0);
3452                                buf = ostrcat(buf, node->value, 1, 0);
3453                                buf = ostrcat(buf, "\n", 1, 0);
3454                        }
3455                        else
3456                        {
3457                                buf = ostrcat(buf, node->key, 1, 0);
3458                                buf = ostrcat(buf, "#", 1, 0);
3459                                buf = ostrcat(buf, node->def, 1, 0);
3460                                buf = ostrcat(buf, "\n", 1, 0);
3461                        }
3462
3463                        node = node->next;
3464                }
3465        }
3466
3467        buf = string_replace_all("\n", "<br>\n", buf, 1);
3468
3469        if(fmt == 0)
3470        {
3471                buf = ostrcat(buf, "</body></html>", 1, 0);
3472        }
3473
3474        m_unlock(&status.clistmutex, 12);
3475        return buf;
3476}
3477
3478char* webgetrecfreesize(int fmt)
3479{
3480        char* buf = NULL;
3481        unsigned long long full = getfullspace(getconfig("rec_path", NULL));
3482        unsigned long long free = getfreespace(getconfig("rec_path", NULL));
3483        int proz = 0;
3484
3485        if(full > 0 && full >= free) proz = ((full - free) * 100) / full;
3486        if(proz < 0) proz = 0;
3487        if(proz > 100) proz = 100;
3488
3489        buf = ostrcat(buf, getconfig("rec_path", NULL), 1, 0);
3490        buf = ostrcat(buf, "#", 1, 0);
3491        buf = ostrcat(buf, ollutoa(full), 1, 1);
3492        buf = ostrcat(buf, "#", 1, 0);
3493        buf = ostrcat(buf, ollutoa(free), 1, 1);
3494        buf = ostrcat(buf, "#", 1, 0);
3495        buf = ostrcat(buf, oitoa(proz), 1, 1);
3496        buf = ostrcat(buf, " %", 1, 0);
3497        buf = ostrcat(buf, "#", 1, 0);
3498
3499        return buf;
3500}
3501
3502char* webgetsysteminfo(int fmt)
3503{
3504        char* buf = NULL;
3505        char* imgversion = NULL;
3506
3507        if(fmt == 0)
3508        {
3509                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
3510                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
3511                buf = ostrcat(buf, "</head><body class=body id=\"systeminfo\">", 1, 0);
3512        }
3513
3514        buf = ostrcat(buf, PROGNAME, 1, 0);
3515        buf = ostrcat(buf, "#", 1, 0);
3516        buf = ostrcat(buf, COPYRIGHT, 1, 0);
3517        buf = ostrcat(buf, "#", 1, 0);
3518        buf = ostrcat(buf, OVERSION, 1, 0);
3519        buf = ostrcat(buf, "#", 1, 0);
3520
3521        if(isfile(getconfig("imagenamefile", NULL))     != 0)
3522                imgversion = readsys(getconfig("imagenamefile", NULL), 1);
3523        else
3524                imgversion = ostrcat("unknown", NULL, 0, 0);
3525
3526        buf = ostrcat(buf, imgversion, 1, 1);
3527        buf = ostrcat(buf, "#", 1, 0);
3528        buf = ostrcat(buf, getboxtype(), 1, 0);
3529        buf = ostrcat(buf, "#", 1, 0);
3530        buf = ostrcat(buf, ollutoa(time(NULL)), 1, 1);
3531        buf = ostrcat(buf, "#", 1, 0);
3532
3533        if(status.standby == 0)
3534                buf = ostrcat(buf, "0", 1, 0);
3535        else
3536                buf = ostrcat(buf, "1", 1, 0);
3537
3538  //transcode
3539  buf = ostrcat(buf, "#", 1, 0);
3540#ifdef MIPSEL
3541        if(file_exist("/proc/stb/encoder") && getconfigint("web_trans_transcode", NULL) == 1)
3542                buf = ostrcat(buf, "1", 1, 0);
3543        else
3544                buf = ostrcat(buf, "0", 1, 0);
3545#else
3546        buf = ostrcat(buf, "0", 1, 0);
3547#endif
3548
3549        if(fmt == 0)
3550        {
3551                buf = ostrcat(buf, "</body></html>", 1, 0);
3552        }
3553
3554        return buf;
3555}
3556
3557char* webgetchannellock(char* param, int fmt)
3558{
3559        char* buf = NULL, *param1 = NULL;
3560        struct channel* chnode = NULL;
3561
3562        if(param == NULL) return NULL;
3563
3564        //create param1
3565        param1 = strchr(param, '&');
3566        if(param1 != NULL)
3567                *param1++ = '\0';
3568
3569        if(param1 == NULL) return NULL;
3570
3571        chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
3572        if(chnode != NULL)
3573        {
3574                buf = ostrcat(buf, chnode->name, 1, 0);
3575                buf = ostrcat(buf, "#", 1, 0);
3576                buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
3577                buf = ostrcat(buf, "#", 1, 0);
3578                buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
3579                buf = ostrcat(buf, "#", 1, 0);
3580
3581                if(channelnottunable(chnode) == 1)
3582                        buf = ostrcat(buf, "1", 1, 0);
3583                else
3584                        buf = ostrcat(buf, "0", 1, 0);
3585        }
3586        else
3587                buf = ostrcat("no data", NULL, 0, 0);
3588
3589        return buf;
3590}
3591
3592char* webgetbouquetepg(char* param, int fmt)
3593{
3594        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
3595        char* param1 = NULL, *param2 = NULL, *param3 = NULL;
3596        struct mainbouquet *mbouquet = NULL;
3597        struct bouquet *node = NULL;
3598        struct channel* chnode = NULL;
3599        struct epg* epgnode = NULL;
3600        int longepg = 0;
3601        time_t start = 0, end = 0;
3602
3603        if(param == NULL) return NULL;
3604
3605        //create param1 + 2 + 3
3606        param1 = strchr(param, '&');
3607        if(param1 != NULL)
3608        {
3609                *param1++ = '\0';
3610                param2 = strchr(param1, '&');
3611                if(param2 != NULL)
3612                {
3613                        *param2++ = '\0';
3614                        param3 = strchr(param2, '&');
3615                        if(param3 != NULL)
3616                                *param3++ = '\0';
3617                }
3618        }
3619        if(param1 == NULL || param2 == NULL || param3 == NULL) return NULL;
3620
3621        longepg = atoi(param1);
3622        start = atoi(param2);
3623        end = atoi(param3);
3624
3625        mbouquet = getmainbouquet(param);
3626        if(mbouquet != NULL)
3627        {
3628                node = mbouquet->bouquet;
3629                tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
3630                tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
3631                tmpstr1 = htmlencode(tmpstr);
3632                free(tmpstr); tmpstr = NULL;
3633                while(node != NULL)
3634                {
3635                        chnode = getchannel(node->serviceid, node->transponderid);
3636                        if(chnode != NULL)
3637                        {
3638                                buf = ostrcat(buf, "BeginNewChannel", 1, 0);
3639                                buf = ostrcat(buf, "#", 1, 0);
3640                                buf = ostrcat(buf, chnode->name, 1, 0);
3641                                buf = ostrcat(buf, "#", 1, 0);
3642                                buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
3643                                buf = ostrcat(buf, "#", 1, 0);
3644                                buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
3645                                buf = ostrcat(buf, "#", 1, 0);
3646                                buf = ostrcat(buf, oitoa(chnode->servicetype), 1, 1);
3647                                buf = ostrcat(buf, "\n", 1, 0);
3648
3649                                epgnode = chnode->epg;
3650                                while(epgnode != NULL)
3651                                {
3652                                        if((epgnode->starttime >= start && epgnode->starttime < end) || (epgnode->endtime > start && epgnode->endtime <= end) || (epgnode->starttime < start && epgnode->endtime > end))
3653                                        {
3654                                                buf = ostrcat(buf, epgnode->title, 1, 0);
3655                                                buf = ostrcat(buf, "#", 1, 0);
3656                                                buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
3657                                                buf = ostrcat(buf, "#", 1, 0);
3658                                                buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
3659                                                buf = ostrcat(buf, "#", 1, 0);
3660                                                buf = ostrcat(buf, epgnode->subtitle, 1, 0);
3661                                                buf = ostrcat(buf, "#", 1, 0);
3662
3663                                                if(longepg == 1)
3664                                                {
3665                                                        tmpstr = epgdescunzip(epgnode);
3666                                                        if(tmpstr != NULL)
3667                                                                buf = ostrcat(buf, tmpstr, 1, 0);
3668                                                        free(tmpstr); tmpstr = NULL;
3669                                                }
3670
3671                                                buf = ostrcat(buf, "#", 1, 0);
3672                                                buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1);
3673                                                buf = ostrcat(buf, "\n", 1, 0);
3674                                        }
3675
3676                                        epgnode = epgnode->next;
3677                                }
3678                        }
3679                        node = node->next;
3680                }
3681                free(tmpstr1); tmpstr1 = NULL;
3682        }
3683
3684        if(buf == NULL)
3685                buf = ostrcat("no data", NULL, 0, 0);
3686        return buf;
3687}
3688
3689char* webadjust(char* param, int fmt)
3690{
3691printf("webadjust param: %s\n",param);
3692printf("webadjust fmt: %d\n",fmt);
3693
3694        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *sendstr = NULL;
3695        int i = 0, max = 0, count = 0, maxlen = 0, pos = 0;
3696        struct splitstr* ret1 = NULL;
3697
3698
3699        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);
3700        ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
3701        ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
3702        ostrcatbig(&buf, "<input type=\"hidden\" name=\"adjustsend&node\" value=\"", &maxlen, &pos);
3703        ostrcatbig(&buf, "0", &maxlen, &pos);
3704        ostrcatbig(&buf, "\">", &maxlen, &pos);
3705//      ostrcatbig(&buf, "<input type=\"hidden\" name=\"adjustsend\">", &maxlen, &pos);
3706        ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
3707
3708        ostrcatbig(&buf, "<table>", &maxlen, &pos);
3709
3710///////////////////
3711//      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);
3712        max = 10;
3713        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3714        ostrcatbig(&buf, _("Volumebar Timeout"), &maxlen, &pos);
3715        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"volbartimeout\" border=\"0\">", &maxlen, &pos);
3716        for(i = 1; i <= max; i++)
3717        {
3718                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3719                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3720                if(getconfigint("volbartimeout", NULL) == i)
3721                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
3722                else
3723                        ostrcatbig(&buf, "\">", &maxlen, &pos);
3724                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3725                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3726        }
3727        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3728        sendstr = ostrcat(sendstr, "volbartimeout.value", 1 , 0);
3729
3730///////////////////
3731//      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);
3732        tmpstr = ostrcat("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n20\n30\n60\n10000", NULL, 0, 0);
3733
3734        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3735        ostrcatbig(&buf, _("Infobar Timeout"), &maxlen, &pos);
3736        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"infobartimeout\" border=\"0\">", &maxlen, &pos);
3737
3738        count = 0;
3739        ret1 = strsplit(tmpstr, "\n", &count);
3740        max = count - 1;
3741
3742        if(ret1 != NULL)
3743        {
3744                for(i = 0; i <= max; i++)
3745                {
3746                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3747                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3748                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3749                        if(getconfigint("infobartimeout", NULL) == atoi(tmpstr1))
3750                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
3751                        else
3752                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3753                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3754                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3755                }
3756        }
3757        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3758        sendstr = ostrcat(sendstr, ", infobartimeout.value", 1 , 0);
3759        free(ret1), ret1 = NULL;
3760        free(tmpstr), tmpstr = NULL;
3761        free(tmpstr1), tmpstr1 = NULL;
3762
3763///////////////////
3764//      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);
3765        max = 5;
3766        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3767        ostrcatbig(&buf, _("Infobar Sleep"), &maxlen, &pos);
3768        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"infobarsleep\" border=\"0\">", &maxlen, &pos);
3769        for(i = 0; i <= max; i++)
3770        {
3771                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3772                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3773                if(getconfigint("infobarsleep", NULL) == i)
3774                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
3775                else
3776                        ostrcatbig(&buf, "\">", &maxlen, &pos);
3777                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
3778                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3779        }
3780        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3781        sendstr = ostrcat(sendstr, ", infobarsleep.value", 1 , 0);
3782
3783///////////////////
3784//      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);
3785        max = 5;
3786        tmpstr = ostrcat("1\n3\n9\n12\n15\n18\n21\n24\n27\n30", NULL, 0, 0);
3787
3788        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3789        ostrcatbig(&buf, _("Spinnerspeed"), &maxlen, &pos);
3790        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"spinnerspeed\" border=\"0\">", &maxlen, &pos);
3791
3792        count = 0;
3793        ret1 = strsplit(tmpstr, "\n", &count);
3794        max = count - 1;
3795
3796        if(ret1 != NULL)
3797        {
3798                for(i = 0; i <= max; i++)
3799                {
3800                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3801                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3802                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3803                        if(getconfigint("spinnerspeed", NULL) == atoi(tmpstr1))
3804                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
3805                        else
3806                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3807                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3808                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3809                }
3810        }
3811        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3812        sendstr = ostrcat(sendstr, ", spinnerspeed.value", 1 , 0);
3813        free(ret1), ret1 = NULL;
3814        free(tmpstr), tmpstr = NULL;
3815        free(tmpstr1), tmpstr1 = NULL;
3816
3817///////////////////
3818        tmpstr = ostrcat("1\n2\n3\n4\n5\n6\n7\n8\n10000", NULL, 0, 0);
3819
3820        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3821        ostrcatbig(&buf, _("Spinnertime"), &maxlen, &pos);
3822        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"spinnertime\" border=\"0\">", &maxlen, &pos);
3823
3824        count = 0;
3825        ret1 = strsplit(tmpstr, "\n", &count);
3826        max = count - 1;
3827
3828        if(ret1 != NULL)
3829        {
3830                for(i = 0; i <= max; i++)
3831                {
3832                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3833                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3834                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3835                        if(getconfigint("spinnertime", NULL) == atoi(tmpstr1))
3836                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
3837                        else
3838                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3839                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3840                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3841                }
3842        }
3843        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3844        sendstr = ostrcat(sendstr, ", spinnertime.value", 1 , 0);
3845        free(ret1), ret1 = NULL;
3846        free(tmpstr), tmpstr = NULL;
3847        free(tmpstr1), tmpstr1 = NULL;
3848
3849///////////////////
3850        tmpstr = ostrcat("5\n10\n15\n30\n60\n120\n10000", NULL, 0, 0);
3851
3852        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3853        ostrcatbig(&buf, _("Hangtime"), &maxlen, &pos);
3854        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"hangtime\" border=\"0\">", &maxlen, &pos);
3855
3856        count = 0;
3857        ret1 = strsplit(tmpstr, "\n", &count);
3858        max = count - 1;
3859
3860        if(ret1 != NULL)
3861        {
3862                for(i = 0; i <= max; i++)
3863                {
3864                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
3865                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3866                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
3867                        if(getconfigint("hangtime", NULL) == atoi(tmpstr1))
3868                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
3869                        else
3870                                ostrcatbig(&buf, "\">", &maxlen, &pos);
3871                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
3872                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3873                }
3874        }
3875        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3876        sendstr = ostrcat(sendstr, ", hangtime.value", 1 , 0);
3877        free(ret1), ret1 = NULL;
3878        free(tmpstr), tmpstr = NULL;
3879        free(tmpstr1), tmpstr1 = NULL;
3880
3881///////////////////
3882//      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);
3883        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3884        ostrcatbig(&buf, _("Second Infobar"), &maxlen, &pos);
3885        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"secondinfobar\" border=\"0\">", &maxlen, &pos);
3886
3887        if(getconfigint("secondinfobar", NULL) == 0)
3888                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
3889        else
3890                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3891        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3892        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3893
3894        if(getconfigint("secondinfobar", NULL) == 1)
3895                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
3896        else
3897                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3898        ostrcatbig(&buf, _("infobar"), &maxlen, &pos);
3899        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3900
3901        if(getconfigint("secondinfobar", NULL) == 2)
3902                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
3903        else
3904                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3905        ostrcatbig(&buf, _("EPG"), &maxlen, &pos);
3906        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3907
3908        if(getconfigint("secondinfobar", NULL) == 3)
3909                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
3910        else
3911                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
3912        ostrcatbig(&buf, _("Channel EPG"), &maxlen, &pos);
3913        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3914
3915        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3916        sendstr = ostrcat(sendstr, ", secondinfobar.value", 1 , 0);
3917
3918///////////////////
3919        if(checkbox("ATEMIO7600") != 1)
3920        {
3921                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3922                ostrcatbig(&buf, _("Don't clear TV on zap (only with fastzap)"), &maxlen, &pos);
3923                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"nozapclear\" border=\"0\">", &maxlen, &pos);
3924
3925                if(getconfigint("nozapclear", NULL) == 0)
3926                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
3927                else
3928                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3929                ostrcatbig(&buf, _("no"), &maxlen, &pos);
3930                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3931
3932                if(getconfigint("nozapclear", NULL) == 1)
3933                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
3934                else
3935                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3936                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
3937                ostrcatbig(&buf, "</option>", &maxlen, &pos);
3938
3939                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3940                sendstr = ostrcat(sendstr, ", nozapclear.value", 1 , 0);
3941        }
3942
3943///////////////////
3944        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3945        ostrcatbig(&buf, _("Fastzap"), &maxlen, &pos);
3946        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"fastzap\" border=\"0\">", &maxlen, &pos);
3947
3948        if(getconfigint("fastzap", NULL) == 0)
3949                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
3950        else
3951                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3952        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3953        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3954
3955        if(getconfigint("fastzap", NULL) == 1)
3956                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
3957        else
3958                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3959        ostrcatbig(&buf, _("medium"), &maxlen, &pos);
3960        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3961
3962        if(getconfigint("fastzap", NULL) == 2)
3963                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
3964        else
3965                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
3966        ostrcatbig(&buf, _("fast"), &maxlen, &pos);
3967        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3968
3969        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3970        sendstr = ostrcat(sendstr, ", fastzap.value", 1 , 0);
3971
3972///////////////////
3973        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3974        ostrcatbig(&buf, _("Faststop"), &maxlen, &pos);
3975        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"faststop\" border=\"0\">", &maxlen, &pos);
3976
3977        if(getconfigint("faststop", NULL) == 0)
3978                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
3979        else
3980                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
3981        ostrcatbig(&buf, _("no"), &maxlen, &pos);
3982        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3983
3984        if(getconfigint("faststop", NULL) == 1)
3985                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
3986        else
3987                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
3988        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
3989        ostrcatbig(&buf, "</option>", &maxlen, &pos);
3990
3991        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
3992        sendstr = ostrcat(sendstr, ", faststop.value", 1 , 0);
3993
3994///////////////////
3995        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
3996        ostrcatbig(&buf, _("Dirsort"), &maxlen, &pos);
3997        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"dirsort\" border=\"0\">", &maxlen, &pos);
3998
3999        if(getconfigint("dirsort", NULL) == 0)
4000                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4001        else
4002                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4003        ostrcatbig(&buf, _("alpha"), &maxlen, &pos);
4004        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4005
4006        if(getconfigint("dirsort", NULL) == 1)
4007                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4008        else
4009                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4010        ostrcatbig(&buf, _("reverse alpha"), &maxlen, &pos);
4011        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4012
4013        if(getconfigint("dirsort", NULL) == 2)
4014                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4015        else
4016                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4017        ostrcatbig(&buf, _("size"), &maxlen, &pos);
4018        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4019
4020        if(getconfigint("dirsort", NULL) == 3)
4021                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4022        else
4023                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4024        ostrcatbig(&buf, _("reverse size"), &maxlen, &pos);
4025        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4026
4027        if(getconfigint("dirsort", NULL) == 4)
4028                ostrcatbig(&buf, "<option value=\"4\" selected>", &maxlen, &pos);
4029        else
4030                ostrcatbig(&buf, "<option value=\"4\">", &maxlen, &pos);
4031        ostrcatbig(&buf, _("date"), &maxlen, &pos);
4032        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4033
4034        if(getconfigint("dirsort", NULL) == 5)
4035                ostrcatbig(&buf, "<option value=\"5\" selected>", &maxlen, &pos);
4036        else
4037                ostrcatbig(&buf, "<option value=\"5\">", &maxlen, &pos);
4038        ostrcatbig(&buf, _("reverse date"), &maxlen, &pos);
4039        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4040
4041        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4042        sendstr = ostrcat(sendstr, ", dirsort.value", 1 , 0);
4043
4044///////////////////rcpower
4045        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4046        ostrcatbig(&buf, _("Remotecontrol Power Aktion"), &maxlen, &pos);
4047        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"poweraktion\" border=\"0\">", &maxlen, &pos);
4048
4049        if(getconfigint("poweraktion", NULL) == 0)
4050                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4051        else
4052                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4053        ostrcatbig(&buf, _("Power Menu"), &maxlen, &pos);
4054        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4055
4056        if(getconfigint("poweraktion", NULL) == 1)
4057                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4058        else
4059                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4060        ostrcatbig(&buf, _("Power Off"), &maxlen, &pos);
4061        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4062
4063        if(getconfigint("poweraktion", NULL) == 2)
4064                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4065        else
4066                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4067        ostrcatbig(&buf, _("Standby"), &maxlen, &pos);
4068        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4069
4070        if(getconfigint("poweraktion", NULL) == 3)
4071                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4072        else
4073                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4074        ostrcatbig(&buf, _("Restart"), &maxlen, &pos);
4075        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4076
4077        if(getconfigint("poweraktion", NULL) == 4)
4078                ostrcatbig(&buf, "<option value=\"4\" selected>", &maxlen, &pos);
4079        else
4080                ostrcatbig(&buf, "<option value=\"4\">", &maxlen, &pos);
4081        ostrcatbig(&buf, _("GUI Restart"), &maxlen, &pos);
4082        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4083
4084        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4085        sendstr = ostrcat(sendstr, ", poweraktion.value", 1 , 0);
4086
4087///////////////////frontpower
4088        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4089        ostrcatbig(&buf, _("Frontpanel Power Aktion"), &maxlen, &pos);
4090        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"frontpoweraktion\" border=\"0\">", &maxlen, &pos);
4091
4092        if(getconfigint("frontpoweraktion", NULL) == 1)
4093                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4094        else
4095                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4096        ostrcatbig(&buf, _("Power Off"), &maxlen, &pos);
4097        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4098
4099        if(getconfigint("frontpoweraktion", NULL) == 2)
4100                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4101        else
4102                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4103        ostrcatbig(&buf, _("Standby"), &maxlen, &pos);
4104        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4105
4106        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4107        sendstr = ostrcat(sendstr, ", frontpoweraktion.value", 1 , 0);
4108
4109///////////////////
4110        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4111        ostrcatbig(&buf, _("Virtualzap Timeout"), &maxlen, &pos);
4112        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"virtualzap\" border=\"0\">", &maxlen, &pos);
4113
4114        if(getconfigint("virtualzap", NULL) == 0)
4115                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4116        else
4117                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4118        ostrcatbig(&buf, _("disable"), &maxlen, &pos);
4119        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4120
4121        if(getconfigint("virtualzap", NULL) == 1)
4122                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4123        else
4124                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4125        ostrcatbig(&buf, _("1 sec"), &maxlen, &pos);
4126        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4127
4128        if(getconfigint("virtualzap", NULL) == 2)
4129                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4130        else
4131                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4132        ostrcatbig(&buf, _("2 sec"), &maxlen, &pos);
4133        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4134
4135        if(getconfigint("virtualzap", NULL) == 3)
4136                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4137        else
4138                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4139        ostrcatbig(&buf, _("endless"), &maxlen, &pos);
4140        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4141
4142        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4143        sendstr = ostrcat(sendstr, ", virtualzap.value", 1 , 0);
4144
4145///////////////////
4146        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4147        ostrcatbig(&buf, _("Fast Text Render"), &maxlen, &pos);
4148        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"fasttextrender\" border=\"0\">", &maxlen, &pos);
4149
4150        if(getconfigint("fasttextrender", 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("fasttextrender", NULL) == 1)
4158                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4159        else
4160                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4161        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4162        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4163
4164        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4165        sendstr = ostrcat(sendstr, ", fasttextrender.value", 1 , 0);
4166
4167///////////////////
4168        if(status.pvr == 1)
4169        {
4170                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4171                ostrcatbig(&buf, _("Record Split Size"), &maxlen, &pos);
4172                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recsplitsize\" border=\"0\">", &maxlen, &pos);
4173
4174                if(getconfigint("recsplitsize", NULL) == 0)
4175                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4176                else
4177                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4178                ostrcatbig(&buf, _("disable"), &maxlen, &pos);
4179                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4180
4181                if(getconfigint("recsplitsize", NULL) == 1)
4182                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4183                else
4184                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4185                ostrcatbig(&buf, _("1 GB"), &maxlen, &pos);
4186                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4187
4188                if(getconfigint("recsplitsize", NULL) == 2)
4189                        ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4190                else
4191                        ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4192                ostrcatbig(&buf, _("2 GB"), &maxlen, &pos);
4193                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4194
4195                if(getconfigint("recsplitsize", NULL) == 3)
4196                        ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4197                else
4198                        ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4199                ostrcatbig(&buf, _("3 GB"), &maxlen, &pos);
4200                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4201
4202                if(getconfigint("recsplitsize", NULL) == 4)
4203                        ostrcatbig(&buf, "<option value=\"4\" selected>", &maxlen, &pos);
4204                else
4205                        ostrcatbig(&buf, "<option value=\"4\">", &maxlen, &pos);
4206                ostrcatbig(&buf, _("4 GB"), &maxlen, &pos);
4207                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4208
4209                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4210                sendstr = ostrcat(sendstr, ", recsplitsize.value", 1 , 0);
4211
4212///////////////////
4213                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);
4214
4215                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4216                ostrcatbig(&buf, _("Record Forerun (min)"), &maxlen, &pos);
4217                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recforerun\" border=\"0\">", &maxlen, &pos);
4218
4219                count = 0;
4220                ret1 = strsplit(tmpstr, "\n", &count);
4221                max = count - 1;
4222
4223                if(ret1 != NULL)
4224                {
4225                        for(i = 0; i <= max; i++)
4226                        {
4227                                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4228                                ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4229                                tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4230                                if(getconfigint("recforerun", NULL) == atoi(tmpstr1))
4231                                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4232                                else
4233                                        ostrcatbig(&buf, "\">", &maxlen, &pos);
4234                                ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4235                                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4236                        }
4237                }
4238                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4239                sendstr = ostrcat(sendstr, ", recforerun.value", 1 , 0);
4240                free(ret1), ret1 = NULL;
4241                free(tmpstr), tmpstr = NULL;
4242                free(tmpstr1), tmpstr1 = NULL;
4243
4244///////////////////
4245                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);
4246
4247                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4248                ostrcatbig(&buf, _("Record Overrun (min)"), &maxlen, &pos);
4249                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recoverrun\" border=\"0\">", &maxlen, &pos);
4250
4251                count = 0;
4252                ret1 = strsplit(tmpstr, "\n", &count);
4253                max = count - 1;
4254
4255                if(ret1 != NULL)
4256                {
4257                        for(i = 0; i <= max; i++)
4258                        {
4259                                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4260                                ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4261                                tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4262                                if(getconfigint("recoverrun", NULL) == atoi(tmpstr1))
4263                                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4264                                else
4265                                        ostrcatbig(&buf, "\">", &maxlen, &pos);
4266                                ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4267                                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4268                        }
4269                }
4270                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4271                sendstr = ostrcat(sendstr, ", recoverrun.value", 1 , 0);
4272                free(ret1), ret1 = NULL;
4273                free(tmpstr), tmpstr = NULL;
4274                free(tmpstr1), tmpstr1 = NULL;
4275        }
4276///////////////////
4277        tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0);
4278
4279        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4280        ostrcatbig(&buf, _("Skip 1/3"), &maxlen, &pos);
4281        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"skip13\" border=\"0\">", &maxlen, &pos);
4282
4283        count = 0;
4284        ret1 = strsplit(tmpstr, "\n", &count);
4285        max = count - 1;
4286
4287        if(ret1 != NULL)
4288        {
4289                for(i = 0; i <= max; i++)
4290                {
4291                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4292                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4293                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4294                        if(getconfigint("skip13", NULL) == atoi(tmpstr1))
4295                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4296                        else
4297                                ostrcatbig(&buf, "\">", &maxlen, &pos);
4298                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4299                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4300                }
4301        }
4302        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4303        sendstr = ostrcat(sendstr, ", skip13.value", 1 , 0);
4304        free(ret1), ret1 = NULL;
4305        free(tmpstr), tmpstr = NULL;
4306        free(tmpstr1), tmpstr1 = NULL;
4307
4308///////////////////
4309        tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0);
4310
4311        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4312        ostrcatbig(&buf, _("Skip 4/6"), &maxlen, &pos);
4313        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"skip46\" border=\"0\">", &maxlen, &pos);
4314
4315        count = 0;
4316        ret1 = strsplit(tmpstr, "\n", &count);
4317        max = count - 1;
4318
4319        if(ret1 != NULL)
4320        {
4321                for(i = 0; i <= max; i++)
4322                {
4323                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4324                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4325                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4326                        if(getconfigint("skip46", NULL) == atoi(tmpstr1))
4327                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4328                        else
4329                                ostrcatbig(&buf, "\">", &maxlen, &pos);
4330                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4331                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4332                }
4333        }
4334        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4335        sendstr = ostrcat(sendstr, ", skip46.value", 1 , 0);
4336        free(ret1), ret1 = NULL;
4337        free(tmpstr), tmpstr = NULL;
4338        free(tmpstr1), tmpstr1 = NULL;
4339
4340///////////////////
4341        tmpstr = ostrcat("15\n20\n30\n45\n60\n90\n120\n180\n300\n600\n900\n1200", NULL, 0, 0);
4342
4343        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4344        ostrcatbig(&buf, _("Skip 7/9"), &maxlen, &pos);
4345        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"skip79\" border=\"0\">", &maxlen, &pos);
4346
4347        count = 0;
4348        ret1 = strsplit(tmpstr, "\n", &count);
4349        max = count - 1;
4350
4351        if(ret1 != NULL)
4352        {
4353                for(i = 0; i <= max; i++)
4354                {
4355                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4356                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4357                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4358                        if(getconfigint("skip79", NULL) == atoi(tmpstr1))
4359                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4360                        else
4361                                ostrcatbig(&buf, "\">", &maxlen, &pos);
4362                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4363                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4364                }
4365        }
4366        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4367        sendstr = ostrcat(sendstr, ", skip79.value", 1 , 0);
4368        free(ret1), ret1 = NULL;
4369        free(tmpstr), tmpstr = NULL;
4370        free(tmpstr1), tmpstr1 = NULL;
4371
4372///////////////////
4373        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4374        ostrcatbig(&buf, _("Player for .ts"), &maxlen, &pos);
4375        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"playertype\" border=\"0\">", &maxlen, &pos);
4376
4377        if(getconfigint("playertype", NULL) == 0)
4378                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4379        else
4380                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4381        ostrcatbig(&buf, _("extern"), &maxlen, &pos);
4382        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4383
4384        if(getconfigint("faststop", NULL) == 1)
4385                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4386        else
4387                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4388        ostrcatbig(&buf, _("intern"), &maxlen, &pos);
4389        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4390
4391        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4392        sendstr = ostrcat(sendstr, ", playertype.value", 1 , 0);
4393
4394///////////////////
4395        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4396        ostrcatbig(&buf, _("Change Channelname auto."), &maxlen, &pos);
4397        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"autochangechannelname\" border=\"0\">", &maxlen, &pos);
4398
4399        if(getconfigint("autochangechannelname", NULL) == 0)
4400                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4401        else
4402                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4403        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4404        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4405
4406        if(getconfigint("autochangechannelname", NULL) == 1)
4407                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4408        else
4409                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4410        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4411        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4412
4413        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4414        sendstr = ostrcat(sendstr, ", autochangechannelname.value", 1 , 0);
4415
4416///////////////////
4417        if(status.pvr == 1)
4418        {
4419                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4420                ostrcatbig(&buf, _("Set action after rec"), &maxlen, &pos);
4421                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"def_rectimer_after\" border=\"0\">", &maxlen, &pos);
4422
4423                if(getconfigint("def_rectimer_after", NULL) == 0)
4424                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4425                else
4426                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4427                ostrcatbig(&buf, _("auto"), &maxlen, &pos);
4428                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4429
4430                if(getconfigint("def_rectimer_after", NULL) == 1)
4431                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4432                else
4433                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4434                ostrcatbig(&buf, _("nothing"), &maxlen, &pos);
4435                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4436
4437                if(getconfigint("def_rectimer_after", NULL) == 2)
4438                        ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4439                else
4440                        ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4441                ostrcatbig(&buf, _("standby"), &maxlen, &pos);
4442                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4443
4444                if(getconfigint("def_rectimer_after", NULL) == 3)
4445                        ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4446                else
4447                        ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4448                ostrcatbig(&buf, _("power off"), &maxlen, &pos);
4449                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4450
4451                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4452                sendstr = ostrcat(sendstr, ", def_rectimer_after.value", 1 , 0);
4453        }
4454///////////////////
4455        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4456        ostrcatbig(&buf, _("Show Timeline in Channellist"), &maxlen, &pos);
4457        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"showchanneltimeline\" border=\"0\">", &maxlen, &pos);
4458
4459        if(getconfigint("showchanneltimeline", NULL) == 0)
4460                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4461        else
4462                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4463        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4464        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4465
4466        if(getconfigint("showchanneltimeline", NULL) == 1)
4467                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4468        else
4469                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4470        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4471        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4472
4473        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4474        sendstr = ostrcat(sendstr, ", showchanneltimeline.value", 1 , 0);
4475
4476///////////////////
4477#ifndef MIPSEL
4478        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4479        ostrcatbig(&buf, _("Animated Screens"), &maxlen, &pos);
4480        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"screenanim\" border=\"0\">", &maxlen, &pos);
4481
4482        if(getconfigint("screenanim", NULL) == 0)
4483                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4484        else
4485                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4486        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4487        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4488
4489        if(getconfigint("screenanim", NULL) == 1)
4490                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4491        else
4492                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4493        ostrcatbig(&buf, _("anim. width"), &maxlen, &pos);
4494        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4495
4496        if(getconfigint("screenanim", NULL) == 2)
4497                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4498        else
4499                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4500        ostrcatbig(&buf, _("anim. height"), &maxlen, &pos);
4501        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4502
4503        if(getconfigint("screenanim", NULL) == 3)
4504                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4505        else
4506                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4507        ostrcatbig(&buf, _("anim. both"), &maxlen, &pos);
4508        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4509
4510        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4511        sendstr = ostrcat(sendstr, ", screenanim.value", 1 , 0);
4512
4513///////////////////
4514        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4515        ostrcatbig(&buf, _("Animated Speed"), &maxlen, &pos);
4516        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"screenanimspeed\" border=\"0\">", &maxlen, &pos);
4517
4518        if(getconfigint("screenanimspeed", NULL) == 1)
4519                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4520        else
4521                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4522        ostrcatbig(&buf, _("very fast"), &maxlen, &pos);
4523        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4524
4525        if(getconfigint("screenanimspeed", NULL) == 5)
4526                ostrcatbig(&buf, "<option value=\"5\" selected>", &maxlen, &pos);
4527        else
4528                ostrcatbig(&buf, "<option value=\"5\">", &maxlen, &pos);
4529        ostrcatbig(&buf, _("fast"), &maxlen, &pos);
4530        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4531
4532        if(getconfigint("screenanimspeed", NULL) == 10)
4533                ostrcatbig(&buf, "<option value=\"10\" selected>", &maxlen, &pos);
4534        else
4535                ostrcatbig(&buf, "<option value=\"10\">", &maxlen, &pos);
4536        ostrcatbig(&buf, _("normal"), &maxlen, &pos);
4537        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4538
4539        if(getconfigint("screenanimspeed", NULL) == 15)
4540                ostrcatbig(&buf, "<option value=\"15\" selected>", &maxlen, &pos);
4541        else
4542                ostrcatbig(&buf, "<option value=\"15\">", &maxlen, &pos);
4543        ostrcatbig(&buf, _("slow"), &maxlen, &pos);
4544        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4545
4546        if(getconfigint("screenanimspeed", NULL) == 20)
4547                ostrcatbig(&buf, "<option value=\"20\" selected>", &maxlen, &pos);
4548        else
4549                ostrcatbig(&buf, "<option value=\"20\">", &maxlen, &pos);
4550        ostrcatbig(&buf, _("very slow"), &maxlen, &pos);
4551        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4552
4553        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4554        sendstr = ostrcat(sendstr, ", screenanimspeed.value", 1 , 0);
4555#endif
4556///////////////////
4557        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4558        ostrcatbig(&buf, _("Channellist view"), &maxlen, &pos);
4559        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"channellistview\" border=\"0\">", &maxlen, &pos);
4560
4561        if(getconfigint("channellistview", NULL) == 0)
4562                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4563        else
4564                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4565        ostrcatbig(&buf, _("hidden"), &maxlen, &pos);
4566        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4567
4568        if(getconfigint("channellistview", NULL) == 1)
4569                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4570        else
4571                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4572        ostrcatbig(&buf, _("deaktiv"), &maxlen, &pos);
4573        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4574
4575        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4576        sendstr = ostrcat(sendstr, ", channellistview.value", 1 , 0);
4577
4578///////////////////
4579        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4580        ostrcatbig(&buf, _("Show last pos Question"), &maxlen, &pos);
4581        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"showlastpos\" border=\"0\">", &maxlen, &pos);
4582
4583        if(getconfigint("showlastpos", NULL) == 0)
4584                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4585        else
4586                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4587        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4588        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4589
4590        if(getconfigint("showlastpos", NULL) == 1)
4591                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4592        else
4593                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4594        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4595        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4596
4597        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4598        sendstr = ostrcat(sendstr, ", showlastpos.value", 1 , 0);
4599
4600///////////////////
4601        if(status.pvr == 1)
4602        {
4603                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4604                ostrcatbig(&buf, _("Resync Recording immediately"), &maxlen, &pos);
4605                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recsync\" border=\"0\">", &maxlen, &pos);
4606
4607                if(getconfigint("recsync", NULL) == 0)
4608                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4609                else
4610                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4611                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4612                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4613
4614                if(getconfigint("recsync", NULL) == 1)
4615                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4616                else
4617                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4618                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4619                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4620
4621                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4622                sendstr = ostrcat(sendstr, ", recsync.value", 1 , 0);
4623///////////////////
4624                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4625                ostrcatbig(&buf, _("Recording name"), &maxlen, &pos);
4626                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"recordnamefmt\" border=\"0\">", &maxlen, &pos);
4627
4628                if(getconfigint("recordnamefmt", NULL) == 0)
4629                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4630                else
4631                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4632                ostrcatbig(&buf, _("channel-movie"), &maxlen, &pos);
4633                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4634
4635                if(getconfigint("recordnamefmt", NULL) == 1)
4636                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4637                else
4638                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4639                ostrcatbig(&buf, _("movie-channel"), &maxlen, &pos);
4640                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4641
4642                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4643                sendstr = ostrcat(sendstr, ", recordnamefmt.value", 1 , 0);
4644        }
4645///////////////////
4646        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4647        ostrcatbig(&buf, _("Newsletter"), &maxlen, &pos);
4648        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"newsletter\" border=\"0\">", &maxlen, &pos);
4649
4650        if(getconfigint("newsletter", NULL) == 0)
4651                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4652        else
4653                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4654        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4655        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4656
4657        if(getconfigint("newsletter", NULL) == 1)
4658                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4659        else
4660                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4661        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4662        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4663
4664        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4665        sendstr = ostrcat(sendstr, ", newsletter.value", 1 , 0);
4666
4667///////////////////
4668        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4669        ostrcatbig(&buf, _("Show hidden files"), &maxlen, &pos);
4670        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"showhiddenfiles\" border=\"0\">", &maxlen, &pos);
4671
4672        if(getconfigint("showhiddenfiles", NULL) == 0)
4673                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4674        else
4675                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4676        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4677        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4678
4679        if(getconfigint("showhiddenfiles", NULL) == 1)
4680                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4681        else
4682                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4683        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4684        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4685
4686        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4687        sendstr = ostrcat(sendstr, ", showhiddenfiles.value", 1 , 0);
4688
4689///////////////////
4690        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4691        ostrcatbig(&buf, _("Expert Modus"), &maxlen, &pos);
4692        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"expertmodus\" border=\"0\">", &maxlen, &pos);
4693
4694        if(getconfigint("expertmodus", NULL) == 0)
4695                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4696        else
4697                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4698        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4699        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4700
4701        if(getconfigint("expertmodus", NULL) == 10)
4702                ostrcatbig(&buf, "<option value=\"10\" selected>", &maxlen, &pos);
4703        else
4704                ostrcatbig(&buf, "<option value=\"10\">", &maxlen, &pos);
4705        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4706        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4707
4708        if(getconfigint("expertmodus", NULL) == 11)
4709                ostrcatbig(&buf, "<option value=\"11\" selected>", &maxlen, &pos);
4710        else
4711                ostrcatbig(&buf, "<option value=\"11\">", &maxlen, &pos);
4712        ostrcatbig(&buf, _("expert (11)"), &maxlen, &pos);
4713        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4714
4715        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4716        sendstr = ostrcat(sendstr, ", expertmodus.value", 1 , 0);
4717
4718///////////////////
4719        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4720        ostrcatbig(&buf, _("Show infobar on program change"), &maxlen, &pos);
4721        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"infobarprogram\" border=\"0\">", &maxlen, &pos);
4722
4723        if(getconfigint("infobarprogram", NULL) == 0)
4724                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4725        else
4726                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4727        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4728        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4729
4730        if(getconfigint("infobarprogram", NULL) == 1)
4731                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4732        else
4733                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4734        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4735        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4736
4737        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4738        sendstr = ostrcat(sendstr, ", infobarprogram.value", 1 , 0);
4739
4740///////////////////
4741        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4742        ostrcatbig(&buf, _("Use cross control for fast zapping and vol"), &maxlen, &pos);
4743        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"crosscontrol\" border=\"0\">", &maxlen, &pos);
4744
4745        if(getconfigint("crosscontrol", NULL) == 0)
4746                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4747        else
4748                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4749        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4750        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4751
4752        if(getconfigint("crosscontrol", NULL) == 1)
4753                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4754        else
4755                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4756        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4757        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4758
4759        if(getconfigint("crosscontrol", NULL) == 2)
4760                ostrcatbig(&buf, "<option value=\"2\" selected>", &maxlen, &pos);
4761        else
4762                ostrcatbig(&buf, "<option value=\"2\">", &maxlen, &pos);
4763        ostrcatbig(&buf, _("yes / vzap 1 sec"), &maxlen, &pos);
4764        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4765
4766        if(getconfigint("crosscontrol", NULL) == 3)
4767                ostrcatbig(&buf, "<option value=\"3\" selected>", &maxlen, &pos);
4768        else
4769                ostrcatbig(&buf, "<option value=\"3\">", &maxlen, &pos);
4770        ostrcatbig(&buf, _("yes / vzap 2 sec"), &maxlen, &pos);
4771        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4772
4773        if(getconfigint("crosscontrol", NULL) == 9999)
4774                ostrcatbig(&buf, "<option value=\"9999\" selected>", &maxlen, &pos);
4775        else
4776                ostrcatbig(&buf, "<option value=\"9999\">", &maxlen, &pos);
4777        ostrcatbig(&buf, _("yes / vzap endless"), &maxlen, &pos);
4778        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4779
4780        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4781        sendstr = ostrcat(sendstr, ", crosscontrol.value", 1 , 0);
4782
4783///////////////////
4784        if(status.security >= 1)
4785        {
4786                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4787                ostrcatbig(&buf, _("Deactivate Crypt Support on Media Playback"), &maxlen, &pos);
4788                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"emucontrol\" border=\"0\">", &maxlen, &pos);
4789
4790                if(getconfigint("emucontrol", NULL) == 0)
4791                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4792                else
4793                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4794                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4795                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4796
4797                if(getconfigint("emucontrol", NULL) == 1)
4798                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4799                else
4800                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4801                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4802                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4803
4804                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4805                sendstr = ostrcat(sendstr, ", emucontrol.value", 1 , 0);
4806        }
4807
4808///////////////////
4809        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4810        ostrcatbig(&buf, _("Deactivate MiniTV"), &maxlen, &pos);
4811        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"choiceminitv\" border=\"0\">", &maxlen, &pos);
4812
4813        if(getconfigint("choiceminitv", NULL) == 0)
4814                ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4815        else
4816                ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4817        ostrcatbig(&buf, _("no"), &maxlen, &pos);
4818        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4819
4820        if(getconfigint("choiceminitv", NULL) == 1)
4821                ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4822        else
4823                ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4824        ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4825        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4826
4827        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4828        sendstr = ostrcat(sendstr, ", choiceminitv.value", 1 , 0);
4829
4830///////////////////
4831        if(checkbox("ATEMIO510") == 1 || checkbox("UFS912") == 1 || checkbox("ATEMIO7600") == 1 || checkbox("ATEMIO520") == 1 || checkbox("ATEMIO530") == 1 || checkbox("SPARK") == 1 || checkbox("SPARK7162") == 1)
4832        {
4833                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4834                ostrcatbig(&buf, _("Activate CEC"), &maxlen, &pos);
4835                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"usecec\" border=\"0\">", &maxlen, &pos);
4836
4837                if(getconfigint("usecec", NULL) == 0)
4838                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4839                else
4840                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4841                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4842                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4843
4844                if(getconfigint("usecec", NULL) == 1)
4845                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4846                else
4847                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4848                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4849                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4850
4851                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4852                sendstr = ostrcat(sendstr, ", usecec.value", 1 , 0);
4853        }
4854
4855///////////////////
4856        if(checkbox("ATEMIO7600") == 1)
4857        {
4858                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4859                ostrcatbig(&buf, _("SATA Connector"), &maxlen, &pos);
4860                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"sataswitch\" border=\"0\">", &maxlen, &pos);
4861
4862                if(getconfigint("sataswitch", NULL) == 0)
4863                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4864                else
4865                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4866                ostrcatbig(&buf, _("extern"), &maxlen, &pos);
4867                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4868
4869                if(getconfigint("sataswitch", NULL) == 1)
4870                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4871                else
4872                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4873                ostrcatbig(&buf, _("intern"), &maxlen, &pos);
4874                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4875
4876                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4877                sendstr = ostrcat(sendstr, ", sataswitch.value", 1 , 0);
4878        }
4879
4880///////////////////
4881//      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);
4882        max = 10;
4883        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4884        ostrcatbig(&buf, _("Time to wait after seek for fill buffer"), &maxlen, &pos);
4885        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"playerbufferseektime\" border=\"0\">", &maxlen, &pos);
4886        for(i = 1; i <= max; i++)
4887        {
4888                ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4889                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
4890                if(getconfigint("playerbufferseektime", NULL) == i)
4891                        ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4892                else
4893                        ostrcatbig(&buf, "\">", &maxlen, &pos);
4894                ostrcatbig(&buf, oitoa(i), &maxlen, &pos);
4895                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4896        }
4897        ostrcatbig(&buf, "</select></td></tr>", &maxlen, &pos);
4898        sendstr = ostrcat(sendstr, ", playerbufferseektime.value", 1 , 0);
4899
4900///////////////////debuglevel
4901#ifdef BETA
4902        char* tmpstr2 = NULL;
4903        struct splitstr* ret2 = NULL;
4904        tmpstr = ostrcat("10\n40\n50\n55\n60\n70\n77\n80\n81\n90\n99\n100\n110\n130\n133\n150\n200\n201\n250\n270\n278\n300\n307\n333\n400\n401\n427\n444\n500\n555\n620\n777\n900\n913\n975\n4440", NULL, 0, 0);
4905        tmpstr2 = ostrcat(" - Minimal\n - MTD Operation/System Update\n - MediaCenter\n - Network Interface\n - Key Actions\n - Network Browser\n - Web Adjust\n - Harddisk\n - MultiImage\n - Screensaver\n - Tithek/HTTP Header/Community\n - Global\n - Stringconvert\n - TPK\n - MediaDB/IMDb/TMDb\n - ePlayer\n - DVB Devices\n - CA Device\n - HTTP Server/Stream/Record\n - Radiotext\n - ID3\n - Subtitle\n - Thumbnails\n - DVD Player\n - EPG Task\n - Old Entry\n - Newsletter\n - Framebuffer\n - Channel Scan\n - Draw Screen\n - CA\n - MediaDB\n - Mutex\n - File Operation\n - SMTP\n - PiP", NULL, 0, 0);
4906
4907        ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4908        ostrcatbig(&buf, _("Debuglevel"), &maxlen, &pos);
4909        ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"debuglevel\" border=\"0\">", &maxlen, &pos);
4910
4911        count = 0;
4912        ret1 = strsplit(tmpstr, "\n", &count);
4913        count = 0;
4914        ret2 = strsplit(tmpstr2, "\n", &count);
4915        max = count - 1;
4916
4917        if(ret1 != NULL)
4918        {
4919                for(i = 0; i <= max; i++)
4920                {
4921                        ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
4922                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4923                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
4924                        if(getconfigint("debuglevel", NULL) == atoi(tmpstr1))
4925                                ostrcatbig(&buf, "\" selected>", &maxlen, &pos);
4926                        else
4927                                ostrcatbig(&buf, "\">", &maxlen, &pos);
4928                        ostrcatbig(&buf, ret1[i].part, &maxlen, &pos);
4929                        ostrcatbig(&buf, ret2[i].part, &maxlen, &pos);
4930                        ostrcatbig(&buf, "</option>", &maxlen, &pos);
4931                }
4932        }
4933        ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4934        sendstr = ostrcat(sendstr, ", debuglevel.value", 1 , 0);
4935        free(ret1), ret1 = NULL;
4936        free(ret2), ret2 = NULL;
4937        free(tmpstr), tmpstr = NULL;
4938        free(tmpstr1), tmpstr1 = NULL;
4939        free(tmpstr2), tmpstr2 = NULL;
4940#endif
4941
4942///////////////////
4943#ifdef MIPSEL
4944        if(file_exist("/usr/bin/enigma2"))
4945        {
4946                ostrcatbig(&buf, "<tr><td><font class=\"label\">", &maxlen, &pos);
4947                ostrcatbig(&buf, _("Dualboot Menu TitanNit / E2"), &maxlen, &pos);
4948                ostrcatbig(&buf, "&nbsp;</font></td><td><select name=\"dualboot\" border=\"0\">", &maxlen, &pos);
4949
4950        //              if(getconfigint("dualboot", NULL) == 0)
4951                if(!file_exist("/mnt/config/dualboot"))
4952                        ostrcatbig(&buf, "<option value=\"0\" selected>", &maxlen, &pos);
4953                else
4954                        ostrcatbig(&buf, "<option value=\"0\">", &maxlen, &pos);
4955                ostrcatbig(&buf, _("no"), &maxlen, &pos);
4956                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4957
4958        //              if(getconfigint("dualboot", NULL) == 1)
4959                if(file_exist("/mnt/config/dualboot"))
4960                        ostrcatbig(&buf, "<option value=\"1\" selected>", &maxlen, &pos);
4961                else
4962                        ostrcatbig(&buf, "<option value=\"1\">", &maxlen, &pos);
4963                ostrcatbig(&buf, _("yes"), &maxlen, &pos);
4964                ostrcatbig(&buf, "</option>", &maxlen, &pos);
4965
4966                ostrcatbig(&buf,"</select></td></tr>", &maxlen, &pos);
4967                sendstr = ostrcat(sendstr, ", dualboot.value", 1 , 0);
4968        }
4969#endif
4970
4971
4972//      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);
4973//      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);
4974// sendstr verwenden
4975        ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return ", &maxlen, &pos);
4976        ostrcatbig(&buf, sendstr, &maxlen, &pos);
4977        ostrcatbig(&buf, "\"></input>&nbsp;<input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
4978
4979
4980//writesys("/tmp/tmpstr", buf, 1);
4981        //ostrcatbig(&buf, param, &maxlen, &pos);
4982        return buf;
4983}
4984
4985char* webadjustsend(char* param, int fmt)
4986{
4987        debug(77, "fmt: %d param: %s",fmt , param);
4988
4989        char* buf = NULL;
4990        char* tmpstr = NULL, *tmpstr1 = NULL;
4991
4992        int count, count2,  max, i;
4993
4994        tmpstr = ostrcat(param, NULL, 0, 0);
4995
4996        count = 0;
4997        struct splitstr* ret1 = NULL;
4998        ret1 = strsplit(tmpstr, "&", &count);
4999        max = count - 1;
5000
5001        if(ret1 != NULL)
5002        {
5003                for(i = 0; i <= max; i++)
5004                {
5005                        if(ostrcmp(ret1[i].part, "node=0") == 0 || ostrcmp(ret1[i].part, "send=Send") == 0)
5006                        {
5007                                debug(77, "skip: %s", ret1[i].part);
5008                                continue;
5009                        }
5010                        tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
5011                        count2 = 0;
5012                        struct splitstr* ret2 = NULL;
5013                        ret2 = strsplit(tmpstr1, "=", &count2);
5014                        if(ret2 != NULL && count2 > 1)
5015                        {
5016                                if(ret2[1].part != NULL && ostrcmp(ret2[0].part, "dualboot") == 0)
5017                                {
5018                                        debug(77, "add %s: %s", ret2[0].part, ret2[1].part);
5019                                        if(ostrcmp(ret2[1].part, "0") == 0)
5020                                        {
5021                                                debug(77, "unlink /mnt/config/dualboot");
5022                                                unlink("/mnt/config/dualboot");
5023                                        }
5024                                        else
5025                                        {
5026                                                debug(77, "touch /mnt/config/dualboot");
5027                                                system("touch /mnt/config/dualboot");
5028                                        }
5029                                }
5030                                else if(ret2[1].part != NULL)
5031                                {
5032                                        debug(77, "add %s: %s", ret2[0].part, ret2[1].part);
5033                                        addconfigtmp(ret2[0].part, ret2[1].part);
5034                                }
5035
5036                        }
5037                        free(ret2), ret2 = NULL;
5038                        free(tmpstr1), tmpstr1 = NULL;
5039                }
5040        }
5041        free(ret1), ret1 = NULL;
5042        free(tmpstr), tmpstr = NULL;
5043
5044        buf = webadjust(NULL, fmt);
5045        writeconfigtmp();
5046        writeallconfig(1);
5047#ifdef BETA
5048setdebuglevel();
5049#endif
5050        return buf;
5051}
5052
5053char* webgetparamvalue(char* param, char* searchparam)
5054{
5055        char* buf = NULL;
5056        char* tmpstr = NULL;
5057
5058        tmpstr = ostrcat(param, NULL, 0, 0);
5059        if(tmpstr != NULL) buf = ostrstr(tmpstr, searchparam);
5060        if(buf != NULL) buf = buf + strlen(searchparam);
5061        free(tmpstr); tmpstr = NULL;
5062        buf = stringreplacecharonce(buf, '&', '\0');
5063        debug(77, "webgetparamvalue param: %s", param);
5064        debug(77, "webgetparamvalue search: %s", searchparam);
5065        debug(77, "webgetparamvalue value: %s", buf);
5066        return buf;
5067}
5068
5069char* webgetsystem(char* param, int fmt)
5070{
5071        char* buf = NULL;
5072        int ret = 0;
5073        if(param == NULL) return NULL;
5074        if(status.security == 0) return NULL;
5075
5076//      if(fmt == 0)
5077//      {
5078                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5079                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5080                buf = ostrcat(buf, "</head><body class=body id=\"system\"><center>", 1, 0);
5081                buf = ostrcat(buf, "<h1>", 1, 0);
5082//      }
5083
5084        debug(10, "cmd: %s", param);
5085        ret = system(param);
5086
5087        if(ret != 0)
5088                buf = ostrcat(buf, _("Error, Program not started."), 1, 0);
5089        else
5090                buf = ostrcat(buf, _("Program started successfully"), 1, 0);
5091        buf = ostrcat(buf, "<br>", 1, 0);
5092
5093        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5094
5095//      if(fmt == 0)
5096                buf = ostrcat(buf, "</h1></center></body></html>", 1, 0);
5097
5098        return buf;
5099}
5100
5101char* webgethelp(char* param, int fmt)
5102{
5103        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *helppath = NULL, *lang = NULL;
5104        if(param == NULL) return NULL;
5105
5106//      if(fmt == 0)
5107//      {
5108                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5109                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5110                buf = ostrcat(buf, "</head><body class=body id=\"help\"><center>", 1, 0);
5111                buf = ostrcat(buf, "<br>", 1, 0);
5112                buf = ostrcat(buf, "<h1>", 1, 0);
5113                buf = ostrcat(buf, _(param), 1, 0);
5114                buf = ostrcat(buf, "</h1>", 1, 0);
5115                buf = ostrcat(buf, "<br>", 1, 0);
5116//      }
5117
5118        helppath = getconfig("helppath", NULL);
5119        if(helppath == NULL) return NULL;
5120
5121        //get language
5122        lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0);
5123        lang = string_replace("po/", "", lang, 1);
5124
5125        //create full filename
5126        tmpstr = ostrcat(helppath, "/", 0, 0);
5127        tmpstr = ostrcat(tmpstr, lang, 1, 0);
5128        tmpstr = ostrcat(tmpstr, "/", 1, 0);
5129        tmpstr = ostrcat(tmpstr, param, 1, 0);
5130        tmpstr = ostrcat(tmpstr, ".txt", 1, 0);
5131
5132        debug(10, "file: %s", tmpstr);
5133        tmpstr1 = readfiletomem(tmpstr, 1);
5134
5135        buf = ostrcat(buf, _(tmpstr1), 1, 0);
5136        buf = string_replace_all("\n", "<br>", buf, 1);
5137
5138// segfault ??
5139//      free(helppath), helppath = NULL;
5140
5141        free(lang), lang = NULL;
5142        free(tmpstr), tmpstr = NULL;
5143        free(tmpstr1), tmpstr1 = NULL;
5144        buf = string_replace_all("\n", "<br>", buf, 1);
5145
5146//      if(fmt == 0)
5147                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5148
5149        return buf;
5150}
5151
5152char* webgethelpchoices(int fmt)
5153{
5154        char* buf = NULL, *tmpstr = NULL, *helppath = NULL, *lang = NULL, *cmd = NULL;
5155
5156//      if(fmt == 0)
5157//      {
5158                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5159                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5160                buf = ostrcat(buf, "</head><body class=body id=\"helpchoices\"><center>", 1, 0);
5161                buf = ostrcat(buf, "<br>", 1, 0);
5162                buf = ostrcat(buf, "<h1>", 1, 0);
5163                buf = ostrcat(buf, _("Help"), 1, 0);
5164                buf = ostrcat(buf, "</h1>", 1, 0);
5165                buf = ostrcat(buf, "<br>", 1, 0);
5166//      }
5167
5168        helppath = getconfig("helppath", NULL);
5169        if(helppath == NULL) return NULL;
5170
5171        //get language
5172        lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0);
5173        lang = string_replace("po/", "", lang, 1);
5174
5175        //create full filename
5176        cmd = ostrcat("ls -1 ", helppath, 0, 0);
5177        cmd = ostrcat(cmd, "/", 1, 0);
5178        cmd = ostrcat(cmd, lang, 1, 1);
5179        cmd = ostrcat(cmd, "/", 1, 0);
5180
5181        debug(10, "cmd: %s", cmd);
5182        tmpstr = command(cmd);
5183
5184        int count, i, max;
5185        count = 0;
5186        struct splitstr* ret1 = NULL;
5187        ret1 = strsplit(tmpstr, "\n", &count);
5188        max = count - 1;
5189
5190        buf = ostrcat(buf, "<table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
5191
5192        if(ret1 != NULL)
5193        {
5194                for(i = 0; i <= max; i++)
5195                {
5196                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gethelp&", 1, 0);
5197                        buf = ostrcat(buf, stringreplacecharonce(ret1[i].part, '.', '\0'), 1, 0);
5198                        buf = ostrcat(buf, " target=main>", 1, 0);
5199                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
5200                        buf = ostrcat(buf, "</a>", 1, 0);
5201                        buf = ostrcat(buf, "</br></br>", 1, 0);
5202                }
5203        }
5204
5205// segfault ??
5206//      free(helppath), helppath = NULL;
5207        free(ret1), ret1 = NULL;
5208
5209        free(tmpstr), tmpstr = NULL;
5210        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5211
5212//      if(fmt == 0)
5213                buf = ostrcat(buf, "</td></tr></table></center></body></html>", 1, 0);
5214
5215        return buf;
5216}
5217
5218char* webgettestpage(char* param, int fmt)
5219{
5220        char* buf = NULL, *tmpstr = NULL;
5221        if(param == NULL) return NULL;
5222        if(status.security == 0) return NULL;
5223
5224//      if(fmt == 0)
5225//      {
5226                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5227                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5228                buf = ostrcat(buf, "</head><body class=body id=\"help\"><center>", 1, 0);
5229//      }
5230
5231        debug(10, "file: %s", param);
5232        tmpstr = readfiletomem(param, 1);
5233
5234        buf = ostrcat(buf, tmpstr, 1, 0);
5235
5236        free(tmpstr), tmpstr = NULL;
5237        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5238
5239//      if(fmt == 0)
5240                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5241
5242        debug(10, "buf: %s", buf);
5243
5244        return buf;
5245}
5246
5247char* webgetsysteminfos(char* param, int fmt)
5248{
5249        char* buf = NULL, *tmpstr = NULL;
5250        int mode;
5251
5252        mode = atoi(param);
5253        if(fmt == 0)
5254        {
5255                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5256                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5257                buf = ostrcat(buf, "</head><body class=body id=\"systeminfos\"><center>", 1, 0);
5258                buf = ostrcat(buf, "<br>", 1, 0);
5259                buf = ostrcat(buf, "<h1>", 1, 0);
5260                if(mode == 0)
5261                        buf = ostrcat(buf, _("System Status"), 1, 0);
5262                else if(mode == 1)
5263                        buf = ostrcat(buf, _("Free Space"), 1, 0);
5264                else if(mode == 2)
5265                        buf = ostrcat(buf, _("Kernel"), 1, 0);
5266                else if(mode == 3)
5267                        buf = ostrcat(buf, _("Mounts"), 1, 0);
5268                else if(mode == 4)
5269                        buf = ostrcat(buf, _("Network"), 1, 0);
5270                else if(mode == 5)
5271                        buf = ostrcat(buf, _("Ram"), 1, 0);
5272
5273                buf = ostrcat(buf, "</h1>", 1, 0);
5274                buf = ostrcat(buf, "<br>", 1, 0);
5275        }
5276
5277        tmpstr = system_infos(mode);
5278        tmpstr = string_replace_all("\n", "<br>", tmpstr, 1);
5279
5280        buf = ostrcat(buf, tmpstr, 1, 0);
5281
5282        free(tmpstr), tmpstr = NULL;
5283        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5284
5285        if(fmt == 0)
5286        {
5287                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5288        }
5289
5290        return buf;
5291}
5292
5293char* webgetsysinfos(char* param, int fmt)
5294{
5295        char* buf = NULL, *tmpstr = NULL;
5296        int mode;
5297
5298        mode = atoi(param);
5299        if(fmt == 0)
5300        {
5301                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5302                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5303                buf = ostrcat(buf, "</head><body class=body id=\"sysinfos\"><center>", 1, 0);
5304                buf = ostrcat(buf, "<br>", 1, 0);
5305                buf = ostrcat(buf, "<h1>", 1, 0);
5306                if(mode == 0)
5307                        buf = ostrcat(buf, _("CPU"), 1, 0);
5308                else if(mode == 1)
5309                        buf = ostrcat(buf, _("Memory"), 1, 0);
5310                else if(mode == 2)
5311                        buf = ostrcat(buf, _("MTD"), 1, 0);
5312                else if(mode == 3)
5313                        buf = ostrcat(buf, _("Module"), 1, 0);
5314                else if(mode == 4)
5315                        buf = ostrcat(buf, _("Devices"), 1, 0);
5316                else if(mode == 5)
5317                        buf = ostrcat(buf, _("Swap"), 1, 0);
5318                else if(mode == 6)
5319                        buf = ostrcat(buf, _("Top"), 1, 0);
5320                else if(mode == 7)
5321                        buf = ostrcat(buf, _("Prozesslist"), 1, 0);
5322                else if(mode == 8)
5323                        buf = ostrcat(buf, _("USB"), 1, 0);
5324
5325                buf = ostrcat(buf, "</h1>", 1, 0);
5326                buf = ostrcat(buf, "<br>", 1, 0);
5327        }
5328
5329        tmpstr = system_infos_sysinfo(mode);
5330        tmpstr = string_replace_all("\n", "<br>", tmpstr, 1);
5331
5332        buf = ostrcat(buf, tmpstr, 1, 0);
5333
5334        free(tmpstr), tmpstr = NULL;
5335        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5336
5337        if(fmt == 0)
5338        {
5339                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5340        }
5341
5342        return buf;
5343}
5344
5345char* webgetlogs(char* param, int fmt)
5346{
5347        char* buf = NULL, *tmpstr = NULL;
5348        int mode;
5349
5350        mode = atoi(param);
5351        if(fmt == 0)
5352        {
5353                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5354                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5355                buf = ostrcat(buf, "</head><body class=body id=\"logs\"><center>", 1, 0);
5356                buf = ostrcat(buf, "<br>", 1, 0);
5357                buf = ostrcat(buf, "<h1>", 1, 0);
5358                if(mode == 0)
5359                        buf = ostrcat(buf, _("Hotline"), 1, 0);
5360                else if(mode == 1)
5361                        buf = ostrcat(buf, _("Svn Changelog"), 1, 0);
5362                else if(mode == 2)
5363                        buf = ostrcat(buf, _("Git Changelog"), 1, 0);
5364                else if(mode == 3)
5365                        buf = ostrcat(buf, _("Titan Log"), 1, 0);
5366                else if(mode == 4)
5367                        buf = ostrcat(buf, _("Svn Changelog Full"), 1, 0);
5368                else if(mode == 5)
5369                        buf = ostrcat(buf, _("Git Changelog Full"), 1, 0);
5370
5371                buf = ostrcat(buf, "</h1>", 1, 0);
5372                buf = ostrcat(buf, "<br>", 1, 0);
5373        }
5374
5375        tmpstr = system_logs(mode);
5376        tmpstr = string_replace_all("\n", "<br>", tmpstr, 1);
5377
5378        buf = ostrcat(buf, tmpstr, 1, 0);
5379
5380        free(tmpstr), tmpstr = NULL;
5381        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5382
5383        if(fmt == 0)
5384        {
5385                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5386        }
5387
5388        return buf;
5389}
5390
5391char* webgetabout(int fmt)
5392{
5393        char* buf = NULL, *tmpstr = NULL;
5394
5395        if(fmt == 0)
5396        {
5397                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5398                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5399                buf = ostrcat(buf, "</head><body class=body id=\"about\"><center>", 1, 0);
5400                buf = ostrcat(buf, "<br>", 1, 0);
5401                buf = ostrcat(buf, "<h1>", 1, 0);
5402                buf = ostrcat(buf, _("About"), 1, 0);
5403                buf = ostrcat(buf, "</h1>", 1, 0);
5404                buf = ostrcat(buf, "<br>", 1, 0);
5405        }
5406
5407        tmpstr = getabout();
5408        tmpstr = string_replace_all("\n", "<br>", tmpstr, 1);
5409
5410        buf = ostrcat(buf, tmpstr, 1, 0);
5411
5412        free(tmpstr), tmpstr = NULL;
5413        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5414
5415        if(fmt == 0)
5416        {
5417                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5418        }
5419
5420        return buf;
5421}
5422
5423char* webgetnewsletterchoices(int fmt)
5424{
5425        char* buf = NULL;
5426
5427        if(fmt == 0)
5428        {
5429                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5430                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5431                buf = ostrcat(buf, "</head><body class=body id=\"newsletterchoices\"><center>", 1, 0);
5432                buf = ostrcat(buf, "<br>", 1, 0);
5433                buf = ostrcat(buf, "<h1>", 1, 0);
5434                buf = ostrcat(buf, _("Newsletter"), 1, 0);
5435                buf = ostrcat(buf, "</h1>", 1, 0);
5436                buf = ostrcat(buf, "<br>", 1, 0);
5437        }
5438
5439        buf = ostrcat(buf, "<table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
5440
5441        struct newsletter* node = NULL;
5442
5443        m_lock(&status.newslettermutex, 19);
5444        long unsigned lastnewsletter = getconfiglu("lastnewsletter", NULL);
5445
5446        readnewsletter();
5447        node = newsletter;
5448
5449        while(node != NULL)
5450        {
5451                buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getnewsletter&", 1, 0);
5452                buf = ostrcat(buf, oitoa(node->nr), 1, 0);
5453                buf = ostrcat(buf, " target=main>", 1, 0);
5454                buf = ostrcat(buf, node->title, 1, 0);
5455                buf = ostrcat(buf, " - ", 1, 0);
5456                buf = ostrcat(buf, node->date, 1, 0);
5457                buf = ostrcat(buf, "</a>", 1, 0);
5458                buf = ostrcat(buf, "</br></br>", 1, 0);
5459
5460                if(node->nr > lastnewsletter)
5461                        addconfiglu("lastnewsletter", node->nr);
5462
5463                node = node->next;
5464        }
5465
5466        freenewsletter();
5467        m_unlock(&status.newslettermutex, 19);
5468
5469        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5470
5471        if(fmt == 0)
5472                buf = ostrcat(buf, "</td></tr></table></center></body></html>", 1, 0);
5473
5474        return buf;
5475}
5476
5477char* webgetnewsletter(char* param, int fmt)
5478{
5479        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
5480
5481//      if(fmt == 0)
5482//      {
5483                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5484                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5485                buf = ostrcat(buf, "</head><body class=body id=\"newsletter\"><center>", 1, 0);
5486//      }
5487
5488        struct newsletter* node = NULL;
5489
5490        m_lock(&status.newslettermutex, 19);
5491
5492        readnewsletter();
5493        node = newsletter;
5494
5495        while(node != NULL)
5496        {
5497                if(ostrcmp(oitoa(node->nr), param) == 0)
5498                {
5499                        tmpstr1 = ostrcat(node->title, " - ", 0, 0);
5500                        tmpstr1 = ostrcat(tmpstr1, node->date, 1, 0);
5501                        tmpstr = ostrcat(node->text, "\n", 0, 0);
5502                        break;
5503                }
5504                node = node->next;
5505        }
5506
5507//      if(fmt == 0)
5508//      {
5509                buf = ostrcat(buf, "<br>", 1, 0);
5510                buf = ostrcat(buf, "<h1>", 1, 0);
5511                buf = ostrcat(buf, tmpstr1, 1, 0);
5512                buf = ostrcat(buf, "</h1>", 1, 0);
5513                buf = ostrcat(buf, "<br>", 1, 0);
5514//      }
5515
5516
5517        freenewsletter();
5518        m_unlock(&status.newslettermutex, 19);
5519
5520        tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
5521
5522        buf = ostrcat(buf, tmpstr, 1, 0);
5523
5524        free(tmpstr), tmpstr = NULL;
5525        free(tmpstr1), tmpstr1 = NULL;
5526        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5527
5528//      if(fmt == 0)
5529                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5530
5531        return buf;
5532}
5533
5534char* webgetstreamingchoices(int fmt)
5535{
5536        char* buf = NULL, *tmpstr = NULL;
5537
5538        if(fmt == 0)
5539        {
5540                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5541                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5542                buf = ostrcat(buf, "</head><body class=body id=\"streamingchoices\"><center>", 1, 0);
5543                buf = ostrcat(buf, "<br>", 1, 0);
5544                buf = ostrcat(buf, "<h1>", 1, 0);
5545                buf = ostrcat(buf, _("Streaming"), 1, 0);
5546                buf = ostrcat(buf, "</h1>", 1, 0);
5547                buf = ostrcat(buf, "<br>", 1, 0);
5548        }
5549
5550        int count = 0;
5551        struct service* servicenode = service;
5552
5553        while(servicenode != NULL)
5554        {
5555                if(servicenode->type == RECORDSTREAM && servicenode->recname != NULL)
5556                {
5557                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getstreaming&", 1, 0);
5558                        tmpstr = htmlencode(servicenode->recname);
5559                        buf = ostrcat(buf, tmpstr, 1, 0);
5560                        buf = ostrcat(buf, " target=main>", 1, 0);
5561                        buf = ostrcat(buf, _("stop"), 1, 0);
5562                        buf = ostrcat(buf, " - ", 1, 0);
5563                        buf = ostrcat(buf, servicenode->recname, 1, 0);
5564                        buf = ostrcat(buf, " (", 1, 0);
5565                        if(servicenode->channel != NULL && servicenode->channel->name != NULL)
5566                                buf = ostrcat(buf, servicenode->channel->name, 1, 0);
5567                        else
5568                                buf = ostrcat(buf, _("unknown"), 1, 0);
5569                        buf = ostrcat(buf, ")", 1, 0);
5570                        buf = ostrcat(buf, "</a>", 1, 0);
5571                        buf = ostrcat(buf, "</br></br>", 1, 0);
5572                        count++;
5573                        free(tmpstr), tmpstr = NULL;
5574                }
5575                servicenode = servicenode->next;
5576        }
5577
5578        if(count == 0)
5579                buf = ostrcat(buf, _("No Live Stream running"), 1, 0);
5580
5581        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5582
5583        if(fmt == 0)
5584                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5585
5586        return buf;
5587}
5588
5589char* webgetstreaming(char* param, int fmt)
5590{
5591        char* buf = NULL, *tmpstr = NULL;
5592
5593//      if(fmt == 0)
5594//      {
5595                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5596                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5597                buf = ostrcat(buf, "</head><body class=body id=\"streaming\"><center>", 1, 0);
5598//      }
5599
5600        htmldecode(param, param);
5601
5602        struct service* servicenode = service;
5603        while(servicenode != NULL)
5604        {
5605                if(servicenode->recname != NULL && ostrcmp(servicenode->recname, param) == 0)
5606                {
5607                        tmpstr = ostrcat(tmpstr, _("stop"), 1, 0);
5608                        tmpstr = ostrcat(tmpstr, " ", 1, 0);
5609                        tmpstr = ostrcat(tmpstr, servicenode->recname, 1, 0);
5610                        tmpstr = ostrcat(tmpstr, " (", 1, 0);
5611                        if(servicenode->channel != NULL && servicenode->channel->name != NULL)
5612                                tmpstr = ostrcat(tmpstr, servicenode->channel->name, 1, 0);
5613                        else
5614                                tmpstr = ostrcat(tmpstr, _("unknown"), 1, 0);
5615                        tmpstr = ostrcat(tmpstr, ")", 1, 0);
5616                        break;
5617                }
5618                servicenode = servicenode->next;
5619        }
5620
5621//      if(fmt == 0)
5622//      {
5623                buf = ostrcat(buf, "<br>", 1, 0);
5624                buf = ostrcat(buf, "<h1>", 1, 0);
5625                buf = ostrcat(buf, tmpstr, 1, 0);
5626                buf = ostrcat(buf, "</h1>", 1, 0);
5627                buf = ostrcat(buf, "<br>", 1, 0);
5628//      }
5629
5630        servicenode = getrecordbyname(param, RECORDSTREAM);
5631        if(servicenode != NULL)
5632        {
5633                servicenode->recendtime = 1;
5634                buf = ostrcat(buf, _("Streaming succesfull stopped."), 1, 0);
5635        }
5636        else
5637                buf = ostrcat(buf, _("ERROR, Streaming can not be stopped."), 1, 0);
5638
5639        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5640        free(tmpstr) , tmpstr = NULL;
5641
5642//      if(fmt == 0)
5643                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5644
5645        return buf;
5646}
5647
5648char* webgetupdatelist(char* param, int fmt)
5649{
5650        if(status.security == 0) return NULL;
5651
5652        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *cmd = NULL;
5653        int mode;
5654
5655        mode = atoi(param);
5656
5657        struct update* node = createupdatelist(mode);
5658
5659        if(fmt == 0)
5660        {
5661                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5662                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5663                buf = ostrcat(buf, "</head><body class=body id=\"updatelist\">", 1, 0);
5664                buf = ostrcat(buf, "<br><center>", 1, 0);
5665                buf = ostrcat(buf, "<h1>", 1, 0);
5666                buf = ostrcat(buf, _("System Update"), 1, 0);
5667                buf = ostrcat(buf, "</h1>", 1, 0);
5668                buf = ostrcat(buf, "<br>", 1, 0);
5669        }
5670
5671        tmpstr = getimgnamereal();
5672        if(tmpstr != NULL)
5673        {
5674                buf = ostrcat(buf, _("Installed:"), 1, 0);
5675                buf = ostrcat(buf, " ", 1, 0);
5676                buf = ostrcat(buf, tmpstr, 1, 1);
5677                buf = ostrcat(buf, "<br><br>", 1, 0);
5678        }
5679
5680        if(checkrealbox("DM7020HD") == 1 || checkbox("DM7020HDV2") == 1)
5681        {
5682                if(mode == 0)
5683                        tmpstr = command("ls -1 /tmp/online | grep .nfi | sort -r");
5684                else
5685                {
5686                        if(file_exist("/var/backup"))
5687                                tmpstr = command("ls -1 /var/backup/ | grep .nfi | sort -r");
5688                        else
5689                                tmpstr = command("ls -1 /tmp | grep .nfi | sort -r");
5690                }
5691        }
5692        else if(checkbox("DM900") == 1)
5693        {
5694                if(mode == 0)
5695                        tmpstr = command("ls -1 /tmp/online | grep *.zip | sort -r");
5696                else
5697                {
5698                        if(file_exist("/var/backup"))
5699                                tmpstr = command("ls -1 /var/backup/ | grep *.zip | sort -r");
5700                        else
5701                                tmpstr = command("ls -1 /tmp | grep *.zip | sort -r");
5702                }
5703        }
5704        else
5705        {
5706                if(mode == 0)
5707                        tmpstr = command("ls -1 /tmp/online | grep .img | sort -r");
5708                else
5709                {
5710                        if(file_exist("/var/backup"))
5711                                tmpstr = command("ls -1 /var/backup/ | grep .img | sort -r");
5712                        else
5713                                tmpstr = command("ls -1 /tmp | grep .img | sort -r");
5714                }
5715        }
5716
5717        int count, i, max;
5718        count = 0;
5719        struct splitstr* ret1 = NULL;
5720        ret1 = strsplit(tmpstr, "\n", &count);
5721        max = count - 1;
5722
5723        buf = ostrcat(buf, "<table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
5724
5725        if(ret1 != NULL)
5726        {
5727                for(i = 0; i <= max; i++)
5728                {
5729                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getupdate&", 1, 0);
5730
5731                        if(ostrstr(ret1[i].part, "_FULL_") != NULL || ostrstr(ret1[i].part, "_FULLBACKUP.") != NULL || ostrstr(ret1[i].part, "_UPDATENFI_") != NULL)
5732                        {
5733                                if(checkrealbox("DM900") == 1)
5734                                        cmd = ostrcat(cmd, "/sbin/update2.sh ", 1, 0);
5735                                else
5736                                        cmd = ostrcat(cmd, "/sbin/update.sh ", 1, 0);
5737                                cmd = ostrcat(cmd, node->type, 1, 0);
5738                                cmd = ostrcat(cmd, " ", 1, 0);
5739
5740                                if(ostrstr(ret1[i].part, "_FULL_") != NULL)
5741                                        cmd = ostrcat(cmd, "full ", 1, 0);
5742                                else if(ostrstr(ret1[i].part, "_FULLBACKUP.") != NULL)
5743                                        cmd = ostrcat(cmd, "fullbackup ", 1, 0);
5744                                else if(ostrstr(ret1[i].part, "_UPDATENFI_") != NULL)
5745                                        cmd = ostrcat(cmd, "updatenfi ", 1, 0);
5746
5747                                if(mode == 0)
5748                                        cmd = ostrcat(cmd, "/tmp/online/", 1, 0);
5749                                else
5750                                        cmd = ostrcat(cmd, "/tmp/", 1, 0);
5751                                cmd = ostrcat(cmd, ret1[i].part, 1, 0);
5752
5753                                cmd = ostrcat(cmd, node->auth, 1, 0);
5754                                if(node->imgtype == 1)
5755                                        cmd = ostrcat(cmd, " dev beta.dyndns.tv", 1, 0);
5756                                else
5757                                        cmd = ostrcat(cmd, " release atemio.dyndns.tv", 1, 0);
5758                                if(file_exist("/var/swap"))
5759                                {
5760                                        if(!file_exist("/var/swap/logs"))
5761                                                 mkdir("/var/swap/logs", 777);
5762
5763                                        if(file_exist("/etc/.beta") && file_exist("/var/swap/logs"))
5764                                                cmd = ostrcat(cmd, " > /var/swap/logs/update_debug.log 2>&1", 1, 0);
5765                                }
5766                                else if(checkbox("ATEMIO510") != 1 && checkbox("UFS910") != 1 && checkbox("UFS922") != 1 && checkbox("ATEVIO700") != 1 && checkbox("ATEVIO7000") != 1 && checkbox("IPBOX91") != 1 && checkbox("IPBOX900") != 1 && checkbox("IPBOX910") != 1 && checkbox("IPBOX9000") != 1)
5767                                {
5768                                        if(!file_exist("/mnt/logs"))
5769                                                 mkdir("/mnt/logs", 777);
5770
5771                                        if(file_exist("/etc/.beta") && file_exist("/mnt/logs"))
5772                                                cmd = ostrcat(cmd, " > /mnt/logs/update_debug.log 2>&1", 1, 0);
5773                                }
5774                                tmpstr1 = htmlencode(cmd);
5775                                buf = ostrcat(buf, tmpstr1, 1, 0);
5776                                free(tmpstr1), tmpstr1 = NULL;
5777                                free(cmd), cmd = NULL;
5778                        }
5779
5780                        buf = ostrcat(buf, " target=main>", 1, 0);
5781//                      buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
5782                        buf = ostrcat(buf, ret1[i].part, 1, 0);
5783                        buf = ostrcat(buf, "</a>", 1, 0);
5784                        buf = ostrcat(buf, "</br></br>", 1, 0);
5785                }
5786        }
5787
5788        free(tmpstr), tmpstr = NULL;
5789        free(ret1), ret1 = NULL;
5790
5791        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5792
5793        if(fmt == 0)
5794                buf = ostrcat(buf, "</td></tr></table></center></body></html>", 1, 0);
5795
5796// needed ??
5797//      freeupdatelist(node);
5798
5799        return buf;
5800}
5801
5802char* webgetupdate(char* param, int fmt)
5803{
5804        if(status.security == 0) return NULL;
5805
5806        char* buf = NULL, *cmd = NULL;
5807        printf("param: %s\n",param);
5808
5809//      if(fmt == 0)
5810//      {
5811                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5812                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5813                buf = ostrcat(buf, "</head><body class=body id=\"updatelist\"><center>", 1, 0);
5814                buf = ostrcat(buf, "<br>", 1, 0);
5815                buf = ostrcat(buf, "<h1 id=\"updatetitle\">", 1, 0);
5816                buf = ostrcat(buf, _("System Update"), 1, 0);
5817                buf = ostrcat(buf, "</h1>", 1, 0);
5818                buf = ostrcat(buf, "<br>", 1, 0);
5819//      }
5820
5821        writeallconfig(1);
5822
5823        cmd = htmlencode(param);
5824
5825        buf = ostrcat(buf, "<title>", 1, 0);
5826        buf = ostrcat(buf, _("Message"), 1, 0);
5827        buf = ostrcat(buf, "</title>\n", 1, 0);
5828        buf = ostrcat(buf, " <script type=\"text/javascript\">\n", 1, 0);
5829        buf = ostrcat(buf, "var bRepeat=confirm(\"", 1, 0);
5830        buf = ostrcat(buf, _("starting Full Update ?"), 1, 0);
5831        buf = ostrcat(buf, "\");\n", 1, 0);
5832        buf = ostrcat(buf, "if(bRepeat==true)\n", 1, 0);
5833        buf = ostrcat(buf, "{\n", 1, 0);
5834        buf = ostrcat(buf, "document.getElementById(\"updatetitle\").innerHTML = \"", 1, 0);
5835        buf = ostrcat(buf, _("System Update started. This can take up to 5 minutes. More details on TV."), 1, 0);
5836        buf = ostrcat(buf, "\";\n", 1, 0);
5837        buf = ostrcat(buf, "window.location = \"../queryraw?getsystem&", 1, 0);
5838        buf = ostrcat(buf, cmd, 1, 0);
5839        buf = ostrcat(buf, "\";\n", 1, 0);
5840        buf = ostrcat(buf, "}\n", 1, 0);
5841        buf = ostrcat(buf, "else\n", 1, 0);
5842        buf = ostrcat(buf, "alert(\"exit\");\n", 1, 0);
5843        buf = ostrcat(buf, "</script>\n", 1, 0);
5844
5845        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5846
5847        free(cmd), cmd = NULL;
5848
5849//      if(fmt == 0)
5850                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5851
5852        return buf;
5853}
5854
5855char* webgettpksection(int fmt)
5856{
5857        if(status.security == 0) return NULL;
5858
5859        char* buf = NULL;
5860
5861        if(fmt == 0)
5862        {
5863                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5864                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5865                buf = ostrcat(buf, "</head><body class=body id=\"tpksection\"><center>", 1, 0);
5866                buf = ostrcat(buf, "<br>", 1, 0);
5867                buf = ostrcat(buf, "<h1>", 1, 0);
5868                buf = ostrcat(buf, _("Tpk Install - select section"), 1, 0);
5869                buf = ostrcat(buf, "</h1>", 1, 0);
5870                buf = ostrcat(buf, "<br>", 1, 0);
5871        }
5872
5873        status.hangtime = 99999;
5874
5875        unlink(TPKLOG);
5876        tpkgetindex(0);
5877        tpklist();
5878
5879        struct tpk* node = tpk;
5880
5881        if(node == NULL) buf = ostrcat(buf, _("No Tpk Sections Found."), 1, 0);
5882
5883        while(node != NULL)
5884        {
5885                if(findsectiondone(node->section) == 1)
5886                {
5887                        node = node->next;
5888                        continue;
5889                }
5890
5891                node->done = 1;
5892
5893                buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gettpklist&", 1, 0);
5894                buf = ostrcat(buf, node->section, 1, 0);
5895                buf = ostrcat(buf, " target=main>", 1, 0);
5896                buf = ostrcat(buf, _(node->section), 1, 0);
5897                buf = ostrcat(buf, "</a>", 1, 0);
5898                buf = ostrcat(buf, "</br></br>", 1, 0);
5899
5900                node = node->next;
5901        }
5902
5903        freetpk();
5904
5905        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5906
5907        if(fmt == 0)
5908        {
5909                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5910        }
5911
5912        tpkcleantmp(0);
5913        status.hangtime = getconfigint("hangtime", NULL);
5914
5915        return buf;
5916}
5917
5918char* webgettpklist(char* param, int fmt)
5919{
5920        if(status.security == 0) return NULL;
5921        int skip = 0;
5922
5923        char* buf = NULL;
5924
5925//      if(fmt == 0)
5926//      {
5927                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
5928                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
5929                buf = ostrcat(buf, "</head><body class=body id=\"tpklist\"><center>", 1, 0);
5930                buf = ostrcat(buf, "<br>", 1, 0);
5931                buf = ostrcat(buf, "<h1>", 1, 0);
5932                buf = ostrcat(buf, _("Tpk Install - select file"), 1, 0);
5933                buf = ostrcat(buf, "</h1>", 1, 0);
5934                buf = ostrcat(buf, "<br>", 1, 0);
5935//      }
5936
5937        status.hangtime = 99999;
5938
5939        unlink(TPKLOG);
5940        tpkgetindex(0);
5941        tpklist();
5942
5943        struct tpk* node = tpk, *tpk_installed = NULL, *node_installed = NULL;
5944
5945        if(node == NULL) buf = ostrcat(buf, _("No Tpk Files Found."), 1, 0);
5946
5947        tpk = NULL;
5948        tpklistinstalled(0);
5949        tpk_installed = tpk;
5950        tpk = node;
5951
5952        while(node != NULL)
5953        {
5954                node_installed = tpk_installed;
5955                skip = 0;
5956                while(node_installed != NULL)
5957                {
5958                        if(ostrcmp(node->section, node_installed->section) == 0 && ostrcmp(node->showname, node_installed->showname) == 0)
5959                        {
5960                                skip = 1;
5961                                break;
5962                        }
5963                        node_installed = node_installed->next;
5964                }
5965
5966                //check if tpk is in section
5967                if(param != NULL && ostrcmp(node->section, param) != 0)
5968                        skip = 1;
5969
5970                if(skip == 1)
5971                {
5972                        node = node->next;
5973                        continue;
5974                }
5975
5976                buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gettpkinstallpath&", 1, 0);
5977                buf = ostrcat(buf, node->filename, 1, 0);
5978                buf = ostrcat(buf, " target=main>", 1, 0);
5979                buf = ostrcat(buf, _(node->showname), 1, 0);
5980                buf = ostrcat(buf, " v.", 1, 0);
5981                buf = ostrcat(buf, oitoa(node->version), 1, 1);
5982                buf = ostrcat(buf, "</a>", 1, 0);
5983                buf = ostrcat(buf, "</br></br>", 1, 0);
5984
5985                node = node->next;
5986        }
5987
5988        freetpk();
5989        tpkcleantmp(0);
5990        status.hangtime = getconfigint("hangtime", NULL);
5991
5992        buf = string_replace_all("<br>", "<br>\n", buf, 1);
5993
5994//      if(fmt == 0)
5995//      {
5996                buf = ostrcat(buf, "</center></body></html>", 1, 0);
5997//      }
5998
5999        return buf;
6000}
6001
6002char* webgettpkinstallpath(char* param, int fmt)
6003{
6004        if(status.security == 0) return NULL;
6005
6006        char* buf = NULL, *tmpstr = NULL, *path = NULL, *url = NULL, *showname = NULL;
6007        int count = 0, size = 0;
6008
6009        status.hangtime = 99999;
6010
6011        unlink(TPKLOG);
6012        tpkgetindex(0);
6013        tpklist();
6014
6015        struct tpk* node = tpk;
6016
6017        while(node != NULL)
6018        {
6019                if(ostrcmp(node->filename, param) == 0)
6020                {
6021                        size = node->size;
6022                        showname = ostrcat(node->showname, NULL, 0, 0);
6023                        url = htmlencode(node->url);
6024                        path = ostrcat(node->usepath, NULL, 0, 0);
6025                        break;
6026                }
6027                node = node->next;
6028        }
6029
6030//      if(fmt == 0)
6031//      {
6032                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6033                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6034                buf = ostrcat(buf, "</head><body class=body id=\"tpkinstallpath\"><center>", 1, 0);
6035                buf = ostrcat(buf, "<br>", 1, 0);
6036                buf = ostrcat(buf, "<h1>", 1, 0);
6037                buf = ostrcat(buf, _("Choice Install Medium"), 1, 0);
6038                buf = ostrcat(buf, "</h1>", 1, 0);
6039                buf = ostrcat(buf, "<br>", 1, 0);
6040//      }
6041
6042        if(path == NULL || path[0] == '*' || ostrstr(path, "mnt") != NULL)
6043        {
6044                if(tpkchecksize(NULL, "/mnt/swapextensions", size) == 0)
6045                {
6046                        tmpstr = ostrcat(tmpstr, "<a class=linelink2 href=queryraw?gettpkinstall&", 1, 0);
6047                        tmpstr = ostrcat(tmpstr, param, 1, 0);
6048                        tmpstr = ostrcat(tmpstr, "&", 1, 0);
6049                        tmpstr = ostrcat(tmpstr, url, 1, 0);
6050                        tmpstr = ostrcat(tmpstr, "&", 1, 0);
6051                        tmpstr = ostrcat(tmpstr, "/mnt/swapextensions", 1, 0);
6052                        tmpstr = ostrcat(tmpstr, " target=main>", 1, 0);
6053                        tmpstr = ostrcat(tmpstr, _("Install to MNT"), 1, 0);
6054                        tmpstr = ostrcat(tmpstr, "</a>\n", 1, 0);
6055                        tmpstr = ostrcat(tmpstr, "</br></br>\n", 1, 0);
6056                        count++;
6057                }
6058        }
6059
6060        if(path == NULL || path[0] == '*' || ostrstr(path, "var") != NULL)
6061        {
6062                if(tpkchecksize(NULL, "/var", size) == 0)
6063                {
6064                        tmpstr = ostrcat(tmpstr, "<a class=linelink2 href=queryraw?gettpkinstall&", 1, 0);
6065                        tmpstr = ostrcat(tmpstr, param, 1, 0);
6066                        tmpstr = ostrcat(tmpstr, "&", 1, 0);
6067                        tmpstr = ostrcat(tmpstr, url, 1, 0);
6068                        tmpstr = ostrcat(tmpstr, "&", 1, 0);
6069                        tmpstr = ostrcat(tmpstr, "/var", 1, 0);
6070                        tmpstr = ostrcat(tmpstr, " target=main>", 1, 0);
6071                        tmpstr = ostrcat(tmpstr, _("Install to FLASH"), 1, 0);
6072                        tmpstr = ostrcat(tmpstr, "</a>\n", 1, 0);
6073                        tmpstr = ostrcat(tmpstr, "</br></br>\n", 1, 0);
6074                        count++;
6075                }
6076        }
6077
6078        if(path == NULL || path[0] == '*' || ostrstr(path, "swap") != NULL)
6079        {
6080                if(file_exist("/tmp/.swapextensionsdev") == 1 || file_exist("/var/swap"))
6081                {
6082                        if(tpkchecksize(NULL, "/var/swap", size) == 0)
6083                        {
6084                                tmpstr = ostrcat(tmpstr, "<a class=linelink2 href=queryraw?gettpkinstall&", 1, 0);
6085                                tmpstr = ostrcat(tmpstr, param, 1, 0);
6086                                tmpstr = ostrcat(tmpstr, "&", 1, 0);
6087                                tmpstr = ostrcat(tmpstr, url, 1, 0);
6088                                tmpstr = ostrcat(tmpstr, "&", 1, 0);
6089                                tmpstr = ostrcat(tmpstr, "/var/swap", 1, 0);
6090                                tmpstr = ostrcat(tmpstr, " target=main>", 1, 0);
6091                                tmpstr = ostrcat(tmpstr, _("Install to SWAP"), 1, 0);
6092                                tmpstr = ostrcat(tmpstr, "</a>", 1, 0);
6093                                tmpstr = ostrcat(tmpstr, "</br></br>", 1, 0);
6094                                count++;
6095                        }
6096                }
6097        }
6098
6099        if(node == NULL && tmpstr == NULL) buf = ostrcat(buf, _("No Tpk Files Found."), 1, 0);
6100        freetpk();
6101
6102        if(count == 0)
6103        {
6104                buf = ostrcat(buf, "<br>", 1, 0);
6105                buf = ostrcat(buf, _("Can't install Package. Package to big."), 1, 0);
6106        }
6107
6108        buf = ostrcat(buf, tmpstr, 1, 0);
6109
6110        buf = string_replace_all("<br>", "<br>\n", buf, 1);
6111
6112        free(tmpstr), tmpstr = NULL;
6113        free(showname), showname = NULL;
6114        free(url), url = NULL;
6115        free(path), path = NULL;
6116
6117        tpkcleantmp(0);
6118        status.hangtime = getconfigint("hangtime", NULL);
6119
6120//      if(fmt == 0)
6121//      {
6122                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6123//      }
6124
6125        return buf;
6126}
6127
6128char* webgettpkinstall(char* param, int fmt)
6129{
6130        if(status.security == 0) return NULL;
6131
6132        char* buf = NULL, *tmpstr = NULL, *param1 = NULL, *param2 = NULL;
6133
6134        //create param1
6135        param1 = strchr(param, '&');
6136        if(param1 != NULL)
6137                *param1++ = '\0';
6138
6139        //create param2
6140        param2 = strchr(param1, '&');
6141        if(param2 != NULL)
6142                *param2++ = '\0';
6143
6144        if(param == NULL) return NULL;
6145        if(param1 == NULL) return NULL;
6146        if(param2 == NULL) return NULL;
6147
6148        status.hangtime = 99999;
6149
6150        char* log = NULL;
6151        int tpkret = tpkgetpackage(param, param1, param2, 0, 1);
6152
6153        if(tpkret == 0)
6154                tmpstr = ostrcat(_("Tpk Install Info - Install OK"), NULL, 0, 0);
6155        else if(tpkret == 2)
6156                tmpstr = ostrcat(_("Tpk Install Info - Install ERROR"), NULL, 0, 0);
6157        else
6158                tmpstr = ostrcat(_("Tpk Install Info - Install ERROR"), NULL, 0, 0);
6159
6160//      if(fmt == 0)
6161//      {
6162                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6163                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6164                buf = ostrcat(buf, "</head><body class=body id=\"tpkinstall\"><center>", 1, 0);
6165                buf = ostrcat(buf, "<br>", 1, 0);
6166                buf = ostrcat(buf, "<h1>", 1, 0);
6167                buf = ostrcat(buf, _(tmpstr), 1, 0);
6168                buf = ostrcat(buf, "</h1>", 1, 0);
6169                buf = ostrcat(buf, "<br>", 1, 0);
6170                buf = ostrcat(buf, "<br>", 1, 0);
6171//      }
6172
6173        free(tmpstr), tmpstr = NULL;
6174
6175        if(tpkret == 0)
6176        {
6177                log = gettpklog(param2, 0);
6178                log = string_replace_all("\n", "<br>\n", log, 1);
6179                buf = ostrcat(buf, "<br>", 1, 0);
6180                buf = ostrcat(buf, _("Install Log:"), 1, 0);
6181                buf = ostrcat(buf, "<br>", 1, 0);
6182                buf = ostrcat(buf, "<br>", 1, 0);
6183                buf = ostrcat(buf, log, 1, 0);
6184        }
6185        else if(tpkret == 2)
6186        {
6187                buf = ostrcat(buf, "<br>", 1, 0);
6188                buf = ostrcat(buf, _("Install Log:"), 1, 0);
6189                buf = ostrcat(buf, "<br>", 1, 0);
6190                buf = ostrcat(buf, "<br>", 1, 0);
6191                buf = ostrcat(buf, _("There may only be one package installed from this section. To install another package from this section, remove the installed one. If the package is not visible after a software update, perform a TPK update to: "), 1, 0);
6192        }
6193        else
6194        {
6195                log = gettpklog(param2, 1);
6196                log = string_replace_all("\n", "<br>\n", log, 1);
6197                buf = ostrcat(buf, "<br>", 1, 0);
6198                buf = ostrcat(buf, _("Install Log:"), 1, 0);
6199                buf = ostrcat(buf, "<br>", 1, 0);
6200                buf = ostrcat(buf, "<br>", 1, 0);
6201                buf = ostrcat(buf, log, 1, 0);
6202        }
6203
6204        buf = string_replace_all("<br>", "<br>\n", buf, 1);
6205
6206        loadplugin();
6207        free(log), log = NULL;
6208        unlink(TPKLOG);
6209        if(file_exist("/tmp/.tpk_needs_reboot"))
6210        {
6211// need other..
6212                textbox(_("Message"), _("TPK Install done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0);
6213                buf = ostrcat(buf, "<br>", 1, 0);
6214                buf = ostrcat(buf, _("TPK Install done, your system will reboot !"), 1, 0);
6215                buf = string_replace_all("<br>", "<br>\n", buf, 1);
6216                //write only config file
6217                writeallconfig(3);
6218                oshutdown(2,2);
6219                system("init 6");
6220        }
6221
6222        status.hangtime = getconfigint("hangtime", NULL);
6223
6224//      if(fmt == 0)
6225//      {
6226                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6227//      }
6228
6229        return buf;
6230}
6231
6232char* webgettpktmplist(char* param, int fmt)
6233{
6234        if(status.security == 0) return NULL;
6235        int mode = atoi(param);
6236
6237        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL;
6238
6239        if(fmt == 0)
6240        {
6241                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6242                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6243                buf = ostrcat(buf, "</head><body class=body id=\"tpktmplist\"><center>", 1, 0);
6244                buf = ostrcat(buf, "<br>", 1, 0);
6245                buf = ostrcat(buf, "<h1>", 1, 0);
6246                if(mode == 0)
6247                        buf = ostrcat(buf, _("TPK tmp (tmp)"), 1, 0);
6248                else
6249                        buf = ostrcat(buf, _("TPK media (media)"), 1, 0);
6250
6251                buf = ostrcat(buf, "</h1>", 1, 0);
6252                buf = ostrcat(buf, "<br>", 1, 0);
6253        }
6254
6255        if(mode == 0)
6256                tmpstr = gettpktmplist("/tmp");
6257        else
6258        {
6259                int treffer = 0;
6260                struct hdd *node = NULL;
6261
6262                addhddall();
6263                node = hdd;
6264
6265                while(node != NULL)
6266                {
6267                        if(node->partition != 0)
6268                        {
6269                                tmpstr1 = ostrcat("/autofs/", node->device, 0, 0);
6270                                tmpstr2 = gettpktmplist(tmpstr1);
6271
6272                                if(tmpstr2 != NULL)
6273                                {
6274                                        treffer = 1;
6275//                                      screenextensions(2, tmpstr1, NULL, 1);
6276                                        tmpstr3 = ostrcat(tmpstr3, tmpstr1, 1, 0);
6277                                        tmpstr3 = ostrcat(tmpstr3, "\n", 1, 0);
6278                                }
6279
6280                                free(tmpstr1); tmpstr1 = NULL;
6281                                free(tmpstr2); tmpstr2 = NULL;
6282                        }
6283                        node = node->next;
6284                }
6285
6286                tmpstr = gettpktmplist(tmpstr3);
6287                free(tmpstr3), tmpstr = NULL;
6288        }
6289
6290        if(mode == 0)
6291        {
6292                if(tmpstr == NULL) buf = ostrcat(buf, _("No Tpk Files Found on /tmp Directory."), 1, 0);
6293        }
6294        else
6295        {
6296                if(tmpstr == NULL) buf = ostrcat(buf, _("No Tpk Files Found on Media Devices."), 1, 0);
6297        }
6298
6299        int count, i, max;
6300        count = 0;
6301        struct splitstr* ret1 = NULL;
6302        ret1 = strsplit(tmpstr, "\n", &count);
6303        max = count - 1;
6304
6305        buf = ostrcat(buf, "<table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
6306
6307        if(ret1 != NULL)
6308        {
6309                for(i = 0; i <= max; i++)
6310                {
6311                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gettpkinstallpath&", 1, 0);
6312                        buf = ostrcat(buf, ret1[i].part, 1, 0);
6313                        buf = ostrcat(buf, " target=main>", 1, 0);
6314                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
6315                        buf = ostrcat(buf, "</a>", 1, 0);
6316                        buf = ostrcat(buf, "</br></br>", 1, 0);
6317                }
6318        }
6319
6320        free(tmpstr), tmpstr = NULL;
6321        free(ret1), ret1 = NULL;
6322
6323        buf = string_replace_all("<br>", "<br>\n", buf, 1);
6324
6325        if(fmt == 0)
6326        {
6327                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6328        }
6329
6330        return buf;
6331}
6332
6333char* webgettpkremovelist(int fmt)
6334{
6335        if(status.security == 0) return NULL;
6336
6337        char* buf = NULL;
6338        int skip;
6339
6340//      if(fmt == 0)
6341//      {
6342                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6343                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6344                buf = ostrcat(buf, "</head><body class=body id=\"tpkremovelist\"><center>", 1, 0);
6345                buf = ostrcat(buf, "<br>", 1, 0);
6346                buf = ostrcat(buf, "<h1>", 1, 0);
6347                buf = ostrcat(buf, _("Tpk Remove - select file"), 1, 0);
6348                buf = ostrcat(buf, "</h1>", 1, 0);
6349                buf = ostrcat(buf, "<br>", 1, 0);
6350//      }
6351
6352        status.hangtime = 99999;
6353
6354        unlink(TPKLOG);
6355        tpkgetindex(0);
6356        tpklist();
6357
6358        struct tpk* node = tpk, *tpk_installed = NULL, *node_installed = NULL;
6359
6360        if(node == NULL) buf = ostrcat(buf, _("No Tpk Files Found."), 1, 0);
6361
6362        tpk = NULL;
6363        tpklistinstalled(0);
6364        tpk_installed = tpk;
6365        tpk = node;
6366
6367        while(node != NULL)
6368        {
6369                node_installed = tpk_installed;
6370                skip = 1;
6371                while(node_installed != NULL)
6372                {
6373                        if(ostrcmp(node->showname, node_installed->showname) == 0)
6374                        {
6375                                skip = 0;
6376                                break;
6377                        }
6378                        node_installed = node_installed->next;
6379                }
6380
6381                if(skip == 1)
6382                {
6383                        node = node->next;
6384                        continue;
6385                }
6386
6387                buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gettpkremove&", 1, 0);
6388                buf = ostrcat(buf, node->name, 1, 0);
6389                buf = ostrcat(buf, " target=main>", 1, 0);
6390                buf = ostrcat(buf, _(node->showname), 1, 0);
6391                buf = ostrcat(buf, " (", 1, 0);
6392                buf = ostrcat(buf, _(node->section), 1, 0);
6393                buf = ostrcat(buf, ")</a>", 1, 0);
6394                buf = ostrcat(buf, "</br></br>", 1, 0);
6395
6396                node = node->next;
6397        }
6398
6399        freetpk();
6400        tpkcleantmp(0);
6401        status.hangtime = getconfigint("hangtime", NULL);
6402
6403        buf = string_replace_all("<br>", "<br>\n", buf, 1);
6404
6405//      if(fmt == 0)
6406//      {
6407                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6408//      }
6409
6410        return buf;
6411}
6412
6413char* webgettpkremove(char* param, int fmt)
6414{
6415        if(status.security == 0) return NULL;
6416
6417        char* buf = NULL, *tmpstr = NULL;
6418
6419        status.hangtime = 99999;
6420
6421        char* log = NULL;
6422
6423        int tpkret = tpkremove(param, 0, 0);
6424
6425        if(tpkret == 0)
6426        {
6427                tmpstr = ostrcat(_("Tpk Remove Info - Remove OK"), NULL, 0, 0);
6428                if(param != NULL && param[0] != '*') delplugin(param);
6429        }
6430        else
6431                tmpstr = ostrcat(_("Tpk Remove Info - Remove ERROR"), NULL, 0, 0);
6432
6433//      if(fmt == 0)
6434//      {
6435                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6436                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6437                buf = ostrcat(buf, "</head><body class=body id=\"tpkremove\"><center>", 1, 0);
6438                buf = ostrcat(buf, "<br>", 1, 0);
6439                buf = ostrcat(buf, "<h1>", 1, 0);
6440                buf = ostrcat(buf, _(tmpstr), 1, 0);
6441                buf = ostrcat(buf, "</h1>", 1, 0);
6442                buf = ostrcat(buf, "<br>", 1, 0);
6443                buf = ostrcat(buf, "<br>", 1, 0);
6444//      }
6445
6446        free(tmpstr), tmpstr = NULL;
6447
6448        if(tpkret == 0)
6449        {
6450                log = gettpklog(NULL, 2);
6451                log = string_replace_all("\n", "<br>\n", log, 1);
6452                buf = ostrcat(buf, "<br>", 1, 0);
6453                buf = ostrcat(buf, _("Remove Log:"), 1, 0);
6454                buf = ostrcat(buf, "<br>", 1, 0);
6455                buf = ostrcat(buf, "<br>", 1, 0);
6456                buf = ostrcat(buf, log, 1, 0);
6457        }
6458        else
6459        {
6460                log = gettpklog(NULL, 3);
6461                log = string_replace_all("\n", "<br>\n", log, 1);
6462                buf = ostrcat(buf, "<br>", 1, 0);
6463                buf = ostrcat(buf, _("Remove Log:"), 1, 0);
6464                buf = ostrcat(buf, "<br>", 1, 0);
6465                buf = ostrcat(buf, "<br>", 1, 0);
6466                buf = ostrcat(buf, log, 1, 0);
6467        }
6468
6469        buf = string_replace_all("<br>", "<br>\n", buf, 1);
6470
6471        loadplugin();
6472        free(log), log = NULL;
6473        unlink(TPKLOG);
6474        if(file_exist("/tmp/.tpk_needs_reboot"))
6475        {
6476// need other..
6477                textbox(_("Message"), _("TPK Remove done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0);
6478                buf = ostrcat(buf, "<br>", 1, 0);
6479                buf = ostrcat(buf, _("TPK Install done, your system will reboot !"), 1, 0);
6480                buf = string_replace_all("<br>", "<br>\n", buf, 1);
6481                //write only config file
6482                writeallconfig(3);
6483                oshutdown(2,2);
6484                system("init 6");
6485        }
6486
6487        status.hangtime = getconfigint("hangtime", NULL);
6488
6489//      if(fmt == 0)
6490//      {
6491                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6492//      }
6493
6494        return buf;
6495}
6496
6497char* webgettpkupgrade(int fmt)
6498{
6499        if(status.security == 0) return NULL;
6500
6501        char* buf = NULL;
6502
6503        status.hangtime = 99999;
6504
6505        if(fmt == 0)
6506        {
6507                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6508                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6509                buf = ostrcat(buf, "</head><body class=body id=\"tpkupgrade\"><center>", 1, 0);
6510        }
6511
6512        if(tpkgetindex(1) != 0)
6513        {
6514                buf = ostrcat(buf, "<br>", 1, 0);
6515                buf = ostrcat(buf, "<h1>", 1, 0);
6516                buf = ostrcat(buf, _("Tpk Update Info - Update ERROR"), 1, 0);
6517                buf = ostrcat(buf, "</h1>", 1, 0);
6518                buf = ostrcat(buf, "<br>", 1, 0);
6519                buf = ostrcat(buf, _("Can't get all TPK index !"), 1, 0);
6520                buf = ostrcat(buf, "<br>", 1, 0);
6521        }
6522
6523        writesys("/tmp/.tpk_upgrade_start", "0", 0);
6524        if(tpkupdate(0) != 0)
6525        {
6526                buf = ostrcat(buf, "<br>", 1, 0);
6527                buf = ostrcat(buf, "<h1>", 1, 0);
6528                buf = ostrcat(buf, _("Tpk Update Info - Update ERROR"), 1, 0);
6529                buf = ostrcat(buf, "</h1>", 1, 0);
6530                buf = ostrcat(buf, "<br>", 1, 0);
6531                buf = ostrcat(buf, _("Can't update all packages !"), 1, 0);
6532                buf = ostrcat(buf, "<br>", 1, 0);
6533        }
6534        else
6535        {
6536                buf = ostrcat(buf, "<br>", 1, 0);
6537                buf = ostrcat(buf, "<h1>", 1, 0);
6538                buf = ostrcat(buf, _("Tpk Update Info - Update OK"), 1, 0);
6539                buf = ostrcat(buf, "</h1>", 1, 0);
6540                buf = ostrcat(buf, "<br>", 1, 0);
6541        }
6542
6543        loadplugin();
6544        unlink(TPKLOG);
6545
6546        if(file_exist("/tmp/.tpk_needs_reboot"))
6547        {
6548                textbox(_("Message"), _("TPK Upgrade done, your system will reboot !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
6549                //write only config file
6550                writeallconfig(3);
6551                oshutdown(2,2);
6552                system("init 6");
6553        }
6554        unlink("/tmp/.tpk_upgrade_start");
6555
6556        status.hangtime = getconfigint("hangtime", NULL);
6557
6558        if(fmt == 0)
6559        {
6560                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6561        }
6562
6563        return buf;
6564}
6565
6566char* webgetserviceinfo(int fmt)
6567{
6568        char* buf = NULL, *tmpstr = NULL;
6569
6570        if(fmt == 0)
6571        {
6572                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6573                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6574                buf = ostrcat(buf, "</head><body class=body id=\"serviceinfo\"><center>", 1, 0);
6575                buf = ostrcat(buf, "<br>", 1, 0);
6576                buf = ostrcat(buf, "<h1>", 1, 0);
6577                buf = ostrcat(buf, _("Service"), 1, 0);
6578                buf = ostrcat(buf, "</h1>", 1, 0);
6579                buf = ostrcat(buf, "<br>", 1, 0);
6580        }
6581
6582//      tmpstr = getabout();
6583//      readnewsletter();
6584        tmpstr = readfiletomem("/tmp/Service.txt", 0);
6585        tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0);
6586
6587        tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
6588
6589        buf = ostrcat(buf, tmpstr, 1, 1);
6590
6591        if(fmt == 0)
6592        {
6593                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6594        }
6595
6596        return buf;
6597}
6598
6599char* webgetbackup(int fmt)
6600{
6601        if(status.security == 0) return NULL;
6602
6603        char* buf = NULL, *tmpstr = NULL;
6604
6605        if(fmt == 0)
6606        {
6607                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6608                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6609                buf = ostrcat(buf, "</head><body class=body id=\"backup\"><center>", 1, 0);
6610                buf = ostrcat(buf, "<br>", 1, 0);
6611                buf = ostrcat(buf, "<h1>", 1, 0);
6612                buf = ostrcat(buf, _("System Backup"), 1, 0);
6613                buf = ostrcat(buf, "</h1>", 1, 0);
6614                buf = ostrcat(buf, "<br>", 1, 0);
6615        }
6616
6617
6618        tmpstr = create_backup(NULL, 0);
6619
6620        tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
6621        buf = ostrcat(buf, tmpstr, 1, 1);
6622        buf = ostrcat(buf, "</br></br>", 1, 0);
6623        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getcreatebackup target=main>", 1, 0);
6624        buf = ostrcat(buf, _("create System Backup"), 1, 0);
6625        buf = ostrcat(buf, "</a>", 1, 0);
6626        buf = ostrcat(buf, "</br></br>", 1, 0);
6627
6628        if(fmt == 0)
6629        {
6630                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6631        }
6632
6633        return buf;
6634}
6635
6636char* webgetcreatebackup(int fmt)
6637{
6638        if(status.security == 0) return NULL;
6639
6640        char* buf = NULL, *tmpstr = NULL;
6641
6642        if(fmt == 0)
6643        {
6644                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6645                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6646                buf = ostrcat(buf, "</head><body class=body id=\"createbackup\"><center>", 1, 0);
6647                buf = ostrcat(buf, "<br>", 1, 0);
6648                buf = ostrcat(buf, "<h1>", 1, 0);
6649                buf = ostrcat(buf, _("create System Backup"), 1, 0);
6650                buf = ostrcat(buf, "</h1>", 1, 0);
6651                buf = ostrcat(buf, "<br>", 1, 0);
6652        }
6653
6654#ifdef MIPSEL
6655        tmpstr = ostrcat(tmpstr, _("System Backup on your Box not Supported"), 1, 0);
6656#else
6657        tmpstr = create_backup("full", 2);
6658        tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
6659        tmpstr = ostrcat(tmpstr, "<br>", 1, 0);
6660        tmpstr = ostrcat(tmpstr, _("Backup created successfully"), 1, 0);
6661#endif
6662        buf = ostrcat(buf, tmpstr, 1, 1);
6663
6664        if(fmt == 0)
6665        {
6666                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6667        }
6668        return buf;
6669}
6670
6671char* webgetrestore(int fmt)
6672{
6673        if(status.security == 0) return NULL;
6674
6675        char* buf = NULL, *tmpstr = NULL;
6676
6677        if(fmt == 0)
6678        {
6679                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6680                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6681                buf = ostrcat(buf, "</head><body class=body id=\"restore\"><center>", 1, 0);
6682                buf = ostrcat(buf, "<br>", 1, 0);
6683                buf = ostrcat(buf, "<h1>", 1, 0);
6684                buf = ostrcat(buf, _("Settings backup/restore"), 1, 0);
6685                buf = ostrcat(buf, "</h1>", 1, 0);
6686                buf = ostrcat(buf, "<br>", 1, 0);
6687        }
6688
6689        tmpstr = create_backuprestore();
6690
6691        tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
6692        buf = ostrcat(buf, tmpstr, 1, 1);
6693        buf = ostrcat(buf, "</br></br>", 1, 0);
6694        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getcreaterestore&1 target=main>", 1, 0);
6695        buf = ostrcat(buf, _("Restore"), 1, 0);
6696        buf = ostrcat(buf, "</a>", 1, 0);
6697        buf = ostrcat(buf, "</br></br>", 1, 0);
6698
6699        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getcreaterestore&2 target=main>", 1, 0);
6700        buf = ostrcat(buf, _("Backup"), 1, 0);
6701        buf = ostrcat(buf, "</a>", 1, 0);
6702        buf = ostrcat(buf, "</br></br>", 1, 0);
6703
6704        if(fmt == 0)
6705        {
6706                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6707        }
6708
6709        return buf;
6710}
6711/////////
6712char* webgetcreaterestore(char* param, int fmt)
6713{
6714        if(status.security == 0) return NULL;
6715
6716        char* buf = NULL, *tmpstr = NULL;
6717
6718        int mode = atoi(param);
6719
6720        if(mode == 1)
6721                tmpstr = command("/sbin/settings.sh restore");
6722
6723        if(mode == 2)
6724        {
6725                writeallconfig(1);
6726                tmpstr = command("/sbin/settings.sh backup");
6727        }
6728
6729//      if(fmt == 0)
6730//      {
6731        buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6732        buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6733        buf = ostrcat(buf, "</head><body class=body id=\"createrestore\"><center>", 1, 0);
6734        buf = ostrcat(buf, "<br>", 1, 0);
6735        buf = ostrcat(buf, "<h1>", 1, 0);
6736        if(tmpstr == NULL)
6737                buf = ostrcat(buf, _("No backup folders found!!!\n\nAborting restoring..."), 1, 0);
6738        else
6739                buf = ostrcat(buf, _("Backup created successfully"), 1, 0);
6740
6741        buf = ostrcat(buf, "</h1>", 1, 0);
6742        buf = ostrcat(buf, "<br>", 1, 0);
6743//      }
6744
6745        buf = ostrcat(buf, tmpstr, 1, 1);
6746
6747        buf = string_replace_all("\n", "<br>\n", buf, 1);
6748
6749//      if(fmt == 0)
6750//      {
6751                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6752//      }
6753
6754        return buf;
6755}
6756
6757char* webstartplugin(char* param, int fmt)
6758{
6759        void (*startplugin)(void);
6760        char* buf = NULL;
6761
6762        struct skin* pluginnode = getplugin(param);
6763
6764        if(pluginnode != NULL)
6765        {
6766                startplugin = dlsym(pluginnode->pluginhandle, "start");
6767                if(startplugin != NULL)
6768                {
6769                        resettvpic();
6770                        startplugin();
6771                        resettvpic();
6772                        buf = ostrcat(buf, "ok", 1, 0);
6773                }
6774                else
6775                        buf = ostrcat(buf, "internal error", 1, 0);
6776        }
6777        else
6778                buf = ostrcat(buf, "wrong plugin name", 1, 0);
6779
6780        return buf;
6781}
6782
6783char* webinfobarplugin(char* param, int fmt)
6784{
6785        char* buf = NULL;
6786
6787        struct skin* pluginnode = getplugin(param);
6788
6789        if(pluginnode != NULL)
6790        {
6791                        status.extplugin = ostrcat(param, NULL, 0, 0);
6792                        buf = ostrcat(buf, "ok", 1, 0);
6793        }
6794        else
6795                buf = ostrcat(buf, "wrong plugin name", 1, 0);
6796
6797        return buf;
6798}
6799
6800char* webgetrestoredefaultlist(int fmt)
6801{
6802        if(status.security == 0) return NULL;
6803
6804        char* buf = NULL;
6805
6806        if(fmt == 0)
6807        {
6808                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6809                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6810                buf = ostrcat(buf, "</head><body class=body id=\"restoredefaultlist\"><center>", 1, 0);
6811                buf = ostrcat(buf, "<br>", 1, 0);
6812                buf = ostrcat(buf, "<h1>", 1, 0);
6813                buf = ostrcat(buf, _("Restore default settings"), 1, 0);
6814                buf = ostrcat(buf, "</h1>", 1, 0);
6815                buf = ostrcat(buf, "<br>", 1, 0);
6816        }
6817
6818        buf = ostrcat(buf, "</br></br>", 1, 0);
6819        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getrestoredefault&1 target=main>", 1, 0);
6820        buf = ostrcat(buf, _("Restore default settings"), 1, 0);
6821        buf = ostrcat(buf, "</a>", 1, 0);
6822        buf = ostrcat(buf, "</br></br>", 1, 0);
6823
6824        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getrestoredefault&2 target=main>", 1, 0);
6825        buf = ostrcat(buf, _("Format MNT with Backup/Restore"), 1, 0);
6826        buf = ostrcat(buf, "</a>", 1, 0);
6827        buf = ostrcat(buf, "</br></br>", 1, 0);
6828
6829        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getrestoredefault&3 target=main>", 1, 0);
6830        buf = ostrcat(buf, _("Format MNT (all)"), 1, 0);
6831        buf = ostrcat(buf, "</a>", 1, 0);
6832
6833        buf = ostrcat(buf, "</br></br>", 1, 0);
6834
6835        if(fmt == 0)
6836        {
6837                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6838        }
6839
6840        return buf;
6841}
6842
6843char* webgetrestoredefault(char* param, int fmt)
6844{
6845        if(status.security == 0) return NULL;
6846
6847        char* buf = NULL, *tmpstr = NULL;
6848        int mode = atoi(param);
6849
6850//      if(fmt == 0)
6851//      {
6852                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6853                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6854                buf = ostrcat(buf, "</head><body class=body id=\"restoredefault\"><center>", 1, 0);
6855                buf = ostrcat(buf, "<br>", 1, 0);
6856                buf = ostrcat(buf, "<h1>", 1, 0);
6857
6858        if(mode == 1)
6859        {
6860                tmpstr = getconfig("restorecmd", NULL);
6861                system(tmpstr);
6862                buf = ostrcat(buf, _("Restore default settings"), 1, 0);
6863                buf = ostrcat(buf, "<br>", 1, 0);
6864                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
6865                system("sync");
6866                system("sleep 10; init 6");
6867        }
6868        if(mode == 2)
6869        {
6870                system("touch /var/etc/.erasemtd");
6871                system("touch /var/etc/.backupmtd");
6872                buf = ostrcat(buf, _("Format MNT with Backup/Restore"), 1, 0);
6873                buf = ostrcat(buf, "<br>", 1, 0);
6874                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
6875                system("sync");
6876                system("sleep 10; init 6");
6877        }
6878        if(mode == 3)
6879        {
6880                system("touch /var/etc/.erasemtd");
6881                buf = ostrcat(buf, _("Format MNT (all)"), 1, 0);
6882                buf = ostrcat(buf, "<br>", 1, 0);
6883                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
6884                system("sync");
6885                system("sleep 10; init 6");
6886        }
6887
6888                buf = ostrcat(buf, "</h1>", 1, 0);
6889                buf = ostrcat(buf, "<br>", 1, 0);
6890//      }
6891
6892//      if(fmt == 0)
6893//      {
6894                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6895//      }
6896
6897        return buf;
6898}
6899
6900char* webgetchannelsettingslist(int fmt)
6901{
6902        if(status.security == 0) return NULL;
6903
6904        char* buf = NULL;
6905
6906        if(fmt == 0)
6907        {
6908                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6909                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6910                buf = ostrcat(buf, "</head><body class=body id=\"channelsettingslist\"><center>", 1, 0);
6911                buf = ostrcat(buf, "<br>", 1, 0);
6912                buf = ostrcat(buf, "<h1>", 1, 0);
6913                buf = ostrcat(buf, _("Restore channel settings"), 1, 0);
6914                buf = ostrcat(buf, "</h1>", 1, 0);
6915                buf = ostrcat(buf, "<br>", 1, 0);
6916        }
6917
6918        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getchannelsettings&1 target=main>", 1, 0);
6919        buf = ostrcat(buf, _("Restore Default Channel Settings"), 1, 0);
6920        buf = ostrcat(buf, "</a>", 1, 0);
6921        buf = ostrcat(buf, "</br></br>", 1, 0);
6922
6923        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getchannelsettings&2 target=main>", 1, 0);
6924        buf = ostrcat(buf, _("Restore Default Bouquets"), 1, 0);
6925        buf = ostrcat(buf, "</a>", 1, 0);
6926        buf = ostrcat(buf, "</br></br>", 1, 0);
6927
6928        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getchannelsettings&3 target=main>", 1, 0);
6929        buf = ostrcat(buf, _("Restore Default Channels"), 1, 0);
6930        buf = ostrcat(buf, "</a>", 1, 0);
6931        buf = ostrcat(buf, "</br></br>", 1, 0);
6932
6933        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getchannelsettings&4 target=main>", 1, 0);
6934        buf = ostrcat(buf, _("Restore Default Providers"), 1, 0);
6935        buf = ostrcat(buf, "</a>", 1, 0);
6936        buf = ostrcat(buf, "</br></br>", 1, 0);
6937
6938        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?getchannelsettings&5 target=main>", 1, 0);
6939        buf = ostrcat(buf, _("Restore Default Sats"), 1, 0);
6940        buf = ostrcat(buf, "</a>", 1, 0);
6941
6942        buf = ostrcat(buf, "</br></br>", 1, 0);
6943
6944        if(fmt == 0)
6945        {
6946                buf = ostrcat(buf, "</center></body></html>", 1, 0);
6947        }
6948
6949        return buf;
6950}
6951
6952char* webgetchannelsettings(char* param, int fmt)
6953{
6954        if(status.security == 0) return NULL;
6955
6956        char* buf = NULL;
6957        int mode = atoi(param);
6958
6959//      if(fmt == 0)
6960//      {
6961                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
6962                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
6963                buf = ostrcat(buf, "</head><body class=body id=\"channelsettings\"><center>", 1, 0);
6964                buf = ostrcat(buf, "<br>", 1, 0);
6965                buf = ostrcat(buf, "<h1>", 1, 0);
6966
6967        if(mode == 1)
6968        {
6969                system("rm -rf /mnt/settings/* > /dev/null 2>&1");
6970                system("cp -a /etc/titan.restore/mnt/settings/* /mnt/settings > /dev/null 2>&1");
6971                buf = ostrcat(buf, _("Restore Default Channel Settings"), 1, 0);
6972                buf = ostrcat(buf, "<br>", 1, 0);
6973                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
6974                system("sync");
6975                system("sleep 10; init 6");
6976        }
6977        if(mode == 2)
6978        {
6979                system("rm -f /mnt/settings/bouquets.* > /dev/null 2>&1");
6980                system("cp -a /etc/titan.restore/mnt/settings/bouquets.cfg /mnt/settings/bouquets.cfg > /dev/null 2>&1");
6981                system("cp -a /etc/titan.restore/mnt/settings/bouquets.*.tv /mnt/settings > /dev/null 2>&1");
6982                system("cp -a /etc/titan.restore/mnt/settings/bouquets.*.radio /mnt/settings > /dev/null 2>&1");
6983                buf = ostrcat(buf, _("Restore Default Bouquets"), 1, 0);
6984                buf = ostrcat(buf, "<br>", 1, 0);
6985                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
6986                system("sync");
6987                system("sleep 10; init 6");
6988        }
6989        if(mode == 3)
6990        {
6991                system("rm -f /mnt/settings/channel > /dev/null 2>&1");
6992                system("cp -a /etc/titan.restore/mnt/settings/channel /mnt/settings > /dev/null 2>&1");
6993                buf = ostrcat(buf, _("Restore Default Channels"), 1, 0);
6994                buf = ostrcat(buf, "<br>", 1, 0);
6995                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
6996                system("sync");
6997                system("sleep 10; init 6");
6998        }
6999        if(mode == 4)
7000        {
7001                system("rm -f /mnt/settings/provider > /dev/null 2>&1");
7002                system("cp -a /etc/titan.restore/mnt/settings/provider /mnt/settings > /dev/null 2>&1");
7003                buf = ostrcat(buf, _("Restore Default Providers"), 1, 0);
7004                buf = ostrcat(buf, "<br>", 1, 0);
7005                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
7006                system("sync");
7007                system("sleep 10; init 6");
7008        }
7009        if(mode == 5)
7010        {
7011                system("rm -f /mnt/settings/satellites > /dev/null 2>&1");
7012                system("cp -a /etc/titan.restore/mnt/settings/satellites /mnt/settings > /dev/null 2>&1");
7013                buf = ostrcat(buf, _("Restore Default Sats"), 1, 0);
7014                buf = ostrcat(buf, "<br>", 1, 0);
7015                buf = ostrcat(buf, _("Receiver reboots now !!!"), 1, 0);
7016                system("sync");
7017                system("sleep 10; init 6");
7018        }
7019                buf = ostrcat(buf, "</h1>", 1, 0);
7020                buf = ostrcat(buf, "<br>", 1, 0);
7021//      }
7022
7023//      if(fmt == 0)
7024//      {
7025                buf = ostrcat(buf, "</center></body></html>", 1, 0);
7026//      }
7027
7028        return buf;
7029}
7030
7031char* webgettelnet(int fmt)
7032{
7033        char* buf = NULL, *tmpstr = NULL;
7034        if(status.security == 0) return NULL;
7035
7036//      if(fmt == 0)
7037//      {
7038                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
7039                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
7040                buf = ostrcat(buf, "</head><body class=body id=\"command\"><center>", 1, 0);
7041//      }
7042
7043        buf = ostrcat(buf, "<form action=query method=get>", 1, 0);
7044        buf = ostrcat(buf, "<br><br>", 1, 0);
7045        buf = ostrcat(buf, "<div class=label>", 1, 0);
7046        buf = ostrcat(buf, _("Send Telnet Command"), 1, 0);
7047        buf = ostrcat(buf, "</div>", 1, 0);
7048
7049        buf = ostrcat(buf, "<br><br>", 1, 0);
7050        buf = ostrcat(buf, "<input hidden class=inputbox name=getcommand>", 1, 0);
7051//      buf = ostrcat(buf, "<input hidden class=inputbox name=play>", 1, 0);
7052        buf = ostrcat(buf, "<input class=inputbox style='width:360px' name=\"cmd\" style=\"overflow:hidden;\">", 1, 0);
7053        buf = ostrcat(buf, "<br><br>", 1, 0);
7054        buf = ostrcat(buf, "<input class=button type=submit value=\"", 1, 0);
7055        buf = ostrcat(buf, _("Send"), 1, 0);
7056        buf = ostrcat(buf, "\"></input>", 1, 0);
7057
7058        buf = ostrcat(buf, "&nbsp;", 1, 0);
7059        buf = ostrcat(buf, "<input class=button type=reset name=reset value=\"", 1, 0);
7060        buf = ostrcat(buf, _("Reset"), 1, 0);
7061        buf = ostrcat(buf, "\"></input>", 1, 0);
7062
7063        buf = ostrcat(buf, "</form>", 1, 0);
7064
7065
7066//      debug(10, "cmd: %s", param);
7067//      tmpstr = command(param);
7068        buf = ostrcat(buf, tmpstr, 1, 0);
7069        free(tmpstr), tmpstr = NULL;
7070
7071        buf = string_replace_all("\n", "<br>", buf, 1);
7072        buf = string_replace_all("<br>", "<br>\n", buf, 1);
7073
7074//      if(fmt == 0)
7075                buf = ostrcat(buf, "</center></body></html>", 1, 0);
7076
7077        return buf;
7078}
7079
7080char* webgetcommand(char* param, int fmt)
7081{
7082        char* buf = NULL, *tmpstr = NULL, *cmd = NULL;
7083        if(param == NULL) return NULL;
7084        if(status.security == 0) return NULL;
7085
7086        cmd = ostrcat(param + 4, NULL, 0, 0);
7087
7088        if(cmd == NULL) return NULL;
7089        htmldecode(cmd, cmd);
7090        cmd = string_replace_all("+", " ", cmd, 1);
7091
7092//      if(fmt == 0)
7093//      {
7094                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
7095                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
7096                buf = ostrcat(buf, "</head><body class=body id=\"command\"><center>", 1, 0);
7097                buf = ostrcat(buf, "<br>", 1, 0);
7098                buf = ostrcat(buf, "<h1>", 1, 0);
7099                buf = ostrcat(buf, cmd, 1, 0);
7100                buf = ostrcat(buf, "</h1>", 1, 0);
7101//      }
7102
7103        buf = ostrcat(buf, "<br><br>", 1, 0);
7104
7105        debug(10, "cmd: %s", cmd);
7106        tmpstr = command(cmd);
7107        printf("webgetcommand: tmpstr: %s\n", tmpstr);
7108
7109        buf = ostrcat(buf, tmpstr, 1, 0);
7110        free(tmpstr), tmpstr = NULL;
7111        free(cmd), cmd = NULL;
7112
7113        buf = string_replace_all("\n", "<br>", buf, 1);
7114        buf = string_replace_all("<br>", "<br>\n", buf, 1);
7115
7116//      if(fmt == 0)
7117                buf = ostrcat(buf, "</center></body></html>", 1, 0);
7118
7119        return buf;
7120}
7121
7122#endif
Note: See TracBrowser for help on using the repository browser.