ソースを参照

Added some basic input validation

carlos.diaz44 4 年 前
コミット
bbf139c3c0

+ 84
- 54
platforms/android/app/src/main/assets/www/index.html ファイルの表示

259
                             //'title':'${Artesano.Nombre}','esp': '${info}'
259
                             //'title':'${Artesano.Nombre}','esp': '${info}'
260
                             //Tries to pass all the info of each artesano into a new page, the page that display this information is 'artesano.html', not to be confused with 'artesanias.html' or 'artesanos.html'(current page)
260
                             //Tries to pass all the info of each artesano into a new page, the page that display this information is 'artesano.html', not to be confused with 'artesanias.html' or 'artesanos.html'(current page)
261
                             //And puts this into the 'item' variable
261
                             //And puts this into the 'item' variable
262
-                            var item = ons.createElement(`<ons-list-item onclick="myNavigator.pushPage('artesano.html', { data: { title: '${Artesano.Nombre.replace(/"/g, " ")}', mun: '${Artesano.Municipio}', tel: '${Artesano["Telefono 1"]}', email: '${Artesano["Email"]}', esp: '${Artesano.Especificacion}', redes: '${Artesano["E-Commerce 1"]}', tecnicas: '${Artesano["Tecnica"]}' } })" tappable>
262
+                            var item = ons.createElement(`<ons-list-item onclick="myNavigator.pushPage('artesano.html', { data: { title: '${Artesano.Nombre.replace(/"/g, " ")}', mun: '${Artesano.Municipio}', tel: '${Artesano["Telefono 1"]}', email: '${Artesano["Email"]}', esp: '${Artesano.Especificacion}', red1: '${Artesano["Red Social 1"]}', red2: '${Artesano["Red Social 2"]}', ecom: '${Artesano["E-Commerce 1"]}', tecnicas: '${Artesano["Tecnica"]}' } })" tappable>
263
                         <div class="title">${Artesano.Nombre}</div>
263
                         <div class="title">${Artesano.Nombre}</div>
264
                     </ons-list-item>`);
264
                     </ons-list-item>`);
265
 
265
 
364
                              });*/
364
                              });*/
365
 
365
 
366
                              for(var i=0; i<results.length; i++) {
366
                              for(var i=0; i<results.length; i++) {
367
-
367
+                                
368
                                  //if(Esp[num] in artesanos_json.) {}
368
                                  //if(Esp[num] in artesanos_json.) {}
369
                                  //results[i].Nombre = results[i].Nombre + " " + results[i]["Apellido Paterno"] + " " + results[i]["Apellido Materno"]
369
                                  //results[i].Nombre = results[i].Nombre + " " + results[i]["Apellido Paterno"] + " " + results[i]["Apellido Materno"]
370
                                  ANombre = results[i].Nombre + " " + results[i]["Apellido Paterno"] + " " + results[i]["Apellido Materno"]
370
                                  ANombre = results[i].Nombre + " " + results[i]["Apellido Paterno"] + " " + results[i]["Apellido Materno"]
371
                                  Artesanos+=`${ANombre}|`
371
                                  Artesanos+=`${ANombre}|`
372
-                                 ArtesanosInfo+=`${results[i].Municipio}|${results[i]["Telefono 1"]}|${results[i]["Email"]}|${results[i].Especificacion}|${results[i]["Tecnica"]}&&`
372
+                                 ArtesanosInfo+=`${results[i].Municipio}|${results[i]["Telefono 1"]}|${results[i]["Email"]}|${results[i].Especificacion}|${results[i]["E-Commerce 1"]}|${results[i]["Red Social 1"]}|${results[i]["Red Social 2"]}|${results[i]["Tecnica"]}&&`
373
                                  //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
373
                                  //`<a id='home.html'>${Artesania.artesano} | ${Artesania.municipio}</a> `
374
-                             }
374
+                                }
375
 
375
 
