// Generate a selection box
function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default="") {
// Open the requested menu directory
- $handle = opendir(sprintf("%sinc/modules/%s/", constant('PATH'), $menu)) or mxchange_die("Cannot load menu ".$menu."!");
+ $menuArray = GET_DIR_AS_ARRAY(sprintf("inc/modules/%s/", $menu), "", false, false);
// Init the selection box
$OUT = "<select name=\"".$name."\" class=\"admin_select\" size=\"1\">
<option value=\"\">{--IS_TOP_MENU--}</option>\n";
// Walk through all files
- while ($file = readdir($handle)) {
+ foreach ($menuArray as $file) {
// Is this a PHP script?
if (($file != ".") && ($file != "..") && ($file != "lost+found") && (strpos($file, "".$type."-") > -1) && (strpos($file, ".php") > 0)) {
// Then test if the file is readable
} // END - if
} // END - if
} // END - if
- } // END - while
+ } // END - foreach
- // Close dir and selection box
- closedir($handle);
+ // Close selection box
$OUT .= "</select>\n";
// Return contents
$jobsDone = true;
// Open the extension directory
- $handle = opendir(constant('PATH')."inc/extensions/") or mxchange_die("Cannot read extension directory!");
- while ($file = readdir($handle)) {
+ $extensionList = GET_DIR_AS_ARRAY("inc/extensions/", "ext-", false, false);
+ foreach ($extensionList as $file) {
// Is this file an extension?
if ((substr($file, 0, 4) == "ext-") && (substr($file, -4) == ".php")) {
//* DEBUG: */ echo $file."<br />\n";
} // END - if
}
} // END - if
- } // END - while
-
- // Close directory handle
- closedir($handle);
+ } // END - foreach
// At last - but not least - check for own and new unassigned tasks...
$result_tasks = SQL_QUERY_ESC("SELECT id, assigned_admin, userid, task_type, subject, text, task_created