From 08b6ff2f13e7759511fe265dfc37861f5fc1a8df Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 23 Oct 2016 20:30:19 +0200 Subject: [PATCH] Fix Models and optimize Speed --- ffrouter_parsen.function.php | 92 ++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/ffrouter_parsen.function.php b/ffrouter_parsen.function.php index 7ebb863..7029d7c 100644 --- a/ffrouter_parsen.function.php +++ b/ffrouter_parsen.function.php @@ -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; $ihersteller, $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]+)/', 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]+)/', 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; $ihersteller, $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; $ihersteller))) { 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");