Changeset 38466


Ignore:
Timestamp:
09/02/16 18:31:49 (8 years ago)
Author:
Stephan
Message:

nicer text

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/global.h

    r38457 r38466  
    22#define GLOBAL_H
    33
    4 //flag 0: video+gui+freez 
     4//flag 0: video+gui+freez
    55//flag 1: video+gui
    66//flag 2: video
     
    5252                videocontinue(status.aktservice->videodev);
    5353
    54         free(file), file = NULL;       
     54        free(file), file = NULL;
    5555        free(cmd), cmd = NULL;
    5656}
     
    101101        if(sec < 1) return;
    102102        int maxsec = sec, rcret = -1;
    103        
     103
    104104        char* tmpstr = NULL;
    105105        struct skin* waitmsgbar = getscreen("waitmsgbar");
    106106        struct skin* load = getscreen("loading");
    107        
     107
    108108        waitmsgbar->progresssize = 0;
    109109        if(text == NULL)
     
    113113        changetext(waitmsgbar, tmpstr);
    114114        free(tmpstr); tmpstr = NULL;
    115        
     115
    116116        if(flag == 0) drawscreen(load, 0, 0);
    117        
     117
    118118        while(sec > 0)
    119119        {
    120120                drawscreen(waitmsgbar, 0, 0);
    121                
     121
    122122                if(exit == 0)
    123123                        sleep(1);
     
    127127                        if(rcret == getrcconfigint("rcexit", NULL))
    128128                                break;
    129                                
     129
    130130                        if(rcret != RCTIMEOUT) continue;
    131131                }
    132                
     132
    133133                sec--;
    134134                waitmsgbar->progresssize = ((maxsec - sec) * 100) / maxsec;
    135                
     135
    136136                if(text == NULL)
    137137                        tmpstr = ostrcat(oitoa(waitmsgbar->progresssize), "%", 1, 0);
     
    145145                free(tmpstr); tmpstr = NULL;
    146146        }
    147        
     147
    148148        free(tmpstr); tmpstr = NULL;
    149149        if(flag == 0) clearscreen(load);
     
    158158        char* tmpstr = NULL;
    159159        if(text == NULL) return NULL;
    160        
     160
    161161        if(flag == 0)
    162162        {
    163163          tmpstr = ostrcat(getconfig("pluginpath", NULL), text, 0, 0);
    164164          if(file_exist(tmpstr) == 1) return tmpstr;
    165          
     165
    166166          free(tmpstr); tmpstr = NULL;
    167167          tmpstr = ostrcat(getconfig("pluginpath1", NULL), text, 0, 0);
    168168          if(file_exist(tmpstr) == 1) return tmpstr;
    169          
     169
    170170          free(tmpstr); tmpstr = NULL;
    171171          tmpstr = ostrcat(getconfig("pluginpath2", NULL), text, 0, 0);
     
    175175        {
    176176                if(strlen(text) < 13) return NULL;
    177                
     177
    178178                tmpstr = ostrcat(getconfig("pluginpath", NULL), &text[12], 0, 0);
    179179                if(file_exist(tmpstr) == 1) return tmpstr;
    180                
     180
    181181                free(tmpstr); tmpstr = NULL;
    182182                tmpstr = ostrcat(getconfig("pluginpath1", NULL), &text[12], 0, 0);
    183183                if(file_exist(tmpstr) == 1) return tmpstr;
    184                
     184
    185185                free(tmpstr); tmpstr = NULL;
    186186                tmpstr = ostrcat(getconfig("pluginpath2", NULL), &text[12], 0, 0);
    187187                if(file_exist(tmpstr) == 1) return tmpstr;
    188188        }
    189        
     189
    190190        free(tmpstr); tmpstr = NULL;
    191191        return NULL;
    192 } 
     192}
    193193
    194194int osystem(char* cmd, int timeout)
     
    263263        if(getconfigint("usecec", NULL) == 1 || getconfigint("cec_on", NULL) == 1)
    264264        {
    265 #ifndef MIPSEL         
     265#ifndef MIPSEL
    266266                if(flag == 0)
    267267                        writesys("/proc/stb/cec/onetouchplay", "0", 1);
     
    308308        {
    309309                for(i = 0; i < count; i++)
    310                         tmpstr = ostrcat(maskchar, tmpstr, 0, 1);       
     310                        tmpstr = ostrcat(maskchar, tmpstr, 0, 1);
    311311        }
    312312
     
    378378        char *token = NULL;
    379379        int idx = 0;
    380        
     380
    381381        if(string == NULL) return NULL;
    382382
     
    437437                free(str), str = NULL;
    438438        }
    439         return tmpstr; 
     439        return tmpstr;
    440440}
    441441
     
    530530                return NULL;
    531531        }
    532        
     532
    533533        rpath = realpath(filename, NULL);
    534534        if(rpath == NULL) return NULL;
     
    771771                        return NULL;
    772772                }
    773      
     773
    774774                (&array[(*count) - 1])->part = oregex(regex, tmpstr);
    775775                tmpstr = strtok(NULL, tok);
     
    783783        if(tmparray == NULL) return;
    784784        int i = 0;
    785        
     785
    786786        for(i = 0; i < len; i++)
    787787        {
    788788                free(tmparray[i].part);
    789                 tmparray[i].part = NULL; 
    790         }
    791        
     789                tmparray[i].part = NULL;
     790        }
     791
    792792        free(tmparray);
    793793}
     
    962962                        return tmpstr;
    963963                }
    964                
     964
    965965                free(tmpstr); tmpstr = NULL;
    966966                if(flag == 1)
     
    973973                        return tmpstr;
    974974                }
    975                
     975
    976976                free(tmpstr); tmpstr = NULL;
    977977                if(flag == 1)
     
    985985                }
    986986        }
    987        
     987
    988988        free(tmpstr); tmpstr = NULL;
    989989        tmpstr = ostrcat(tmpstr, getconfig("defskinpath", NULL), 1, 0);
     
    16731673        else
    16741674                fprintf(stderr, "Error in Thread: %x\n", (unsigned int)pthread_self());
    1675        
     1675
    16761676        fprintf(stderr, "\nObtaining %zd stack frames:\n\n", size);
    16771677        for(i = 0; i < size; i++)
     
    16821682        fprintf(stderr, "%s\n", aktstring[1]);
    16831683
    1684 #ifdef BETA     
     1684#ifdef BETA
    16851685        for(i = 0; i < MAXSTACKTRACE; i++)
    16861686        {
     
    17051705                if(tmplogdir != NULL)
    17061706                {
    1707                         if(!file_exist(tmplogdir))   
     1707                        if(!file_exist(tmplogdir))
    17081708                                mkdir(tmplogdir, 0777);
    17091709                }
    17101710                free(logdir); logdir = NULL;
    17111711        }
    1712        
     1712
    17131713        //del file if greater 100KB
    17141714        if(getfilesize(getconfig("tracelog", NULL)) > 102400)
    1715                 unlink(getconfig("tracelog", NULL)); 
    1716                        
     1715                unlink(getconfig("tracelog", NULL));
     1716
    17171717        fd = fopen(getconfig("tracelog", NULL), "a");
    17181718        if(fd != NULL)
     
    17301730                else
    17311731                        fprintf(fd, "Error in Thread: %x\n", (unsigned int)pthread_self());
    1732                        
     1732
    17331733                fprintf(fd, "\nObtaining %zd stack frames:\n\n", size);
    17341734                for(i = 0; i < size; i++)
    17351735                        fprintf(fd, "%s\n", strings[i]);
    1736                        
     1736
    17371737                fprintf(fd, "\nLast functions:\n\n");
    17381738                fprintf(fd, "%s\n", aktstring[0]);
    17391739                fprintf(fd, "%s\n", aktstring[1]);
    17401740
    1741 #ifdef BETA             
     1741#ifdef BETA
    17421742                for(i = 0; i < MAXSTACKTRACE; i++)
    17431743                {
     
    17531753                }
    17541754#endif
    1755                
     1755
    17561756                fprintf(fd, "--------------------------------------\n\n");
    17571757                fclose(fd);
     
    18661866        int timediff = getconfigint("rectimer_timediff", NULL);
    18671867        int test = 0;
    1868        
     1868
    18691869        if(node == NULL)
    18701870        {
     
    19241924        int ret = 0;
    19251925
    1926         value += 7200; 
     1926        value += 7200;
    19271927
    19281928        rtctimedev = getconfig("rtctimedev", NULL);
     
    21322132
    21332133        if(filename == NULL) return NULL;
    2134        
     2134
    21352135        if(!filelistflt(".avi .dat .divx .flv .mkv .m4v .mp4 .mov .mpg .mpeg .mts .m2ts .trp .ts .vdr .vob .wmv .rm", filename))
    21362136                tmpstr = ostrcat("movie", NULL, 0, 0);
     
    23452345{
    23462346        char* cmd = NULL;
    2347         cmd = ostrcat(cmd, "cat ", 1, 0); 
    2348         cmd = ostrcat(cmd, dev, 1, 0); 
     2347        cmd = ostrcat(cmd, "cat ", 1, 0);
     2348        cmd = ostrcat(cmd, dev, 1, 0);
    23492349
    23502350        char* tmpstr = NULL;
     
    23612361                return 0;
    23622362        }
    2363        
     2363
    23642364        free(tmpstr), tmpstr = NULL;
    23652365        return 1;
     
    24312431        int ret = 0;
    24322432        z_stream stream;
    2433        
     2433
    24342434        if(inbuf == NULL || outbuf == NULL || inlen == 0) return 1;
    24352435
     
    24562456        stream.avail_in = inlen;
    24572457        stream.next_in = (void*)inbuf;
    2458  
     2458
    24592459        do
    24602460        {
     
    24712471        }
    24722472        while(stream.avail_out == 0);
    2473        
    2474         char* tmpoutbuf = *outbuf;     
     2473
     2474        char* tmpoutbuf = *outbuf;
    24752475        *outlen = inlen - stream.avail_out;
    24762476        *outbuf = realloc(*outbuf, *outlen);
     
    24792479                if(*outlen > 0)
    24802480                {
    2481                         err("no mem"); 
     2481                        err("no mem");
    24822482                        free(tmpoutbuf);
    24832483                }
     
    24852485                (void)deflateEnd(&stream);
    24862486                return 1;
    2487         }       
     2487        }
    24882488
    24892489        (void)deflateEnd(&stream);
     
    24992499        int ret = 0;
    25002500        z_stream stream;
    2501        
     2501
    25022502        if(inbuf == NULL || outbuf == NULL || maxbuf == 0) return 1;
    25032503        if(flag == 1 && *outbuf == NULL) return 1;
     
    25402540        {
    25412541                stream.avail_out = maxbuf;
    2542                
     2542
    25432543                if(flag == 0 && round > 0)
    25442544                {
     
    25622562                        if(flag == 0)
    25632563                        {
    2564                                 free(*outbuf); 
     2564                                free(*outbuf);
    25652565                                *outbuf = NULL;
    2566                         }                               
     2566                        }
    25672567                        (void)inflateEnd(&stream);
    25682568                        return 1;
     
    25722572        }
    25732573        while(stream.avail_out == 0);
    2574        
     2574
    25752575        if(flag == 0)
    25762576        {
     
    25852585                        (void)inflateEnd(&stream);
    25862586                        return 1;
    2587                 }       
     2587                }
    25882588        }
    25892589        else
    2590                 *outlen = maxbuf - stream.avail_out;                   
     2590                *outlen = maxbuf - stream.avail_out;
    25912591
    25922592        (void)inflateEnd(&stream);
     
    36333633                return NULL;
    36343634        }
    3635        
     3635
    36363636        if(flag == 1)
    36373637        {
     
    41194119        free(value), value = NULL;
    41204120//      value = ostrcat("16:9_set_bestfit_to_policy_show_justscale 16:9_set_letterbox_to_policy_show_panscan 16:9_set_panscan_to_policy_show_pillarbox 4:3_set_bestfit_to_policy2_show_justscale 4:3_set_letterbox_to_policy2_show_letterbox 4:3_set_panscan_to_policy2_show_panscan", NULL, 0, 0);
    4121         value = ostrcat(_("16:9_set_bestfit_to_policy_show_justscale"), NULL, 0, 0); 
    4122         value = ostrcat(value, "\n", 1, 0); 
    4123         value = ostrcat(value, _("16:9_set_letterbox_to_policy_show_panscan"), 1, 0); 
    4124         value = ostrcat(value, "\n", 1, 0); 
    4125         value = ostrcat(value, _("16:9_set_panscan_to_policy_show_pillarbox"), 1, 0); 
    4126         value = ostrcat(value, "\n", 1, 0); 
    4127         value = ostrcat(value, _("4:3_set_bestfit_to_policy2_show_justscale"), 1, 0); 
    4128         value = ostrcat(value, "\n", 1, 0); 
    4129         value = ostrcat(value, _("4:3_set_letterbox_to_policy2_show_letterbox"), 1, 0); 
    4130         value = ostrcat(value, "\n", 1, 0); 
    4131         value = ostrcat(value, _("4:3_set_panscan_to_policy2_show_panscan"), 1, 0); 
     4121        value = ostrcat(_("16:9_set_bestfit_to_policy_show_justscale"), NULL, 0, 0);
     4122        value = ostrcat(value, "\n", 1, 0);
     4123        value = ostrcat(value, _("16:9_set_letterbox_to_policy_show_panscan"), 1, 0);
     4124        value = ostrcat(value, "\n", 1, 0);
     4125        value = ostrcat(value, _("16:9_set_panscan_to_policy_show_pillarbox"), 1, 0);
     4126        value = ostrcat(value, "\n", 1, 0);
     4127        value = ostrcat(value, _("4:3_set_bestfit_to_policy2_show_justscale"), 1, 0);
     4128        value = ostrcat(value, "\n", 1, 0);
     4129        value = ostrcat(value, _("4:3_set_letterbox_to_policy2_show_letterbox"), 1, 0);
     4130        value = ostrcat(value, "\n", 1, 0);
     4131        value = ostrcat(value, _("4:3_set_panscan_to_policy2_show_panscan"), 1, 0);
    41324132#else
    41334133        value = convertspacetolf(value);
     
    42364236                        tmpstr2 = ostrcat("16:9_set_panscan_to_policy_show_pillarbox", NULL, 0, 0);
    42374237                        setaspect("set_16:9");
    4238                 }                       
     4238                }
    42394239                else if(ostrcmp(_("4:3_set_bestfit_to_policy2_show_justscale"), _(value)) == 0)
    42404240                {
     
    42654265
    42664266#ifdef MIPSEL
    4267                 if(ret == 0) 
     4267                if(ret == 0)
    42684268                {
    42694269                        debug(10, "write %s to /mnt/config/titan.cfg", tmpstr2);
     
    43614361                        {
    43624362                                addconfig("av_aspect", value);
    4363        
     4363
    43644364                                //set policy new after change aspect
    43654365                                char* tmpstr = getpolicy();
     
    45414541        int rcret = 0;
    45424542        char* tmpstr = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL;
    4543         tmpstr = getvideomode();       
     4543        tmpstr = getvideomode();
    45444544        struct skin* playpolicy = getscreen("playpolicy");
    45454545        tmpstr2 = getcolorformat(2);
    4546                
     4546
    45474547        if(tmpstr != NULL)
    45484548        {
     
    45734573                        changetext(playpolicy, tmpstr3);
    45744574                        writevfdmenu(tmpstr3);
    4575                         unlink("/var/etc/.scart");                     
     4575                        unlink("/var/etc/.scart");
    45764576                }
    45774577                else if(ostrncmp("1080", tmpstr, 4) == 0)
     
    46324632        int ret = 0;
    46334633
    4634         colorformatdev = getconfig("colorformatdev", NULL); 
     4634        colorformatdev = getconfig("colorformatdev", NULL);
    46354635
    46364636        if(colorformatdev != NULL && value != NULL)
     
    47894789                status.mute = value;
    47904790                setvol(tmpvol);
    4791         } 
     4791        }
    47924792        else
    47934793        {
     
    48174817                        ret = writesysint(mutedev, value, 0);
    48184818#endif
    4819                
     4819
    48204820                        if(ret == 0) status.mute = value;
    48214821                        if(status.volautochangevalue != 0 && value == 0) setvol(getvol());
     
    48484848
    48494849        voldev = getconfig("voldev", NULL);
    4850        
     4850
    48514851        if(voldev != NULL)
    48524852        {
     
    48734873                        struct dvbdev *audionode = NULL;
    48744874                        int openaudio = 0;
    4875        
     4875
    48764876                        if(ret == 0 && status.aktservice != NULL)
    48774877                        {
     
    48834883                                else
    48844884                                        audionode = status.aktservice->audiodev;
    4885                
     4885
    48864886                                if(ret == 0 && audionode != NULL)
    48874887                                        ret = setmixer(audionode, value, value);
    4888                                        
     4888
    48894889                                if(ret == 0)
    48904890                                        status.volume = value;
    4891                                
     4891
    48924892                                if(openaudio == 1)
    48934893                                        audioclose(audionode, -1);
     
    49664966                buf = buf + 1;
    49674967                if(buf[0] == '\\')
    4968                 {       
     4968                {
    49694969                        buf = buf + 1;
    49704970                        if(buf[0] == '"')
     
    50095009                {
    50105010                        buf2 = ostrstr(buf, "/>");
    5011                         if(buf2 == NULL) 
     5011                        if(buf2 == NULL)
    50125012                        {
    50135013                                buf2 = strchr(buf, '>');
     
    51755175                        else
    51765176                                sprintf(buf,"%s\n\n", zeichen);
    5177                                
     5177
    51785178                        buf1oldsize = buf1size;
    51795179                        buf1size += strlen(buf);
     
    52125212                                else
    52135213                                        sprintf(buf, "%s", zeichen);
    5214                         }       
     5214                        }
    52155215
    52165216                        buf1oldsize = buf1size;
     
    52265226                                return NULL;
    52275227                        }
    5228                         sprintf(buf1 + buf1oldsize, "%s", buf);     
     5228                        sprintf(buf1 + buf1oldsize, "%s", buf);
    52295229
    52305230                }
     
    52345234                        len= byte;
    52355235                        fgets(zeichen, len + 1, fil);
    5236                 } 
     5236                }
    52375237        }
    52385238        free(zeichen);
     
    52475247        char* tmpstr = NULL, *fileline = NULL;
    52485248        FILE *iopipe = NULL;
    5249        
     5249
    52505250        if(input == NULL) return NULL;
    52515251
     
    52685268                        ostrcatbig(&tmpstr, fileline, &maxlen, &pos);
    52695269        }
    5270        
     5270
    52715271        if(pos > 0)
    52725272        {
     
    52915291        while(*p1 != '\0')
    52925292                *p1++ = tolower(*p1);
    5293        
     5293
    52945294        return str;
    52955295*/
     
    53145314        while(*p1 != '\0')
    53155315                *p1++ = toupper(*p1);
    5316        
     5316
    53175317*/
    53185318        if(str == NULL) return NULL;
     
    53385338                {
    53395339                        *p1 = c2;
    5340                         break;                 
    5341                 }                       
     5340                        break;
     5341                }
    53425342                p1++;
    53435343        }
     
    53735373                else if(*p1 == '-') *p1 = ' ';
    53745374                else if(*p1 == '_') *p1 = ' ';
    5375                 else if(*p1 == '/') *p1 = ' '; 
     5375                else if(*p1 == '/') *p1 = ' ';
    53765376                p1++;
    53775377        }
     
    54885488        }
    54895489
    5490         len = 0;       
     5490        len = 0;
    54915491        char* str = string;
    54925492        char* tmp = tmpstr;
     
    56755675                        return NULL;
    56765676                }
    5677                
     5677
    56785678                (&array[(*count) - 1])->part = tmpstr;
    56795679                tmpstr = strtok(NULL, tok);
     
    57265726                {
    57275727                        if(j > 0)
    5728                         {                                       
     5728                        {
    57295729                                if(ostrcmp((&ret1[i])->part, (&ret2[j])->part) == 0)
    57305730                                {
     
    57605760                                                }
    57615761                                        }
    5762                                 }                               
     5762                                }
    57635763                        }
    57645764                }
     
    57805780        debug(60, "in %s", device);
    57815781        char* cmd = NULL, *tmpstr = NULL;
    5782        
     5782
    57835783        if(device == NULL) return NULL;
    5784 #ifdef MIPSEL           
     5784#ifdef MIPSEL
    57855785        cmd = ostrcat(cmd, "blkid -w /dev/null -c /dev/null -s UUID /dev/", 1, 0);
    57865786#else
     
    58125812#else
    58135813        cmd = ostrcat(cmd, "/bin/blkid -w /dev/null -c /dev/null -s LABEL /dev/", 1, 0);
    5814 #endif 
     5814#endif
    58155815        cmd = ostrcat(cmd, device, 1, 0);
    58165816        cmd = ostrcat(cmd, " | cut -d'\"' -f2", 1, 0);
     
    58645864        char* ipout = NULL;
    58655865        unsigned char ip[4];
    5866        
     5866
    58675867        ip[0] = 0;
    58685868        ip[1] = 0;
     
    58995899        else
    59005900                base = -15;
    5901                
     5901
    59025902
    59035903        if(speed < 0)
     
    60326032        char* timestamp = NULL;
    60336033        struct timeval numtime;
    6034                
     6034
    60356035        gettimeofday(&numtime, 0);
    60366036        timestamp = ostrcat(timestamp, olutoa(numtime.tv_sec), 1, 1);
     
    60386038
    60396039        return timestamp;
    6040 } 
     6040}
    60416041
    60426042char* string_decode(char* input, int flag)
     
    60716071                debug(210, "input: %s", input);
    60726072        }
    6073        
     6073
    60746074        while(ostrstr(input, "&quot;") != NULL)
    60756075        {
     
    60856085                debug(210, "input: %s", input);
    60866086        }
    6087        
     6087
    60886088        while(ostrstr(input, "&#") != NULL)
    60896089        {
     
    60926092                debug(210, "input: %s", input);
    60936093        }
    6094        
     6094
    60956095        if(flag == 1)
    60966096                htmldecode2(input, input);
    60976097        else
    60986098                htmldecode(input, input);
    6099                        
     6099
    61006100        while(ostrstr(input, ";") != NULL)
    61016101        {
     
    61406140
    61416141        if(str == NULL) return 0;
    6142        
     6142
    61436143        len = strlen(str);
    61446144
     
    61556155                if(skip == 1)
    61566156                        str[i] = ' ';
    6157         }       
     6157        }
    61586158
    61596159        return strstrip(str);
     
    62006200        {
    62016201                if(toupper(*str) == toupper(*sub) && strncasecmp(str, sub, len) == 0)
    6202                         return str;     
     6202                        return str;
    62036203                ++str;
    62046204        }
     
    62216221                                tmpstr = ostrcat(tmpstr, "0", 1, 0);
    62226222                }
    6223                 tmpstr = ostrcat(tmpstr, input, 1, 0);         
     6223                tmpstr = ostrcat(tmpstr, input, 1, 0);
    62246224        }
    62256225        else
    62266226        {
    6227                 while (*input && *input == '0') 
     6227                while (*input && *input == '0')
    62286228                input++;
    6229        
    6230                 tmpstr = ostrcat(tmpstr, input, 1, 0);         
     6229
     6230                tmpstr = ostrcat(tmpstr, input, 1, 0);
    62316231        }
    62326232        return tmpstr;
     
    62416241        char* tmpstr = NULL;
    62426242        if(input == NULL) return tmpstr;
    6243         tmpstr = ostrcat(tmpstr, input, 1, 1); 
     6243        tmpstr = ostrcat(tmpstr, input, 1, 1);
    62446244
    62456245        if(flag == 0)
     
    64046404                        start = ostrcat(start, ":", 1, 0);
    64056405                        tmpstr2 = string_resub(start, "\n", tmpstr1, 0);
    6406                
     6406
    64076407                        if(i > 0)
    64086408                                value = ostrcat(value, "\n", 1, 0);
    6409                
     6409
    64106410                        if(tmpstr2 != NULL)
    64116411                                value = ostrcat(value, tmpstr2, 1, 0);
    6412                                
     6412
    64136413                        free(tmpstr2), tmpstr2 = NULL;
    64146414                        free(start), start = NULL;
    64156415                }
    64166416        }
    6417         free(ret1), ret1 = NULL;                       
     6417        free(ret1), ret1 = NULL;
    64186418        free(tmpstr1), tmpstr1 = NULL;
    64196419        free(hypridlist), hypridlist = NULL;
     
    64696469
    64706470        tmpstr2 = string_resub(start, "\n", tmpstr1, 0);
    6471        
     6471
    64726472        if(tmpstr2 != NULL)
    64736473                value = ostrcat(value, tmpstr2, 1, 0);
     
    64976497
    64986498        hypridtuner = getconfig("hypridtuner", NULL);
    6499        
     6499
    65006500        if(hypridtuner != NULL)
    65016501        {
     
    65356535{
    65366536        debug(99, "phpkit user: %s", user);
    6537         debug(99, "phpkit pass: %s", pass);     
     6537        debug(99, "phpkit pass: %s", pass);
    65386538        debug(99, "phpkit url: %s", link);
    65396539
     
    65586558        send = ostrcat(send, "GET ", 1, 0);
    65596559        send = ostrcat(send, tmppath, 1, 0);
    6560         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
     6560        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
    65616561        send = ostrcat(send, tmphost, 1, 0);
    6562         send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);       
     6562        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);
    65636563        debug(99, "#############################################################################################################");
    65646564        debug(99, "send1: %s", send);
     
    65776577        hash = ostrcat(hash, pass, 1, 1);
    65786578        hashlen = oitoa(strlen(hash));
    6579        
     6579
    65806580        send = ostrcat(send, "POST ", 1, 0);
    65816581        send = ostrcat(send, tmppath, 1, 0);
     
    65866586        send = ostrcat(send, "\r\nCookie: pageredir=", 1, 0);
    65876587        send = ostrcat(send, cookie1, 1, 0);
    6588         send = ostrcat(send, "; PHPSESSID=", 1, 0);     
     6588        send = ostrcat(send, "; PHPSESSID=", 1, 0);
    65896589        send = ostrcat(send, cookie2, 1, 0);
    6590         send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);     
     6590        send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);
    65916591        send = ostrcat(send, hash, 1, 0);
    65926592        free(hash); hash = NULL;
     
    66566656
    66576657        tmpstr2 = string_resub("Name: ", "\n", tmpstr1, 0);
    6658        
     6658
    66596659        if(tmpstr2 != NULL)
    66606660                value = ostrcat(value, tmpstr2, 1, 0);
     
    67576757        char* path = NULL, *buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *line = NULL, *name = NULL, *orbitalpos = NULL, *fetype = NULL, *flags = NULL, *outfile = NULL, *start = NULL, *end = NULL, *filename = NULL, *transponderfile = NULL, *satfile = NULL;
    67586758        int incount = 0;
    6759        
     6759
    67606760        if(flag == 0)
    67616761        {
     
    68256825        if(buf == NULL)
    68266826        {
    6827                 printf("buf: %s\n", buf);       
     6827                printf("buf: %s\n", buf);
    68286828                tmptext = ostrcat(_("Error: Transponder Source file no data"), "\nfilename: ", 0, 0);
    68296829                tmptext = ostrcat(tmptext, transponderfile, 1, 0);
     
    68396839                return 0;
    68406840        }
    6841        
     6841
    68426842//      writesys("/tmp/convert.log", buf, 1);
    68436843
     
    68476847                tmpstr = string_resub(start, end, buf, 0);
    68486848                tmpstr1 = ostrcat(tmpstr, NULL, 0, 0);
    6849                
     6849
    68506850                //printf("name: %s\n", getxmlentry(ret1[i].part, "name="));
    68516851                //printf("position: %s\n", getxmlentry(ret1[i].part, "position="));
    6852                
     6852
    68536853                name = getxmlentry(tmpstr, "name=");
    68546854                if(flag == 0)
     
    68566856                else
    68576857                        orbitalpos = ostrcat(oitoa(incount), NULL, 1, 0);
    6858                        
     6858
    68596859                flags = getxmlentry(tmpstr, "flags=");
    68606860                //string_decode(name, 0);
    68616861                name = string_replace_all("&amp;", "und", name, 1);
    6862        
     6862
    68636863                line = ostrcat(line, name, 1, 0); //name
    68646864                line = ostrcat(line, "#", 1, 0);
     
    68736873                writesys(satfile, line, 3);
    68746874                free(line), line = NULL;
    6875                                
     6875
    68766876                int count = 0;
    68776877
     
    69596959                        }
    69606960                }
    6961        
     6961
    69626962                tmpstr2 = ostrcat(start, tmpstr, 0, 0);
    6963        
     6963
    69646964                buf = string_replace(tmpstr2, NULL, buf, 1);
    6965        
     6965
    69666966        //      outfile = ostrcat("/tmp/convert.", oitoa(incount), 0, 1);
    6967         //      outfile = ostrcat(outfile, ".log", 1, 0);       
     6967        //      outfile = ostrcat(outfile, ".log", 1, 0);
    69686968        //      writesys(outfile, buf, 2);
    69696969        //      writesys("/tmp/convert.log", buf, 3);
    6970        
     6970
    69716971                writesys(transponderfile, line, 2);
    69726972                free(line), line = NULL;
    6973        
    6974                 free(tmpstr), tmpstr = NULL;   
     6973
     6974                free(tmpstr), tmpstr = NULL;
    69756975                free(tmpstr1), tmpstr1 = NULL;
    69766976                free(tmpstr2), tmpstr2 = NULL;
     
    69796979                free(orbitalpos), orbitalpos = NULL;
    69806980                free(flags), flags = NULL;
    6981                 free(outfile), outfile = NULL; 
     6981                free(outfile), outfile = NULL;
    69826982        }
    69836983
     
    69866986        free(satfile), satfile = NULL;
    69876987        free(transponderfile), transponderfile = NULL;
    6988                
     6988
    69896989        free(buf), buf = NULL;
    69906990        free(start), start = NULL;
    69916991        free(end), end = NULL;
    69926992        free(fetype), fetype = NULL;
    6993                        
     6993
    69946994        return 1;
    69956995}
     
    70087008                tmpstr1 = ostrcat(tmpstr1, gettime(NULL, "%H:%M:%S"), 1, 1);
    70097009                tmpstr = ostrcat(tmpstr, tmpstr1, 1, 1);
    7010                
     7010
    70117011                tmpstr1 = ostrcat("\nUptime = ", "", 0, 0);
    70127012                tmpstr2 = command("uptime");
     
    72427242                struct skin* load = getscreen("loading");
    72437243                drawscreen(load, 0, 0);
    7244        
     7244
    72457245                system("rm -f /mnt/settings/bouquets.* > /dev/null 2>&1");
    72467246                system("cp -a /etc/titan.restore/mnt/settings/bouquets* /mnt/settings > /dev/null 2>&1");
     
    72627262                struct skin* load = getscreen("loading");
    72637263                drawscreen(load, 0, 0);
    7264        
     7264
    72657265                system("rm -rf /mnt/settings/* > /dev/null 2>&1");
    72667266                system("cp -a /etc/titan.restore/mnt/settings/* /mnt/settings > /dev/null 2>&1");
     
    72827282                struct skin* load = getscreen("loading");
    72837283                drawscreen(load, 0, 0);
    7284        
     7284
    72857285                system("rm -f /mnt/settings/provider > /dev/null 2>&1");
    72867286                system("cp -a /etc/titan.restore/mnt/settings/provider /mnt/settings > /dev/null 2>&1");
     
    73027302                struct skin* load = getscreen("loading");
    73037303                drawscreen(load, 0, 0);
    7304        
     7304
    73057305                system("rm -f /mnt/settings/channel > /dev/null 2>&1");
    73067306                system("cp -a /etc/titan.restore/mnt/settings/channel /mnt/settings > /dev/null 2>&1");
     
    73227322                struct skin* load = getscreen("loading");
    73237323                drawscreen(load, 0, 0);
    7324        
     7324
    73257325                system("rm -f /mnt/settings/satellites > /dev/null 2>&1");
    73267326                system("cp -a /etc/titan.restore/mnt/settings/satellites /mnt/settings > /dev/null 2>&1");
     
    73437343        char* tmpstr = NULL, *cmd = NULL;
    73447344        int merksec = status.sec;
    7345        
     7345
    73467346        status.sec = 0; //deaktivate spinner
    73477347        cmd = ostrcat(cmd, "backup.sh ", 1, 0);
     
    73507350        if(flag == 2)
    73517351                cmd = ostrcat(cmd, " 1", 1, 0);
    7352        
     7352
    73537353        if(file_exist("/var/swap"))
    73547354        {
    73557355                if(!file_exist("/var/swap/logs"))
    73567356                         mkdir("/var/swap/logs", 777);
    7357        
     7357
    73587358                if(file_exist("/etc/.beta") && file_exist("/var/swap/logs"))
    7359                         cmd = ostrcat(cmd, " > /var/swap/logs/backup_debug.log 2>&1", 1, 0);           
     7359                        cmd = ostrcat(cmd, " > /var/swap/logs/backup_debug.log 2>&1", 1, 0);
    73607360        }
    73617361        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)
     
    73637363                if(!file_exist("/mnt/logs"))
    73647364                         mkdir("/mnt/logs", 777);
    7365        
     7365
    73667366                if(file_exist("/etc/.beta") && file_exist("/mnt/logs"))
    73677367                        cmd = ostrcat(cmd, " > /mnt/logs/backup_debug.log 2>&1", 1, 0);
     
    73767376        free(cmd); cmd = NULL;
    73777377        status.sec = merksec;
    7378        
     7378
    73797379        return tmpstr;
    73807380}
     
    73937393    /* Intializes random number generator */
    73947394    srand((unsigned) time(&t));
    7395     for( i = 0 ; i < n ; i++ ) 
     7395    for( i = 0 ; i < n ; i++ )
    73967396    {
    73977397        wert = rand() % 9;
     
    74077407        if(file_exist("/tmp/textbox_standby") != 1)
    74087408                return 1;
    7409        
     7409
    74107410        FILE *fp = fopen("/tmp/textbox_standby" , "r");
    7411         if(fp == NULL) 
     7411        if(fp == NULL)
    74127412        {
    74137413                printf("Error opening file: /tmp/textbox_standby\n");
    74147414                return(-1);
    74157415        }
    7416        
     7416
    74177417        char* caption = malloc(255);
    74187418        char* body = malloc(255);
     
    74297429        char* timeout = malloc(10);
    74307430        char* flag = malloc(10);
    7431  
    7432         while(fgets(caption, 255, fp)!=NULL) 
     7431
     7432        while(fgets(caption, 255, fp)!=NULL)
    74337433        {
    74347434                string_newline(caption);
    7435                
     7435
    74367436                fgets(body, 255, fp);
    74377437                string_newline(body);
    74387438                body = string_replace_all("\t", "\n", body, 1);
    7439                
     7439
    74407440                if(comtext1 == NULL)
    74417441                        comtext1 = malloc(20);
     
    74447444                fgets(com1, 10, fp);
    74457445                string_newline(com1);
    7446                
     7446
    74477447                if(comtext2 == NULL)
    74487448                        comtext2 = malloc(20);
     
    74517451                fgets(com2, 10, fp);
    74527452                string_newline(com2);
    7453                
     7453
    74547454                if(comtext3 == NULL)
    74557455                        comtext3 = malloc(20);
     
    74587458                fgets(com3, 10, fp);
    74597459                string_newline(com3);
    7460                
     7460
    74617461                if(comtext4 == NULL)
    74627462                        comtext4 = malloc(20);
     
    74657465                fgets(com4, 10, fp);
    74667466                string_newline(com4);
    7467                
     7467
    74687468                fgets(width, 10, fp);
    74697469                string_newline(width);
    7470                
     7470
    74717471                fgets(height, 10, fp);
    74727472                string_newline(height);
    7473                
     7473
    74747474                fgets(timeout, 10, fp);
    74757475                string_newline(timeout);
    7476                
     7476
    74777477                fgets(flag, 10, fp);
    74787478                string_newline(flag);
    7479                
     7479
    74807480                if(atoi(com1) == 0)
    74817481                {
     
    75007500                textbox(caption, body, comtext1, atoi(com1), comtext2, atoi(com2), comtext3, atoi(com3), comtext4, atoi(com4), atoi(width), atoi(height), atoi(timeout), atoi(flag));
    75017501        }
    7502        
    7503         fclose(fp);     
     7502
     7503        fclose(fp);
    75047504        system("rm /tmp/textbox_standby");
    7505        
     7505
    75067506        free(caption);
    75077507        free(body);
     
    75187518        free(timeout);
    75197519        free(flag);
    7520                
     7520
    75217521        return 0;
    75227522}
     
    75327532                prev = node;
    75337533                node = node->next;
    7534                
     7534
    75357535                if(prev->scan != 1)
    7536                         delsat(prev->name);     
     7536                        delsat(prev->name);
    75377537        }
    75387538        debug(10, "delunusedsat: end");
     
    75877587                while(node != NULL)
    75887588                {
    7589                         prev = node;   
     7589                        prev = node;
    75907590                        node = node->next;
    75917591                        if(getchannel(prev->serviceid, prev->transponderid) == NULL)
     
    76057605        while(node != NULL)
    76067606        {
    7607                 prev = node;   
     7607                prev = node;
    76087608                node = node->next;
    76097609                if(getchannel(prev->serviceid, prev->transponderid) == NULL)
     
    76217621        while(node != NULL)
    76227622        {
    7623                 prev = node;   
     7623                prev = node;
    76247624                node = node->next;
    76257625                delprovidernotused(prev);
     
    76527652                else
    76537653                {
    7654                         if(textbox(_("Message"), _("Found running record\nor record is starting in next time.\nReally shutdown ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 15, 0) != 1)
     7654                        if(textbox(_("Message"), _("Found running record\nor record is starting soon.\nProceed shutdown?\nOK to proceed, Exit to cancel"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 15, 0) != 1)
    76557655                                return 1;
    76567656                }
     
    76697669                        else
    76707670                        {
    7671                                 if(textbox(_("Message"), _("Found running download\nReally shutdown ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 15, 0) != 1)
     7671                                if(textbox(_("Message"), _("Found running download\nProceed shutdown?\nOK to proceed, Exit to cancel"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 15, 0) != 1)
    76727672                                        return 1;
    76737673                        }
     
    76767676                }
    76777677        }
    7678        
     7678
    76797679        return 0;
    76807680}
Note: See TracChangeset for help on using the changeset viewer.