[FIX] Überspringt nun unbekannte Hersteller und löscht die Optionen wieder, wenn weiter vorne etwas Neues ausgewählt wurde

This commit is contained in:
Caspar Armster 2016-05-09 16:36:52 +02:00
parent bd8aa03fe7
commit 655775e460

112
index.php
View File

@ -209,6 +209,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['beta']['factory'][$i], $pos_hersteller+2, stripos($files['beta']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-2)); $router_tmp[$i]['modell'] = strtoupper(substr($files['beta']['factory'][$i], $pos_hersteller+2, stripos($files['beta']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-2));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router[$i]['hersteller'] = $router_tmp[$i]['hersteller']; $router[$i]['hersteller'] = $router_tmp[$i]['hersteller'];
$router[$i]['version'] = $router_tmp[$i]['version']; $router[$i]['version'] = $router_tmp[$i]['version'];
$router[$i]['modell'] = $router_tmp[$i]['modell']; $router[$i]['modell'] = $router_tmp[$i]['modell'];
@ -223,6 +226,7 @@ EOT;
$router[$i]['betafactorylink'] = $firmware_download_path."beta/factory/".$files['beta']['factory'][$i]; $router[$i]['betafactorylink'] = $firmware_download_path."beta/factory/".$files['beta']['factory'][$i];
} }
} }
}
$router_tmp = array(); $router_tmp = array();
if($variante['beta']['sysupgrade'] == 1) { if($variante['beta']['sysupgrade'] == 1) {
for( $i=0; $i<count($files['beta']['sysupgrade']); $i++) { for( $i=0; $i<count($files['beta']['sysupgrade']); $i++) {
@ -296,6 +300,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['beta']['sysupgrade'][$i], $pos_hersteller+2, stripos($files['beta']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-13)); $router_tmp[$i]['modell'] = strtoupper(substr($files['beta']['sysupgrade'][$i], $pos_hersteller+2, stripos($files['beta']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-13));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) { if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) {
@ -320,6 +327,7 @@ EOT;
} }
} }
} }
}
$router_tmp = array(); $router_tmp = array();
if($variante['broken']['factory'] == 1) { if($variante['broken']['factory'] == 1) {
for( $i=0; $i<count($files['broken']['factory']); $i++) { for( $i=0; $i<count($files['broken']['factory']); $i++) {
@ -393,6 +401,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['broken']['factory'][$i], $pos_hersteller+4, stripos($files['broken']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-4)); $router_tmp[$i]['modell'] = strtoupper(substr($files['broken']['factory'][$i], $pos_hersteller+4, stripos($files['broken']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-4));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) { if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) {
@ -417,6 +428,7 @@ EOT;
} }
} }
} }
}
$router_tmp = array(); $router_tmp = array();
if($variante['broken']['sysupgrade'] == 1) { if($variante['broken']['sysupgrade'] == 1) {
for( $i=0; $i<count($files['broken']['sysupgrade']); $i++) { for( $i=0; $i<count($files['broken']['sysupgrade']); $i++) {
@ -490,6 +502,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['broken']['sysupgrade'][$i], $pos_hersteller+4, stripos($files['broken']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-15)); $router_tmp[$i]['modell'] = strtoupper(substr($files['broken']['sysupgrade'][$i], $pos_hersteller+4, stripos($files['broken']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-15));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) { if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) {
@ -514,6 +529,7 @@ EOT;
} }
} }
} }
}
$router_tmp = array(); $router_tmp = array();
if($variante['experimental']['factory'] == 1) { if($variante['experimental']['factory'] == 1) {
for( $i=0; $i<count($files['experimental']['factory']); $i++) { for( $i=0; $i<count($files['experimental']['factory']); $i++) {
@ -587,6 +603,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['experimental']['factory'][$i], $pos_hersteller+1, stripos($files['experimental']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-1)); $router_tmp[$i]['modell'] = strtoupper(substr($files['experimental']['factory'][$i], $pos_hersteller+1, stripos($files['experimental']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-1));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) { if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) {
@ -611,6 +630,7 @@ EOT;
} }
} }
} }
}
$router_tmp = array(); $router_tmp = array();
if($variante['experimental']['sysupgrade'] == 1) { if($variante['experimental']['sysupgrade'] == 1) {
for( $i=0; $i<count($files['experimental']['sysupgrade']); $i++) { for( $i=0; $i<count($files['experimental']['sysupgrade']); $i++) {
@ -684,6 +704,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['experimental']['sysupgrade'][$i], $pos_hersteller+1, stripos($files['experimental']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-12)); $router_tmp[$i]['modell'] = strtoupper(substr($files['experimental']['sysupgrade'][$i], $pos_hersteller+1, stripos($files['experimental']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-12));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) { if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) {
@ -708,6 +731,7 @@ EOT;
} }
} }
} }
}
$router_tmp = array(); $router_tmp = array();
if($variante['stable']['factory'] == 1) { if($variante['stable']['factory'] == 1) {
for( $i=0; $i<count($files['stable']['factory']); $i++) { for( $i=0; $i<count($files['stable']['factory']); $i++) {
@ -781,6 +805,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['stable']['factory'][$i], $pos_hersteller+4, stripos($files['stable']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-4)); $router_tmp[$i]['modell'] = strtoupper(substr($files['stable']['factory'][$i], $pos_hersteller+4, stripos($files['stable']['factory'][$i], ".", $pos_hersteller+2)-$pos_hersteller-4));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) { if((strcasecmp($router[$j]['hersteller'], $router_tmp[$i]['hersteller']) == 0) && (strcasecmp($router[$j]['modell'], $router_tmp[$i]['modell']) == 0) && (strcasecmp($router[$j]['version'], $router_tmp[$i]['version']) == 0)) {
@ -805,6 +832,7 @@ EOT;
} }
} }
} }
}
//print_r($files['stable']['sysupgrade']); //print_r($files['stable']['sysupgrade']);
$router_tmp = array(); $router_tmp = array();
if($variante['stable']['sysupgrade'] == 1) { if($variante['stable']['sysupgrade'] == 1) {
@ -879,6 +907,9 @@ EOT;
$router_tmp[$i]['version'] = "Alle"; $router_tmp[$i]['version'] = "Alle";
$router_tmp[$i]['modell'] = strtoupper(substr($files['stable']['sysupgrade'][$i], $pos_hersteller+4, stripos($files['stable']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-15)); $router_tmp[$i]['modell'] = strtoupper(substr($files['stable']['sysupgrade'][$i], $pos_hersteller+4, stripos($files['stable']['sysupgrade'][$i], ".", $pos_hersteller+2)-$pos_hersteller-15));
} }
if(isset($router_tmp[$i]['hersteller']) != true) {
echo("Unbekannten Hersteller im Dateinamen gefunden, bitte Script updaten!");
} else {
$router_neu = 1; $router_neu = 1;
//echo("Hersteller: ".$router_tmp[$i]['hersteller']." Modell: ".$router_tmp[$i]['modell']." Version: ".$router_tmp[$i]['version']."<br />"); //echo("Hersteller: ".$router_tmp[$i]['hersteller']." Modell: ".$router_tmp[$i]['modell']." Version: ".$router_tmp[$i]['version']."<br />");
for( $j=0; $j<count($router); $j++) { for( $j=0; $j<count($router); $j++) {
@ -904,10 +935,9 @@ EOT;
} }
} }
} }
//print_r($router); }
//echo("i: ".$i." j: ".$j."<br />");
} catch(Exception $e) { } catch(Exception $e) {
echo("Fehler: ".$e); echo("Fehler: ".$e->getMessage());
die(); die();
} }
@ -916,6 +946,10 @@ EOT;
function populateA(s1,s2){ function populateA(s1,s2){
var s1 = document.getElementById(s1); var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2); var s2 = document.getElementById(s2);
var s3 = document.getElementById("slct3");
var s4 = document.getElementById("slct4");
var s5 = document.getElementById("slct5");
var s6 = document.getElementById("slct6");
s2.innerHTML = ""; s2.innerHTML = "";
EOT; EOT;
for( $i=0; $i<count($hersteller); $i++) { for( $i=0; $i<count($hersteller); $i++) {
@ -948,10 +982,30 @@ EOT;
newOption.innerHTML = pair[1]; newOption.innerHTML = pair[1];
s2.options.add(newOption); s2.options.add(newOption);
} }
while(s3.length > 1) {
s3.remove(s3.length-1);
}
while(s4.length > 1) {
s4.remove(s4.length-1);
}
while(s5.length > 1) {
s5.remove(s5.length-1);
}
s6.href = "#";
s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' );
s6.className += " btn-primary disabled";
s6.innerHTML = "Download Firmware";
} }
function populateB(s1,s2){ function populateB(s1,s2){
var s1 = document.getElementById(s1); var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2); var s2 = document.getElementById(s2);
var s4 = document.getElementById("slct4");
var s5 = document.getElementById("slct5");
var s6 = document.getElementById("slct6");
s2.innerHTML = ""; s2.innerHTML = "";
EOT; EOT;
$i=0; $i=0;
@ -981,10 +1035,26 @@ EOT;
newOption.innerHTML = pair[1]; newOption.innerHTML = pair[1];
s2.options.add(newOption); s2.options.add(newOption);
} }
while(s4.length > 1) {
s4.remove(s4.length-1);
}
while(s5.length > 1) {
s5.remove(s5.length-1);
}
s6.href = "#";
s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' );
s6.className += " btn-primary disabled";
s6.innerHTML = "Download Firmware";
} }
function populateC(s1,s2){ function populateC(s1,s2){
var s1 = document.getElementById(s1); var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2); var s2 = document.getElementById(s2);
var s5 = document.getElementById("slct5");
var s6 = document.getElementById("slct6");
s2.innerHTML = ""; s2.innerHTML = "";
EOT; EOT;
$i=0; $i=0;
@ -1009,10 +1079,22 @@ EOT;
newOption.innerHTML = pair[1]; newOption.innerHTML = pair[1];
s2.options.add(newOption); s2.options.add(newOption);
} }
while(s5.length > 1) {
s5.remove(s5.length-1);
}
s6.href = "#";
s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' );
s6.className += " btn-primary disabled";
s6.innerHTML = "Download Firmware";
} }
function populateD(s1,s2){ function populateD(s1,s2){
var s1 = document.getElementById(s1); var s1 = document.getElementById(s1);
var s2 = document.getElementById(s2); var s2 = document.getElementById(s2);
var s6 = document.getElementById("slct6");
s2.innerHTML = ""; s2.innerHTML = "";
EOT; EOT;
$i=0; $i=0;
@ -1059,6 +1141,14 @@ EOT;
newOption.innerHTML = pair[1]; newOption.innerHTML = pair[1];
s2.options.add(newOption); s2.options.add(newOption);
} }
s6.href = "#";
s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' );
s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' );
s6.className += " btn-primary disabled";
s6.innerHTML = "Download Firmware";
} }
function populateE(s1,s2){ function populateE(s1,s2){
var s1 = document.getElementById(s1); var s1 = document.getElementById(s1);
@ -1139,7 +1229,7 @@ EOT;
Freifunk Hennef Firmware Freifunk Hennef Firmware
</h2> </h2>
<p> <p>
Auf dieser Seite können Sie die passende Firmware für ihren Router auswählen und herunterladen! Auf dieser Seite können Sie die passende Firmware für ihren Router in Hennef auswählen und herunterladen!
</p> </p>
<p> <p>
<a class="btn btn-primary btn-large" href="http://www.freifunk-hennef.de/">Zurück zur Startseite</a> <a class="btn btn-primary btn-large" href="http://www.freifunk-hennef.de/">Zurück zur Startseite</a>
@ -1160,7 +1250,7 @@ EOT;
Legen Sie anschließend fest, ob sie den Router zum ersten Mal mit einer Freifunk Firmware flashen und welches Entwicklungsstadium die Firmware haben soll. Legen Sie anschließend fest, ob sie den Router zum ersten Mal mit einer Freifunk Firmware flashen und welches Entwicklungsstadium die Firmware haben soll.
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
Bitte wählen Sie nur "stable" im Entwicklungsstadium aus, wenn Sie nicht genau wissen was Sie sonst erwartet! Bitte wählen Sie "stable" im Entwicklungsstadium aus, wenn Sie nicht genau wissen was Sie sonst erwartet!
</div> </div>
</div> </div>
</div> </div>
@ -1170,7 +1260,7 @@ EOT;
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
Router Hersteller: Router Hersteller
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -1191,7 +1281,7 @@ EOT;
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
Router Modell: Router Modell
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -1205,7 +1295,7 @@ EOT;
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
Router Version: Router Version
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -1221,7 +1311,7 @@ EOT;
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
Firmware Erstinstallation: Firmware Erstinstallation
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -1235,7 +1325,7 @@ EOT;
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
Firmware Entwicklungsstadium: Firmware Entwicklungsstadium
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -1249,7 +1339,7 @@ EOT;
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"> <h3 class="panel-title">
Firmware Download: Firmware Download
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">