Fix Models and optimize Speed
This commit is contained in:
parent
36744ee505
commit
08b6ff2f13
@ -29,18 +29,22 @@ function remoteFileExists($url) {
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL) === FALSE) {
|
||||
if(!is_dir($firmware_download_path)) {
|
||||
throw new Exception("Firmwareverzeichnis existiert nicht!");
|
||||
}
|
||||
$err = 0;
|
||||
for( $i=0; $i<count($entwicklung); $i++ ) {
|
||||
for( $j=0; $j<count($installation); $j++ ) {
|
||||
$entwicklung_count = count($entwicklung);
|
||||
$installation_count = count($installation);
|
||||
for( $i=0; $i<$entwicklung_count; $i++ ) {
|
||||
for( $j=0; $j<$installation_count; $j++ ) {
|
||||
if(is_dir($firmware_download_path.$entwicklung[$i]."/")) {
|
||||
if(is_dir($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/")) {
|
||||
$variante[$entwicklung[$i]][$installation[$j]] = 1;
|
||||
$files[$entwicklung[$i]][$installation[$j]] = array_slice(scandir($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/"), 2);
|
||||
for( $x=0; $x<count($files[$entwicklung[$i]][$installation[$j]]); $x++ ) {
|
||||
$file_count = count($files[$entwicklung[$i]][$installation[$j]]);
|
||||
for( $x=0; $x<$file_count); $x++ ) {
|
||||
if(is_dir($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/".$files[$entwicklung[$i]][$installation[$j]][$x])) {
|
||||
array_splice($files[$entwicklung[$i]][$installation[$j]], $x, 1);
|
||||
$x--;
|
||||
@ -56,8 +60,8 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
}
|
||||
}
|
||||
}
|
||||
for( $i=0; $i<count($entwicklung); $i++ ) {
|
||||
for( $j=0; $j<count($installation); $j++ ) {
|
||||
for( $i=0; $i<$entwicklung_count; $i++ ) {
|
||||
for( $j=0; $j<$installation_count; $j++ ) {
|
||||
if($variante[$entwicklung[$i]][$installation[$j]] == 1) {
|
||||
$x = 0;
|
||||
while($files[$entwicklung[$i]][$installation[$j]][$x] !== false) {
|
||||
@ -73,10 +77,11 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
}
|
||||
}
|
||||
$router = array();
|
||||
for( $i=0; $i<count($entwicklung); $i++ ) {
|
||||
for( $j=0; $j<count($installation); $j++ ) {
|
||||
for( $i=0; $i<$entwicklung_count; $i++ ) {
|
||||
for( $j=0; $j<$installation_count; $j++ ) {
|
||||
if($variante[$entwicklung[$i]][$installation[$j]] == 1) {
|
||||
for( $x=0; $x<count($files[$entwicklung[$i]][$installation[$j]]); $x++) {
|
||||
$file_count = count($files[$entwicklung[$i]][$installation[$j]]);
|
||||
for( $x=0; $x<$file_count); $x++) {
|
||||
for( $y=0; $y<$anzahl_hersteller; $y++) {
|
||||
if($pos = stripos($files[$entwicklung[$i]][$installation[$j]][$x], $hersteller[$y]['filename'], $pos_hersteller[$entwicklung[$i]][$installation[$j]]-1) !== false) {
|
||||
$router_tmp[$x]['hersteller'] = $hersteller[$y]['name'];
|
||||
@ -101,7 +106,8 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
$err++;
|
||||
} else {
|
||||
$router_neu = 1;
|
||||
for( $z=0; $z<count($router); $z++) {
|
||||
$router_count = count($router);
|
||||
for( $z=0; $z<$router_count; $z++) {
|
||||
if(isset($router[$z])) {
|
||||
if((strcasecmp($router[$z]->hersteller, $router_tmp[$x]['hersteller']) == 0) && (strcasecmp($router[$z]->modell, $router_tmp[$x]['modell']) == 0) && (strcasecmp($router[$z]->version, $router_tmp[$x]['version']) == 0)) {
|
||||
$entinst = $entwicklung[$i].$installation[$j];
|
||||
@ -136,44 +142,33 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
throw new Exception("Firmwareverzeichnis offline oder nicht existent!");
|
||||
}
|
||||
|
||||
//Check if URL has index file (refer to https://forums.phpfreaks.com/topic/112764-using-scandir-on-other-websites/?p=579166 <- scandir has problem with index files)
|
||||
if ((@remoteFileExists($firmware_download_path."/index.htm"))||(@remoteFileExists($firmware_download_path."/index.html"))||(@remoteFileExists($firmware_download_path."/index.php"))) {
|
||||
throw new Exception("Firmwareverzeichnis darf keine index files besitzen!");
|
||||
}
|
||||
|
||||
$err = 0;
|
||||
for( $i=0; $i<count($entwicklung); $i++ ) {
|
||||
for( $j=0; $j<count($installation); $j++ ) {
|
||||
if(remoteFileExists($firmware_download_path.$entwicklung[$i]."/")) {
|
||||
if(@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/")) {
|
||||
//Check if URL has index file (refer to https://forums.phpfreaks.com/topic/112764-using-scandir-on-other-websites/?p=579166 <- scandir has problem with index files)
|
||||
if ((@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/index.htm"))||(@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/index.html"))||(@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/index.php"))) {
|
||||
throw new Exception("Firmwareverzeichnis darf keine index files besitzen!");
|
||||
}
|
||||
$variante[$entwicklung[$i]][$installation[$j]] = 1;
|
||||
preg_match_all('/href=[\'"]?([^\'" >]+)/', file_get_contents($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/"), $files_in_HTTP);
|
||||
foreach($files_in_HTTP["0"] as $key=>$value){
|
||||
$files_in_HTTP["0"][$key]=substr($value, 6);
|
||||
}
|
||||
$files[$entwicklung[$i]][$installation[$j]] = array_slice($files_in_HTTP["0"], 1);
|
||||
for( $x=0; $x<count($files[$entwicklung[$i]][$installation[$j]]); $x++ ) {
|
||||
if(@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/".$files[$entwicklung[$i]][$installation[$j]][$x])) {
|
||||
array_splice($files[$entwicklung[$i]][$installation[$j]], $x, 1);
|
||||
// $x--;
|
||||
} else {
|
||||
$pos = stripos($files[$entwicklung[$i]][$installation[$j]][$x], 'manifest');
|
||||
if($pos !== false) {
|
||||
array_splice($files[$entwicklung[$i]][$installation[$j]], $x, 1);
|
||||
// $x--;
|
||||
}
|
||||
}
|
||||
$entwicklung_count = count($entwicklung);
|
||||
$installation_count = count($installation);
|
||||
for( $i=0; $i<$entwicklung_count; $i++ ) {
|
||||
if (remoteFileExists($firmware_download_path.$entwicklung[$i]."/")) {
|
||||
for( $j=0; $j<$installation_count; $j++ ) {
|
||||
//Check if URL has index file (refer to https://forums.phpfreaks.com/topic/112764-using-scandir-on-other-websites/?p=579166 <- scandir has problem with index files)
|
||||
if ((@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/index.htm"))||(@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/index.html"))||(@remoteFileExists($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/index.php"))) {
|
||||
throw new Exception("Firmwareverzeichnis darf keine index files besitzen!");
|
||||
}
|
||||
$variante[$entwicklung[$i]][$installation[$j]] = 1;
|
||||
preg_match_all('/href=[\'"]?([^\'" >]+)/', file_get_contents($firmware_download_path.$entwicklung[$i]."/".$installation[$j]."/"), $files_in_HTTP);
|
||||
foreach($files_in_HTTP["0"] as $key=>$value){
|
||||
if (strpos($value, 'manifest') !== false) {
|
||||
unset($files_in_HTTP["0"][$key]);
|
||||
}
|
||||
}
|
||||
foreach($files_in_HTTP["0"] as $key=>$value){
|
||||
$files_in_HTTP["0"][$key]=substr($value, 6);
|
||||
}
|
||||
$files[$entwicklung[$i]][$installation[$j]] = array_slice($files_in_HTTP["0"], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
for( $i=0; $i<count($entwicklung); $i++ ) {
|
||||
for( $j=0; $j<count($installation); $j++ ) {
|
||||
|
||||
for( $i=0; $i<$entwicklung_count; $i++ ) {
|
||||
for( $j=0; $j<$installation_count; $j++ ) {
|
||||
if($variante[$entwicklung[$i]][$installation[$j]] == 1) {
|
||||
$x = 0;
|
||||
while($files[$entwicklung[$i]][$installation[$j]][$x] !== false) {
|
||||
@ -189,10 +184,12 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
}
|
||||
}
|
||||
$router = array();
|
||||
for( $i=0; $i<count($entwicklung); $i++ ) {
|
||||
for( $j=0; $j<count($installation); $j++ ) {
|
||||
for( $i=0; $i<$entwicklung_count; $i++ ) {
|
||||
for( $j=0; $j<$installation_count; $j++ ) {
|
||||
if($variante[$entwicklung[$i]][$installation[$j]] == 1) {
|
||||
for( $x=0; $x<count($files[$entwicklung[$i]][$installation[$j]]); $x++) {
|
||||
$file_count = count($files[$entwicklung[$i]][$installation[$j]]);
|
||||
for( $x=0; $x<$some_count; $x++) {
|
||||
$anzahl_hersteller = count($hersteller);
|
||||
for( $y=0; $y<$anzahl_hersteller; $y++) {
|
||||
if($pos = stripos($files[$entwicklung[$i]][$installation[$j]][$x], $hersteller[$y]['filename'], $pos_hersteller[$entwicklung[$i]][$installation[$j]]-1) !== false) {
|
||||
$router_tmp[$x]['hersteller'] = $hersteller[$y]['name'];
|
||||
@ -217,7 +214,8 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
$err++;
|
||||
} else {
|
||||
$router_neu = 1;
|
||||
for( $z=0; $z<count($router); $z++) {
|
||||
$router_count = count($router);
|
||||
for( $z=0; $z<$router_count; $z++) {
|
||||
if(isset($router[$z])) {
|
||||
if((strcasecmp($router[$z]->hersteller, $router_tmp[$x]['hersteller']) == 0) && (strcasecmp($router[$z]->modell, $router_tmp[$x]['modell']) == 0) && (strcasecmp($router[$z]->version, $router_tmp[$x]['version']) == 0)) {
|
||||
$entinst = $entwicklung[$i].$installation[$j];
|
||||
@ -247,8 +245,8 @@ if (filter_var($community[$community_id]["download_path"], FILTER_VALIDATE_URL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( $i=0; $i<count($router); $i++ ) { // Routerbilder einbauen
|
||||
$router_count = count($router);
|
||||
for( $i=0; $i<$router_count; $i++ ) { // Routerbilder einbauen
|
||||
if(is_dir(strtolower("router_images/".$router[$i]->hersteller))) {
|
||||
if(is_file(strtolower("router_images/".$router[$i]->hersteller."/".$router[$i]->modell."-".$router[$i]->version.".jpg"))) {
|
||||
$router[$i]->imagefront = strtolower("router_images/".$router[$i]->hersteller."/".$router[$i]->modell."-".$router[$i]->version.".jpg");
|
||||
|
Loading…
Reference in New Issue
Block a user