376
                              return {
376
                              return {
377
                                  name: Esp[num],
377
                                  name: Esp[num],
400
                                      tel = lot[1],
400
                                      tel = lot[1],
401
                                      email = lot[2],
401
                                      email = lot[2],
402
                                      esp = lot[3],
402
                                      esp = lot[3],
403
-                                     redes = lot[4],
404
-                                     tecnicas = lot[5];
403
+                                     ecom = lot[4],
404
+                                     red1 = lot[5];
405
+                                     red2 = lot[6];
406
+                                     tecnicas = lot[7]
407
+                                     console.log(lot)
405
 
408
 
406
-                                 listaArt += `<ons-item tappable onclick="myNavigator.pushPage('artesano.html', {data: {title:'${arts[i].replace(/"/g, " ")}', mun: '${mun}', tel: '${tel}', email: '${email}', esp: '${esp}', redes: '${redes}', tecnicas: '${tecnicas}' }} )" ><div class="center">`+ arts[i] +`</div></ons-item><br>`;
409
+                                 listaArt += `<ons-item tappable onclick="myNavigator.pushPage('artesano.html', {data: {title:'${arts[i].replace(/"/g, " ")}', mun: '${mun}', tel: '${tel}', email: '${email}', esp: '${esp}', red1: '${red1}', red2: '${red2}', ecom: '${ecom}', tecnicas: '${tecnicas}' }} )" ><div class="center">`+ arts[i] +`</div></ons-item><br>`;
407
                              }
410
                              }
408
 
411
 
409
                              if (Artesania.name == "Figuras y simbolos indigenas") {
412
                              if (Artesania.name == "Figuras y simbolos indigenas") {
410
                                  Artesania.name = "Figuras y símbolos indígenas";
413
                                  Artesania.name = "Figuras y símbolos indígenas";
411
                              } 
414
                              } 
412
 
415
 
413
-                             console.log(Artesania.name);
416
+        
414
 
417
 
415
                              return ons.createElement(`
418
                              return ons.createElement(`
416
               <ons-list-item expandable tappable>
419
               <ons-list-item expandable tappable>
469
                 var inputarte = document.getElementById('searchartesania').value;
472
                 var inputarte = document.getElementById('searchartesania').value;
470
                 var inputmuni = document.getElementById('searchbarmunicipio').value;
473
                 var inputmuni = document.getElementById('searchbarmunicipio').value;
471
                 var x = document.getElementsByClassName('artists');
474
                 var x = document.getElementsByClassName('artists');
475
+
476
+                //validating input so that its not as easy to attack
477
+                input = input_validation(input);
478
+                inputarte = input_validation(inputarte);
479
+                inputmuni = input_validation(inputmuni);
472
                 //just making sure everything is at the same format by taking out special characters, trimming it and putting it in lowercase (same thing will be done to the arguments it's being compared to later on)
480
                 //just making sure everything is at the same format by taking out special characters, trimming it and putting it in lowercase (same thing will be done to the arguments it's being compared to later on)
473
                 //acento_replace(): it's a function I made that takes out any special characters of a word and changes them back to the plain ones (quitar acentos o cosas asi)
481
                 //acento_replace(): it's a function I made that takes out any special characters of a word and changes them back to the plain ones (quitar acentos o cosas asi)
474
                 input = input.trim().toLowerCase();
482
                 input = input.trim().toLowerCase();
551
                     for (i = 0; i < all_artesanos.length;i++){
559
                     for (i = 0; i < all_artesanos.length;i++){
552
                         all_artesanos[i].Nombre = all_artesanos[i].Nombre +  " " + all_artesanos[i]["Apellido Paterno"] + " " + all_artesanos[i]["Apellido Materno"];
560
                         all_artesanos[i].Nombre = all_artesanos[i].Nombre +  " " + all_artesanos[i]["Apellido Paterno"] + " " + all_artesanos[i]["Apellido Materno"];
553
                         var artesano = ons.createElement(`<ons-list-item class = "artists"
561
                         var artesano = ons.createElement(`<ons-list-item class = "artists"
554
-                        onclick="SNavigator.pushPage('artesano_s.html', { data: {title: '${all_artesanos[i].Nombre.replace(/"/g, " ")}', mun: '${all_artesanos[i].Municipio}', tel: '${all_artesanos[i]["Telefono 1"]}', email: '${all_artesanos[i]["Email"]}', esp: '${all_artesanos[i].Especificacion}', redes: '${all_artesanos[i]["E-Commerce 1"]}', tecnicas: '${all_artesanos[i]["Tecnica"]}' } })" tappable>
562
+                        onclick="SNavigator.pushPage('artesano_s.html', { data: {title: '${all_artesanos[i].Nombre.replace(/"/g, " ")}', mun: '${all_artesanos[i].Municipio}', tel: '${all_artesanos[i]["Telefono 1"]}', email: '${all_artesanos[i]["Email"]}', esp: '${all_artesanos[i].Especificacion}', red1: '${all_artesanos[i]["Red Social 1"]}', red2: '${all_artesanos[i]["Red Social 2"]}', ecom: '${all_artesanos[i]["E-Commerce 1"]}', tecnicas: '${all_artesanos[i]["Tecnica"]}' } })" tappable>
555
                         <div>${all_artesanos[i].Nombre}</div>
