Show all extensions in the extension list

This commit is contained in:
Shish 2010-01-05 10:32:39 +00:00
parent 7a60e6fae5
commit 44c8461f3b
9 changed files with 29 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Name: Archive File Handler * Name: Handle Archives
* Author: Shish <webmaster@shishnet.org> * Author: Shish <webmaster@shishnet.org>
* Description: Allow users to upload archives (zip, etc) * Description: Allow users to upload archives (zip, etc)
* Documentation: * Documentation:

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Name: Flash File Handler * Name: Handle Flash
* Author: Shish <webmaster@shishnet.org> * Author: Shish <webmaster@shishnet.org>
* Description: Handle Flash files * Description: Handle Flash files
*/ */

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Name: ICO File Handler * Name: Handle ICO
* Author: Shish <webmaster@shishnet.org> * Author: Shish <webmaster@shishnet.org>
* Description: Handle windows icons * Description: Handle windows icons
*/ */

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Name: MP3 File Handler * Name: Handle MP3
* Author: Shish <webmaster@shishnet.org> * Author: Shish <webmaster@shishnet.org>
* Description: Handle MP3 files * Description: Handle MP3 files
*/ */

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Name: SVG File Handler * Name: Handle SVG
* Author: Shish <webmaster@shishnet.org> * Author: Shish <webmaster@shishnet.org>
* Description: Handle SVG files * Description: Handle SVG files
*/ */

View File

@ -11,6 +11,11 @@
* extensions and read their documentation * extensions and read their documentation
*/ */
/** @private */
function __extman_extcmp(ExtensionInfo $a, ExtensionInfo $b) {
return strcmp($a->name, $b->name);
}
/** @private */ /** @private */
class ExtensionInfo { class ExtensionInfo {
var $ext_name, $name, $link, $author, $email, $description, $documentation, $version; var $ext_name, $name, $link, $author, $email, $description, $documentation, $version;
@ -69,7 +74,9 @@ class ExtensionInfo {
} }
private function is_enabled($fname) { private function is_enabled($fname) {
return file_exists("ext/$fname"); if(file_exists("ext/$fname") && file_exists("contrib/$fname")) return true; // both
if(file_exists("contrib/$fname")) return false; // only disabled (optional)
return null; // only active (core)
} }
} }
@ -123,10 +130,21 @@ class ExtManager extends SimpleExtension {
private function get_extensions($all) { private function get_extensions($all) {
$extensions = array(); $extensions = array();
$exts = $all ? glob("contrib/*/main.php") : glob("ext/*/main.php"); if($all) {
$exts = glob("ext/*/main.php");
foreach(glob("contrib/*/main.php") as $ae) {
if(!in_array("ext".substr($ae, 7), $exts)) {
$exts[] = $ae;
}
}
}
else {
$exts = glob("ext/*/main.php");
}
foreach($exts as $main) { foreach($exts as $main) {
$extensions[] = new ExtensionInfo($main); $extensions[] = new ExtensionInfo($main);
} }
usort($extensions, "__extman_extcmp");
return $extensions; return $extensions;
} }

View File

@ -23,7 +23,7 @@ class ExtManagerTheme extends Themelet {
$h_description = html_escape($extension->description); $h_description = html_escape($extension->description);
if($extension->enabled === TRUE) $h_enabled = " checked='checked'"; if($extension->enabled === TRUE) $h_enabled = " checked='checked'";
else if($extension->enabled === FALSE) $h_enabled = ""; else if($extension->enabled === FALSE) $h_enabled = "";
else $h_enabled = " disabled"; else $h_enabled = " disabled checked='checked'";
$h_link = make_link("ext_doc/".html_escape($extension->ext_name)); $h_link = make_link("ext_doc/".html_escape($extension->ext_name));
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* Name: Pixel File Handler * Name: Handle Pixel
* Author: Shish <webmaster@shishnet.org> * Author: Shish <webmaster@shishnet.org>
* Description: Handle JPG, PNG, GIF, etc files * Description: Handle JPEG, PNG, GIF, etc files
*/ */
class PixelFileHandler extends DataHandlerExtension { class PixelFileHandler extends DataHandlerExtension {

View File

@ -2,7 +2,7 @@
/* /*
* Name: Image Viewer * Name: Image Viewer
* Author: Shish * Author: Shish
* Description: Allows users too see uploaded images * Description: Allows users to see uploaded images
*/ */
/* /*