fixed the url parser so all urlhandlers have ^ tacked to the start
[glcas.git] / plugins / repo.php
index 54f3557..55eaed3 100644 (file)
@@ -746,7 +746,16 @@ class GLCASRepo {
                        $content .= "<table>";
                        $dh = opendir($dir);
                        while(($file = readdir($dh))!==false) {
-                               if($file != "." && $file != "..") $content .= "<tr><td><a href=\"$uri/$file\">$file</a></td></tr>";
+                               if($file != "." && $file != "..") {
+                                       if(is_dir("$dir/$file")) {
+                                               $fsize = "";
+                                               $icon = "/icons/folder.png";
+                                       } else {
+                                               $fsize = filesize("$dir/$file");
+                                               $icon = "/icons/text.png";
+                                       }
+                                       $content .= "<tr><td><img src=\"$icon\"></td><td><a href=\"$uri/$file\">$file</a></td><td>$fsize</td></tr>";
+                               }
                        }
                        $content .= "</table></body></html>";
                                
@@ -754,6 +763,43 @@ class GLCASRepo {
                                
                } else return false;
        }
+       
+       function getRepoDetailsApt($url)
+       {
+               $action1 = $url."/dists";
+               
+               // we just want to make sure it exists really
+               error_log("in repo details apt for $url");
+               if(!glcas_isRemoteDir($action1)) {
+                       //echo "I cant find any valid APT dists's at $url<br>";
+                       return false;
+               }
+               
+               // ok, now scan for ubuntu dists as
+               $kos = getKnownOSList();
+               
+               $repos = 0;
+               $existing_repo["isrepo"] = true;
+               foreach($kos["apt"] as $key => $val) {
+                       //echo "<br>$key, $val<br>";
+                       //echo "now check, $action1/$key";
+                       if(glcas_isRemoteDir($action1."/$key")) {
+                               $existing_repos["knownrepo"][$repos] = $key;
+                               $repos++;
+                               //echo "Found Distro $val<br>";
+                       }
+               }
+               $existing_repos["nrepos"] = $repos;
+               
+               // TODO: these need to be "calculated"
+               $existing_repos["distros"] = "Ubuntu, Debian";
+               $existing_repos["versions"] = "8.04LTS, 9.10, 10.04LTS, 10.10, 11.04, 11.10";
+               $existing_repos["arch"] = "x86_64, i386";
+               
+               
+               return $existing_repos;
+
+       }
 
        function getRepoDetailsYum($url, $ismirrorlist=false)
        {