563
                         <div>${all_artesanos[i].Nombre}</div>
556
                     </ons-list-item>`);
564
                     </ons-list-item>`);
557
                         document.getElementById('results').appendChild(artesano);
565
                         document.getElementById('results').appendChild(artesano);
587
                             tel = this.data.tel,
595
                             tel = this.data.tel,
588
                             em = this.data.email,
596
                             em = this.data.email,
589
                             esp = this.data.esp,
597
                             esp = this.data.esp,
590
-                            redes = this.data.redes,
598
+                            red1 = this.data.red1,
599
+                            red2 = this.data.red2,
600
+                            ecom = this.data.ecom,
591
                             tecnicas = this.data.tecnicas;
601
                             tecnicas = this.data.tecnicas;
592
 
602
 
603
+                            
604
+
593
                         //here the email is the string made from the start to where the '#' is.
605
                         //here the email is the string made from the start to where the '#' is.
594
                         
606
                         
595
 
607
 
638
                             data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
650
                             data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
639
                         }
651
                         }
640
 
652
 
641
-                        console.log("Redes: "+redes);
653
+                        
642
 
654
 
643
                         //Here it has to decide what to do depending on the links they give to their social media pages
655
                         //Here it has to decide what to do depending on the links they give to their social media pages
644
                         //if the link is to a facebook, instagram or myspace account then it will show the picture of the social media site, and when you click the picture then the app redirects you to their social media.
656
                         //if the link is to a facebook, instagram or myspace account then it will show the picture of the social media site, and when you click the picture then the app redirects you to their social media.
645
-                        //The alt attribute is required for images, it's in case theres no internet connection, then it will display that tet instead, I think screen readers can also read that text
646
-                        //If the link is to another website (but isn't a mailto link) then it will display a default picture we chose to display a default web browser, like the other ones clikcing on it will take you to the link.
657
+                        
658
+                        
647
                         //If it's none of them then it will not display anything
659
                         //If it's none of them then it will not display anything
648
-                        if(redes.includes("facebook")){
649
-
650
-                            console.log(redes.substring(1,redes.length-2));
651
-                            data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;"><br>';
660
+                        //First Social Media
661
+                        if(red1.includes("facebook")){
662
+                            data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
652
                         }
663
                         }
653
-                        else if(redes.includes("instagram")){
654
-                            console.log(redes.substring(1,redes.length-2));
655
-                            data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;"><br>';
664
+                        else if(red1.includes("instagram")){
665
+                            data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
656
                         }
666
                         }
657
-                        else if(redes.includes("myspace")){
658
-                            console.log(redes.substring(1,redes.length-2));
659
-                            data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;"><br>';
667
+                        else if(red1.includes("myspace")){
668
+                            data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
660
                         }
669
                         }
661
-                        else if((redes.includes(".org") || redes.includes(".com")) && !redes.includes("mailto")){
662
-                            redes = redes.substr(redes.indexOf("#")+1,redes.length);
663
-                            redes = redes.substr(0, redes.length-1);
664
-                            console.log(redes);
665
-                            data+='<br><a href="'+ redes + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;"><br>';
670
+
671
+                        //Second Social Media
672
+                        if(red2.includes("facebook")){
673
+                            data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
674
+                        }
675
+                        else if(red2.includes("instagram")){
676
+                            data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
666
                         }
677
                         }
667
-                        else if(redes.includes("#") || redes.includes("mailto")){
668
-                            console.log("tiene un disparate");
669
-                        } else {
670
-                            console.log("no tiene nada");
678
+                        else if(red2.includes("myspace")){
679
+                            data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
671
                         }
680
                         }
