Changeset 30362


Ignore:
Timestamp:
10/05/14 15:54:43 (9 years ago)
Author:
obi
Message:

[webif] add tpk tmp/media install

Location:
titan/titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/httpd.h

    r30349 r30362  
    314314        else if(ostrcmp(query, "gettpkinstallpath") == 0 && param != NULL)
    315315                buf = webgettpkinstallpath(param, fmt);
    316         else if(ostrcmp(query, "gettpktmpinstall") == 0)
    317                 buf = webgettpktmpinstall(fmt);
     316        else if(ostrcmp(query, "gettpktmplist") == 0 && param != NULL)
     317                buf = webgettpktmplist(param, fmt);
    318318        else if(ostrcmp(query, "gettpkmediainstall") == 0)
    319319                buf = webgettpkmediainstall(fmt);
  • titan/titan/httpdfunc.h

    r30357 r30362  
    56845684//      }
    56855685
    5686         if(node == NULL) buf = ostrcat(buf, _("No Tpk Files Found."), 1, 0);
    5687         freetpk();
    5688 
    56895686        if(path == NULL || path[0] == '*' || ostrstr(path, "mnt") != NULL)
    56905687        {
     
    57435740                }
    57445741        }
    5745        
     5742
     5743        if(node == NULL && tmpstr == NULL) buf = ostrcat(buf, _("No Tpk Files Found."), 1, 0);
     5744        freetpk();
     5745
    57465746        if(count == 0)
    57475747        {
     
    58745874}
    58755875
    5876 char* webgettpktmpinstall(int fmt)
     5876char* webgettpktmplist(char* param, int fmt)
    58775877{
    58785878        if(status.security == 0) return NULL;
    5879 
    5880         char* buf = NULL, *tmpstr = NULL;
     5879        int mode = atoi(param);
     5880
     5881        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL;
    58815882
    58825883        if(fmt == 0)
     
    58845885                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
    58855886                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
    5886                 buf = ostrcat(buf, "</head><body class=body id=\"tpktmpinstall\"><center>", 1, 0);
     5887                buf = ostrcat(buf, "</head><body class=body id=\"tpktmplist\"><center>", 1, 0);
    58875888                buf = ostrcat(buf, "<br>", 1, 0);
    58885889                buf = ostrcat(buf, "<h1>", 1, 0);
    5889                 buf = ostrcat(buf, _("TPK tmp (tmp)"), 1, 0);
     5890                if(mode == 0)
     5891                        buf = ostrcat(buf, _("TPK tmp (tmp)"), 1, 0);
     5892                else
     5893                        buf = ostrcat(buf, _("TPK media (media)"), 1, 0);
     5894               
    58905895                buf = ostrcat(buf, "</h1>", 1, 0);
    58915896                buf = ostrcat(buf, "<br>", 1, 0);
    58925897        }
    58935898
    5894 //      tmpstr = getabout();
    5895 //      readnewsletter();
    5896         tmpstr = readfiletomem("/tmp/Service.txt", 0);
    5897         tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0);
    5898        
    5899         tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
    5900 
    5901         buf = ostrcat(buf, tmpstr, 1, 1);
    5902 
    5903         if(fmt == 0)
    5904         {
    5905                 buf = ostrcat(buf, "</center></body></html>", 1, 0);
    5906         }       
    5907        
    5908         return buf;
    5909 }
    5910 
    5911 char* webgettpkmediainstall(int fmt)
    5912 {
    5913         if(status.security == 0) return NULL;
    5914 
    5915         char* buf = NULL, *tmpstr = NULL;
    5916 
    5917         if(fmt == 0)
    5918         {
    5919                 buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
    5920                 buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
    5921                 buf = ostrcat(buf, "</head><body class=body id=\"tpkmediainstall\"><center>", 1, 0);
    5922                 buf = ostrcat(buf, "<br>", 1, 0);
    5923                 buf = ostrcat(buf, "<h1>", 1, 0);
    5924                 buf = ostrcat(buf, _("TPK media (media)"), 1, 0);
    5925                 buf = ostrcat(buf, "</h1>", 1, 0);
    5926                 buf = ostrcat(buf, "<br>", 1, 0);
    5927         }
    5928 
    5929 //      tmpstr = getabout();
    5930 //      readnewsletter();
    5931         tmpstr = readfiletomem("/tmp/Service.txt", 0);
    5932         tmpstr = ostrcat(tmpstr, "\ncomming soon...\n", 1, 0);
    5933        
    5934         tmpstr = string_replace_all("\n", "<br>\n", tmpstr, 1);
    5935 
    5936         buf = ostrcat(buf, tmpstr, 1, 1);
     5899        if(mode == 0)
     5900                tmpstr = gettpktmplist("/tmp");
     5901        else
     5902        {
     5903                int treffer = 0;
     5904                struct hdd *node = NULL;
     5905
     5906                addhddall();
     5907                node = hdd;
     5908       
     5909                while(node != NULL)
     5910                {
     5911                        if(node->partition != 0)
     5912                        {
     5913                                tmpstr1 = ostrcat("/autofs/", node->device, 0, 0);
     5914                                tmpstr2 = gettpktmplist(tmpstr1);
     5915       
     5916                                if(tmpstr2 != NULL)
     5917                                {
     5918                                        treffer = 1;
     5919//                                      screenextensions(2, tmpstr1, NULL, 1);
     5920                                        tmpstr3 = ostrcat(tmpstr3, tmpstr1, 1, 0);                                     
     5921                                        tmpstr3 = ostrcat(tmpstr3, "\n", 1, 0);
     5922                                }
     5923       
     5924                                free(tmpstr1); tmpstr1 = NULL;
     5925                                free(tmpstr2); tmpstr2 = NULL;
     5926                        }
     5927                        node = node->next;
     5928                }
     5929       
     5930                tmpstr = gettpktmplist(tmpstr3);       
     5931                free(tmpstr3), tmpstr = NULL;
     5932        }
     5933       
     5934        if(mode == 0)
     5935        {
     5936                if(tmpstr == NULL) buf = ostrcat(buf, _("No Tpk Files Found on /tmp Directory."), 1, 0);
     5937        }
     5938        else
     5939        {
     5940                if(tmpstr == NULL) buf = ostrcat(buf, _("No Tpk Files Found on Media Devices."), 1, 0);
     5941        }
     5942
     5943        int count, i, max;
     5944        count = 0;
     5945        struct splitstr* ret1 = NULL;
     5946        ret1 = strsplit(tmpstr, "\n", &count);
     5947        max = count - 1;
     5948
     5949        buf = ostrcat(buf, "<table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
     5950 
     5951        if(ret1 != NULL)
     5952        {
     5953                for(i = 0; i <= max; i++)
     5954                {
     5955                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gettpkinstallpath&", 1, 0);
     5956                        buf = ostrcat(buf, ret1[i].part, 1, 0);
     5957                        buf = ostrcat(buf, " target=main>", 1, 0);
     5958                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
     5959                        buf = ostrcat(buf, "</a>", 1, 0);
     5960                        buf = ostrcat(buf, "</br></br>", 1, 0);
     5961                }
     5962        }
     5963
     5964        free(tmpstr), tmpstr = NULL;
     5965        free(ret1), ret1 = NULL;
     5966
     5967        buf = string_replace_all("<br>", "<br>\n", buf, 1);
    59375968
    59385969        if(fmt == 0)
Note: See TracChangeset for help on using the changeset viewer.