681
+                        
682
+                        //E-commerce 
683
+                        if ((ecom.includes(".org") || ecom.includes(".com")) && !ecom.includes("mailto")){
684
+                            ecom = ecom.substr(ecom.indexOf("#")+1,ecom.length);
685
+                            ecom = ecom.substr(0, ecom.length-1);
686
+                            
687
+                            data+='<a href="'+ ecom + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;">';
688
+                        }
689
+                        
672
 
690
 
673
                         //This is the part that allows eveything (data) to be displayed
691
                         //This is the part that allows eveything (data) to be displayed
674
                         document.getElementById("all").innerHTML = `${data}`;
692
                         document.getElementById("all").innerHTML = `${data}`;
701
                             tel = this.data.tel,
719
                             tel = this.data.tel,
702
                             em = this.data.email,
720
                             em = this.data.email,
703
                             esp = this.data.esp,
721
                             esp = this.data.esp,
704
-                            redes = this.data.redes,
722
+                            red1 = this.data.red1,
723
+                            red2 = this.data.red2,
724
+                            ecom = this.data.ecom,
705
                             tecnicas = this.data.tecnicas;
725
                             tecnicas = this.data.tecnicas;
706
 
726
 
707
                         //here the email is the string made from the start to where the '#' is.
727
                         //here the email is the string made from the start to where the '#' is.
711
                         //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
731
                         //if it has many especificaciones then it will replace all the ';' in it with ',' and writes it into the page
712
                         //but if theres only one then you just write it into the page
732
                         //but if theres only one then you just write it into the page
713
                         if(esp.trim() != ""){
733
                         if(esp.trim() != ""){
734
+
735
+                            if(esp.includes("Figuras y simbolos indigenas")) {
736
+                                esp = esp.replace("Figuras y simbolos indigenas", "Figuras y símbolos indígenas")
737
+                            }
738
+
714
                             if(esp.includes(";", 0)){
739
                             if(esp.includes(";", 0)){
715
                                 esp=esp.replace(/;/g,", ");
740
                                 esp=esp.replace(/;/g,", ");
716
                                 data+='Tipos de artesanías: '+esp+'<br>';
741
                                 data+='Tipos de artesanías: '+esp+'<br>';
746
                             data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
771
                             data+='Tel\u00e9fono: <a style="color:blue" href="tel: '+ tel +'"><u>'+ tel +'</u></a><br>';
747
                         }
772
                         }
748
 
773
 
749
-                        console.log("Redes: "+redes);
774
+                        
750
 
775
 
751
                         //Here it has to decide what to do depending on the links they give to their social media pages
776
                         //Here it has to decide what to do depending on the links they give to their social media pages
752
                         //if the link is to a facebook, instagram or myspace account then it will show the picture of the social media site, and when you click the picture then the app redirects you to their social media.
777
                         //if the link is to a facebook, instagram or myspace account then it will show the picture of the social media site, and when you click the picture then the app redirects you to their social media.
753
                         //The alt attribute is required for images, it's in case theres no internet connection, then it will display that tet instead, I think screen readers can also read that text
778
                         //The alt attribute is required for images, it's in case theres no internet connection, then it will display that tet instead, I think screen readers can also read that text
754
                         //If the link is to another website (but isn't a mailto link) then it will display a default picture we chose to display a default web browser, like the other ones clikcing on it will take you to the link.
779
                         //If the link is to another website (but isn't a mailto link) then it will display a default picture we chose to display a default web browser, like the other ones clikcing on it will take you to the link.
755
                         //If it's none of them then it will not display anything
780
                         //If it's none of them then it will not display anything
756
-                        if(redes.includes("facebook")){
757
-
758
-                            console.log(redes.substring(1,redes.length-2));
759
-                            data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;"><br>';
781
+                        if(red1.includes("facebook")){
782
+                            data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
783
+                        }
784
+                        else if(red1.includes("instagram")){
785
+                            data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
760
                         }
786
                         }
761
-                        else if(redes.includes("instagram")){
762
-                            console.log(redes.substring(1,redes.length-2));
763
-                            data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;"><br>';
787
+                        else if(red1.includes("myspace")){
788
+                            data+='<a style="margin-right:10px;" href="'+ red1 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
789
+                        }
790
+
791
+                        //Second Social Media
792
+                        if(red2.includes("facebook")){
793
+                            data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/facebook.png" alt="Facebook"style="width:35px;height:35px;border:0;">';
764
                         }
794
                         }
765
-                        else if(redes.includes("myspace")){
766
-                            console.log(redes.substring(1,redes.length-2));
767
-                            data+='<br><a href="'+ redes.substring(1,redes.length-2) + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;"><br>';
795
+                        else if(red2.includes("instagram")){
796
+                            data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/instagram.png" alt="Instagram"style="width:35px;height:35px;border:0;">';
768
                         }
797
                         }
769
-                        else if((redes.includes(".org") || redes.includes(".com")) && !redes.includes("mailto")){
770
-                            redes = redes.substr(redes.indexOf("#")+1,redes.length);
771
-                            redes = redes.substr(0, redes.length-1);
772
-                            console.log(redes);
773
-                            data+='<br><a href="'+ redes + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;"><br>';
798
+                        else if(red2.includes("myspace")){
799
+                            data+='<a style="margin-right:10px;" href="'+ red2 + '"><img src="img/MySpace.png" alt="MySpace"style="width:35px;height:35px;border:0;">';
774
                         }
800
                         }
775
-                        else if(redes.includes("#") || redes.includes("mailto")){
776
-                            console.log("tiene un disparate");
777
-                        } else {
778
-                            console.log("no tiene nada");
801
+
802
+
803
+                        if((ecom.includes(".org") || ecom.includes(".com")) && !ecom.includes("mailto")){
804
+                            ecom = ecom.substr(ecom.indexOf("#")+1,ecom.length);
805
+                            ecom = ecom.substr(0, ecom.length-1);
806
+
807
+                            data+='<a href="'+ ecom + '"><img src="img/internet.jpg" style="width:35px;height:35px;border:0;">';
779
                         }
808
                         }
809
+                        
780
 
810
 
781
                         //This is the part that allows eveything (data) to be displayed
811
                         //This is the part that allows eveything (data) to be displayed
782
                         document.getElementById("all2").innerHTML = `${data}`;
812
                         document.getElementById("all2").innerHTML = `${data}`;
840
                 </div>
870
                 </div>
841
                 <br><br>
871
                 <br><br>
842
                 <div id="button" style="text-align: center">
872
                 <div id="button" style="text-align: center">
843
-                <button onclick="redirect()">Pasar a la página de eventos</button>
873
+                <ons-button onclick="redirect()" modifier="large" style="background-color: #00abc1;"> Pasar a la página de eventos </ons-button>
844
                 </div>
874
                 </div>
845
                 <br><br>
875
                 <br><br>
846
                 <div id="Mensaje">
876
                 <div id="Mensaje">

+ 6
- 1
platforms/android/app/src/main/assets/www/js/index.js ファイルの表示

28
     // 'pause', 'resume', etc.
28
     // 'pause', 'resume', etc.
29
     onDeviceReady: function() {
29
     onDeviceReady: function() {
30
 
30
 
31
-        if (ons.platform.isIPhone()) { 
31
+        //A list of device models that have notches that interfere with page content.
32
+        //OnsenUi has the isIPhoneX boolean value, however, it does not detect IPhone 11 or 12 types. 
33
+        var notchDevices = ["iPhone12,1", "iPhone12,3", "iPhone12,5", "iPhone13,1", "iPhone13,2", "iPhone13,3", "iPhone13,4"]
34
+
35
+
36
+        if (ons.platform.isIPhoneX() || notchDevices.includes(device.model)) { 
32
             document.documentElement.setAttribute('onsflag-iphonex-portrait', '');
37
             document.documentElement.setAttribute('onsflag-iphonex-portrait', '');
33
             document.documentElement.setAttribute('onsflag-iphonex-landscape', '');
38
             document.documentElement.setAttribute('onsflag-iphonex-landscape', '');
34
         }
39
         }

+ 9
- 3
platforms/android/app/src/main/assets/www/js/saveLocal.js ファイルの表示

1
-localStorage.setItem("RENGLONES", loadFile("https://artesaniaspr.website/renglones2.json"));
2
-localStorage.setItem("AZAR", loadFile("https://artesaniaspr.website/azar.json"));
1
+try {
2
+  localStorage.setItem("RENGLONES", loadFile("https://artesaniaspr.website/renglones2.json"));
3
+  localStorage.setItem("AZAR", loadFile("https://artesaniaspr.website/azar.json"));
4
+  
5
+} catch {
6
+  console.log("Files not found")
7
+}
8
+
3
 let renglones = JSON.parse(window.localStorage.getItem("RENGLONES"));
9
 let renglones = JSON.parse(window.localStorage.getItem("RENGLONES"));
4
 
10
 
5
 //A synchronous request to the server 
11
 //A synchronous request to the server 
18
 //Checks if date has changed in the server or if number or renglones has been shortened (since local storage can be erased when the device runs out of memory)
24
 //Checks if date has changed in the server or if number or renglones has been shortened (since local storage can be erased when the device runs out of memory)
19
 function checkDate() {
25
 function checkDate() {
20
   var date = loadFile("https://artesaniaspr.website/date.txt");
26
   var date = loadFile("https://artesaniaspr.website/date.txt");
21
-  if (localStorage.getItem("DATE") == null || localStorage.getItem("DATE") != date || localStorage.length < 17) {
27
+  if (localStorage.getItem("DATE") == null || localStorage.getItem("DATE") != date || localStorage.length < 18) {
22
   localStorage.setItem("DATE", date);
28
   localStorage.setItem("DATE", date);
23
     return false;
29
     return false;
24
   }
30
   }

+ 16
- 1
platforms/android/app/src/main/assets/www/js/searchfunctions.js ファイルの表示

280
             }
280
             }
281
         }
281
         }
282
     }
282
     }
283
-    return string;
283
+    return string;   
284
+}
285
+function input_validation(input){
286
+    if (input.length > 40){
287
+        input = "";
288
+        return input;
289
+    }
290
+    else if (input.search('<') != -1){
291
+        input = "";
292
+        return input;
293
+    }
294
+    else if (input.search('>') != -1){
295
+    	input = "";
296
+    	return input;
297
+    }
298
+    return input;
284
 }
299
 }

+ 6
- 0
www/index.html ファイルの表示

472
                 var inputarte = document.getElementById('searchartesania').value;
472
                 var inputarte = document.getElementById('searchartesania').value;
473
                 var inputmuni = document.getElementById('searchbarmunicipio').value;
473
                 var inputmuni = document.getElementById('searchbarmunicipio').value;
474
                 var x = document.getElementsByClassName('artists');
474
                 var x = document.getElementsByClassName('artists');
475
+
476
+                //validating input so that its not as easy to attack
477
+                //no acepta strings mayores que 40 caracteres y no acepta '>' o '<' en el string
478
+                input = input_validation(input);
479
+                inputarte = input_validation(inputarte);
480
+                inputmuni = input_validation(inputmuni);
475
                 //just making sure everything is at the same format by taking out special characters, trimming it and putting it in lowercase (same thing will be done to the arguments it's being compared to later on)
481
                 //just making sure everything is at the same format by taking out special characters, trimming it and putting it in lowercase (same thing will be done to the arguments it's being compared to later on)
476
                 //acento_replace(): it's a function I made that takes out any special characters of a word and changes them back to the plain ones (quitar acentos o cosas asi)
482
                 //acento_replace(): it's a function I made that takes out any special characters of a word and changes them back to the plain ones (quitar acentos o cosas asi)
477
                 input = input.trim().toLowerCase();
483
                 input = input.trim().toLowerCase();

+ 16
- 1
www/js/searchfunctions.js ファイルの表示

280
             }
280
             }
281
         }
281
         }
282
     }
282
     }
283
-    return string;
283
+    return string;   
284
+}
285
+function input_validation(input){
286
+    if (input.length > 40){
287
+        input = "";
288
+        return input;
289
+    }
290
+    else if (input.search('<') != -1){
291
+        input = "";
292
+        return input;
293
+    }
294
+    else if (input.search('>') != -1){
295
+    	input = "";
296
+    	return input;
297
+    }
298
+    return input;
284
 }
299
 }