X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=6eee1eddf6e93996b89532899bfbb5c77fb54678;hp=3ddc50cb8adbd94489cb32cc9cda189894884397;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=f5e2b428b0b5206b5758190d379d5c9d6bdce9e1 diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 3ddc50cb8a..6eee1eddf6 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -41,30 +41,45 @@ if (!defined('__SECURITY')) { } // END - if // Register an administrator account -function addAdminAccount ($adminLogin, $passHash, $adminEmail) { +function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'deny') { + // Only let valid data pass + assert(in_array($accessLevel, array('allow', 'deny'))); + // Login does already exist $ret = 'already'; // Lookup the admin - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", + $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", array($adminLogin), __FUNCTION__, __LINE__); // Is the entry there? - if (SQL_HASZERONUMS($result)) { - // Ok, let's create the admin login - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", - array( - $adminLogin, - $passHash, - $adminEmail - ), __FUNCTION__, __LINE__); + if (ifSqlHasZeroNumRows($result)) { + // Is ext-admins installed and version at least 0.3.0? + if (isExtensionInstalledAndNewer('admins', '0.3.0')) { + // Ok, let's create the admin login + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`, `default_acl`) VALUES ('%s', '%s', '%s', '%s')", + array( + $adminLogin, + $passHash, + $adminEmail, + $accessLevel + ), __FUNCTION__, __LINE__); + } else { + // Ok, let's create the admin login + sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", + array( + $adminLogin, + $passHash, + $adminEmail + ), __FUNCTION__, __LINE__); + } // All done $ret = 'done'; } // END - if // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return result return $ret; @@ -74,13 +89,13 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail) { function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) { // First of all, no admin login is found, so the admin hash is null $ret = '404'; - $adminHash = null; + $adminHash = NULL; // Get admin id from login $adminId = getAdminId($adminLogin); // Continue only with found admin ids - if ($adminId > 0) { + if (isValidId($adminId)) { // Then we need to lookup the login name by getting the admin hash $adminHash = getAdminHash($adminId); @@ -97,7 +112,7 @@ function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) { // All fine $ret = 'done'; } else { - // Set status + // Did not match! $ret = 'password'; } } // END - if @@ -120,6 +135,8 @@ function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) { // Only be executed on cookie checking function ifAdminCookiesAreValid ($adminLogin, $passHash) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLogin=' . $adminLogin . ',passHash=' . $passHash . ' - CALLED!'); + // First of all, no admin login is found $ret = '404'; @@ -130,38 +147,30 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) { if ($adminHash != '-1') { // Now, we need to encode the password in the same way the one is encoded in database $testHash = encodeHashForCookie($adminHash); - //* DEBUG: */ debugOutput('adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash); // If they both match, the login data is valid - if ($testHash == $passHash) { + if ($testHash != $passHash) { + // Passwords don't match + $ret = 'password'; + } elseif (!isAdmin()) { + // Is not valid session + $ret = 'session'; + } else { // All fine $ret = 'done'; - } else { - // Set status - $ret = 'password'; } } // END - if // Return status - //* DEBUG: */ debugOutput('ret='.$ret); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret . ' - EXIT!'); return $ret; } // Do an admin action function doAdminAction () { - // Get default what - $what = getWhat(); - - //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*'); - - // Remove any spaces from variable - if (empty($what)) { - // Default admin action is the overview page - $what = 'overview'; - } else { - // Secure it - $what = secureString($what); - } + // Determine correct 'what' value + $what = determineWhat(); // Get action value $action = getActionFromModuleWhat(getModule(), $what); @@ -169,21 +178,21 @@ function doAdminAction () { // Load welcome template if (isExtensionActive('admins')) { // @TODO This and the next getCurrentAdminId() call might be moved into the templates? - $content['welcome'] = loadTemplate('admin_welcome_admins', true, getCurrentAdminId()); + $content['welcome'] = loadTemplate('admin_welcome_admins', TRUE, getCurrentAdminId()); } else { - $content['welcome'] = loadTemplate('admin_welcome', true, getCurrentAdminId()); + $content['welcome'] = loadTemplate('admin_welcome', TRUE, getCurrentAdminId()); } // Load header, footer, render menu - $content['header'] = loadTemplate('admin_header' , true, $content); - $content['footer'] = loadTemplate('admin_footer' , true, $content); - $content['menu'] = addAdminMenu($action, $what, true); + $content['header'] = loadTemplate('admin_header' , TRUE, $content); + $content['footer'] = loadTemplate('admin_footer' , TRUE, $content); + $content['menu'] = addAdminMenu($action, $what); - // Tableset header - loadTemplate('admin_main_header', false, $content); + // Load main template + loadTemplate('admin_main', FALSE, $content); // Check if action/what pair is valid - $result_action = SQL_QUERY_ESC("SELECT + $result_action = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` @@ -191,12 +200,12 @@ WHERE `action`='%s' AND ( ( - `what`='%s' AND `what` != 'overview' + `what`='%s' AND `what` != 'welcome' ) OR ( ( `what`='' OR `what` IS NULL ) AND ( - '%s'='overview' + '%s'='welcome' ) ) ) @@ -207,40 +216,42 @@ LIMIT 1", $what ), __FUNCTION__, __LINE__); - // Do we have an entry? - if (SQL_NUMROWS($result_action) == 1) { + // Is there an entry? + if (sqlNumRows($result_action) == 1) { // Is valid but does the inlcude file exists? - $inc = sprintf("inc/modules/admin/action-%s.php", $action); - if ((isIncludeReadable($inc)) && (isMenuActionValid('admin', $action, $what)) && ($GLOBALS['acl_allow'] === true)) { + $inc = sprintf('inc/modules/admin/action-%s.php', $action); + if ((isIncludeReadable($inc)) && (isMenuActionValid('admin', $action, $what)) && ($GLOBALS['acl_allow'] === TRUE)) { // Ok, we finally load the admin action module loadInclude($inc); - } elseif ($GLOBALS['acl_allow'] === false) { + } elseif ($GLOBALS['acl_allow'] === FALSE) { // Access denied - loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACCESS_DENIED', $what)); + loadTemplate('admin_menu_failed', FALSE, '{%message,ADMIN_ACCESS_DENIED=' . $what . '%}'); } else { - // Include file not found! :-( - loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACTION_404', $action)); + // Include file not found :-( + loadTemplate('admin_menu_failed', FALSE, '{%message,ADMIN_ACTION_404=' . $action . '%}'); } } else { - // Invalid action/what pair found! - loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACTION_INVALID', $action . '/' . $what)); + // Invalid action/what pair found + loadTemplate('admin_menu_failed', FALSE, '{%message,ADMIN_ACTION_INVALID=' . $action . '/' . $what . '%}'); } // Free memory - SQL_FREERESULT($result_action); + sqlFreeResult($result_action); // Tableset footer - loadTemplate('admin_main_footer', false, $content); + loadTemplate('admin_main_footer', FALSE, $content); } -// Checks wether current admin is allowed to access given action/what combination -// (only one is allowed to be null!) -function isAdminAllowedAccessMenu ($action, $what = null) { - // Do we have cache? +/** + * Checks whether current admin is allowed to access given action/what + * combination (only one is allowed to be null!). + */ +function isAdminAllowedAccessMenu ($action, $what = NULL) { + // Is there cache? if (!isset($GLOBALS[__FUNCTION__][$action][$what])) { // ACL is always 'allow' when no ext-admins is installed // @TODO This can be rewritten into a filter - $GLOBALS[__FUNCTION__][$action][$what] = ((!isExtensionInstalledAndNewer('admins', '0.2.0')) || (adminsCheckAdminAcl($action, $what))); + $GLOBALS[__FUNCTION__][$action][$what] = ((!isExtensionInstalledAndNewer('admins', '0.2.0')) || ((isExtensionActive('admins')) && (isAdminsAllowedByAcl($action, $what)))); } // END - if // Return the cached value @@ -248,18 +259,20 @@ function isAdminAllowedAccessMenu ($action, $what = null) { } // Adds an admin menu -function addAdminMenu ($action, $what, $return = false) { +function addAdminMenu ($action, $what) { // Init variables - $SUB = false; + $SUB = FALSE; $OUT = ''; // Menu descriptions $GLOBALS['menu']['description'] = array(); - $GLOBALS['menu']['title'] = array(); + $GLOBALS['menu']['title'] = array(); // Build main menu - $result_main = SQL_QUERY("SELECT - `action`, `title`, `descr` + $result_main = sqlQuery("SELECT + `action` AS `main_action`, + `title` AS `main_title`, + `descr` AS `main_descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE @@ -268,55 +281,78 @@ ORDER BY `sort` ASC, `id` DESC", __FUNCTION__, __LINE__); - // Do we have entries? - if (!SQL_HASZERONUMS($result_main)) { + // Are there entries? + if (!ifSqlHasZeroNumRows($result_main)) { $OUT .= ''; + + // Free memory + sqlFreeResult($result_main); + } // END - if + + // Return content + return $OUT; +} + +// Add admin sub menu +function addAdminSubMenu ($mainContent, $action, $what) { + // Init content + $OUT = ''; + + // Check for menu entries + $result_what = sqlQueryEscaped("SELECT + `what` AS `sub_what`, + `title` AS `sub_title`, + `descr` AS `sub_descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE @@ -326,107 +362,172 @@ WHERE ORDER BY `sort` ASC, `id` DESC", - array($menu), __FUNCTION__, __LINE__); - - // Remember the count for later checks - setAdminMenuHasEntries($menu, ((!SQL_HASZERONUMS($result_what)) && ($action == $menu))); - - // Do we have entries? - if ((ifAdminMenuHasEntries($menu)) && (!SQL_HASZERONUMS($result_what))) { - $GLOBALS['menu']['description'] = array(); - $GLOBALS['menu']['title'] = array(); $SUB = true; - $OUT .= '
  • '; + } // END - if // Free memory - SQL_FREERESULT($result_main); - $OUT .= ''; - } + sqlFreeResult($result_what); + } // END - if - // Is there a cache instance again? - // Return or output content? - if ($return === true) { - return $OUT; - } else { - outputHtml($OUT); - } + // Close li-tag + $OUT .= '
  • '; + + // Return content + return $OUT; +} + +// Create an admin selection box form +function addAdminSelectionBox ($adminId = NULL, $special = '') { + // Default is email as "special column" + $ADD = ',`email` AS `special`'; + + // Is a special column given? + if (!empty($special)) { + // Additional column for SQL query + $ADD = ',`' . $special . '` AS `special`'; + } // END - if + + // Query all entries + $result = sqlQuery('SELECT + `id`, + `login` + ' . $ADD . ' +FROM + `{?_MYSQL_PREFIX?}_admins` +ORDER BY + `login` ASC', __FUNCTION__, __LINE__); + + // Init output + $OUT = ''; + + // Load all entries + while ($content = sqlFetchArray($result)) { + // Default is none + $content['default'] = ''; + + // Is the id the same? + if ($content['id'] == $adminId) { + // Set this as default + $content['default'] = ' selected="selected"'; + } // END - if + + // Add the entry + $OUT .= loadTemplate('select_admins_option', TRUE, $content); + } // END - if + + // Free memory + sqlFreeResult($result); + + // Add form to content + $content['form_selection'] = $OUT; + + // Output form + loadTemplate('select_admins_box', FALSE, $content); } -// Create member selection box -function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $none = false, $field = 'userid') { +// Create a member selection box +function addMemberSelectionBox ($userid = NULL, $add_all = FALSE, $return = FALSE, $none = FALSE, $field = 'userid', $whereStatement = " WHERE `surname` NOT LIKE '{?tester_user_surname_prefix?}%'") { // Output selection form with all confirmed user accounts listed - $result = SQL_QUERY("SELECT `userid`, `surname`, `family` FROM `{?_MYSQL_PREFIX?}_user_data` ORDER BY `userid` ASC", __FUNCTION__, __LINE__); + $result = sqlQuery('SELECT + `userid`, + `surname`, + `family` +FROM + `{?_MYSQL_PREFIX?}_user_data` +' . $whereStatement . ' +ORDER BY + `userid` ASC', __FUNCTION__, __LINE__); // Default output $OUT = ''; // USe this only for adding points (e.g. adding refs really makes no sence ;-) ) - if ($add_all === true) $OUT = ' '; - elseif ($none === true) $OUT = ' '; + if ($add_all === TRUE) { + $OUT = ' '; + } elseif ($none === TRUE) { + $OUT = ' '; + } - while ($content = SQL_FETCHARRAY($result)) { + // Load all entries + while ($content = sqlFetchArray($result)) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . intval($userid) . '/' . $content['userid']); $OUT .= ''; } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); - if ($return === false) { + if ($return === FALSE) { // Remeber options in constant $content['form_selection'] = $OUT; - $content['what'] = getWhat(); + $content['what'] = '{%pipe,getWhat%}'; // Load template - loadTemplate('admin_form_selection_box', false, $content); + loadTemplate('admin_form_selection_box', FALSE, $content); } else { // Return content in selection frame return ''; @@ -437,26 +538,28 @@ function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $no // @TODO Try to rewrite this to adminAddMenuSelectionBox() // @DEPRECATED function adminMenuSelectionBox_DEPRECATED ($mode, $default = '', $defid = '') { - $what = "`what` != ''"; - if ($mode == 'action') $what = "(`what`='' OR `what` IS NULL) AND `action` !='login'"; + $what = "`what` != '' AND `what` IS NOT NULL"; + if ($mode == 'action') $what = "(`what`='' OR `what` IS NULL) AND `action` != 'login'"; - $result = SQL_QUERY_ESC("SELECT `%s` AS `menu`, `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC", + $result = sqlQueryEscaped("SELECT `%s` AS `menu`, `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC", array($mode), __FUNCTION__, __LINE__); - if (!SQL_HASZERONUMS($result)) { + if (!ifSqlHasZeroNumRows($result)) { // Load menu as selection $OUT = ''; @@ -470,7 +573,7 @@ function adminMenuSelectionBox_DEPRECATED ($mode, $default = '', $defid = '') { } // Wrapper for $_POST and adminSaveSettings -function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) { +function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = FALSE, $displayMessage = TRUE) { // Get the array $postData = postRequestArray(); @@ -479,84 +582,93 @@ function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement } // Save settings to the database -function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) { +function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = FALSE, $displayMessage = TRUE) { // Prepare all arrays, variables $tableData = array(); - $skip = false; + $skip = FALSE; // Now, walk through all entries and prepare them for saving + //* BUG: */ reportBug(__FUNCTION__, __LINE__, '
    '.print_r(postRequestArray(), TRUE).'
    '); foreach ($postData as $id => $val) { // Process only formular field but not submit buttons ;) - if ($id != 'ok') { - // Do not save the ok value - convertSelectionsToTimestamp($postData, $tableData, $id, $skip); - - // Shall we process this id? It muss not be empty, of course - if (($skip === false) && (!empty($id)) && ((!isset($GLOBALS['skip_config'][$id]))) || ($tableName != '_config')) { - // Translate the value? (comma to dot!) - if ((is_array($translateComma)) && (in_array($id, $translateComma))) { - // Then do it here... :) - $val = convertCommaToDot($val); - } // END - if - - // Shall we add numbers or strings? - $test = (float) $val; - if ('' . $val . '' == '' . $test . '') { - // Add numbers - $tableData[] = sprintf("`%s`=%s", $id, $test); - } elseif (is_null($val)) { - // Add NULL - $tableData[] = sprintf("`%s`=NULL", $id); - } else { - // Add strings - $tableData[] = sprintf("`%s`='%s'", $id, trim($val)); - } + if ($id == 'save_config') { + // Skip this button + continue; + } // END - if - // Do not add a config entry twice - $GLOBALS['skip_config'][$id] = true; + // Do not save the ok value + convertSelectionsToEpocheTime($postData, $tableData, $id, $skip); - // Update current configuration - setConfigEntry($id, $val); + // Shall we process this id? It muss not be empty, of course + if (($skip === FALSE) && (!empty($id)) && ((!isset($GLOBALS['skip_config'][$id]))) || ($tableName != '_config')) { + // Translate the value? (comma to dot!) + if ((is_array($translateComma)) && (in_array($id, $translateComma))) { + // Then do it here... :) + $val = convertCommaToDot($val); } // END - if + + // Test value on float + $test = (float) $val; + + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'test=' . $test . ',val=' . $val . ',id=' . $id); + + // Shall we add numbers or strings? + if ('' . $val . '' == '' . $test . '') { + // Add numbers + array_push($tableData, sprintf('`%s`=%s', $id, $test)); + } elseif (is_null($val)) { + // Add NULL + array_push($tableData, sprintf('`%s`=NULL', $id)); + } else { + // Add strings + array_push($tableData, sprintf("`%s`='%s'", $id, trim($val))); + } + + // Do not add a config entry twice + $GLOBALS['skip_config'][$id] = TRUE; + + // Update current configuration + setConfigEntry($id, $val); } // END - if } // END - foreach // Check if entry does exist - $result = false; - if ($alwaysAdd === false) { + $result = FALSE; + if ($alwaysAdd === FALSE) { if (!empty($whereStatement)) { - $result = SQL_QUERY("SELECT * FROM `{?_MYSQL_PREFIX?}" . $tableName . "` WHERE " . $whereStatement . " LIMIT 1", __FUNCTION__, __LINE__); + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}' . $tableName . '` WHERE ' . $whereStatement . ' LIMIT 1', __FUNCTION__, __LINE__); } else { - $result = SQL_QUERY("SELECT * FROM `{?_MYSQL_PREFIX?}" . $tableName . "` LIMIT 1", __FUNCTION__, __LINE__); + $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}' . $tableName . '` LIMIT 1', __FUNCTION__, __LINE__); } } // END - if - if (SQL_NUMROWS($result) == 1) { + if (sqlNumRows($result) == 1) { // "Implode" all data to single string $updatedData = implode(', ', $tableData); // Generate SQL string - $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}%s` SET %s WHERE %s LIMIT 1", + $sql = sprintf('UPDATE `{?_MYSQL_PREFIX?}%s` SET %s WHERE %s LIMIT 1', $tableName, $updatedData, $whereStatement ); } else { - // Add Line (does only work with auto_increment! + // Add Line (does only work with AUTO_INCREMENT! $keys = array(); $values = array(); foreach ($tableData as $entry) { // Split up $line = explode('=', $entry); - $keys[] = $line[0]; - $values[] = $line[1]; + array_push($keys , $line[0]); + array_push($values, $line[1]); } // END - foreach // Add both in one line - $keys = implode('`, `', $keys); - $values = implode(', ', $values); + $keys = implode('`, `', $keys); + $values = implode(', ' , $values); // Generate SQL string - $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}%s` (%s) VALUES (%s)", + $sql = sprintf('INSERT INTO `{?_MYSQL_PREFIX?}%s` (%s) VALUES (%s)', $tableName, $keys, $values @@ -564,19 +676,22 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement } // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Simply run generated SQL string - SQL_QUERY($sql, __FUNCTION__, __LINE__); + sqlQuery($sql, __FUNCTION__, __LINE__); // Remember affected rows - $affected = SQL_AFFECTEDROWS(); + $affected = sqlAffectedRows(); // Rebuild cache rebuildCache('config', 'config'); // Settings saved, so display message? - if ($displayMessage === true) loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}'); + if ($displayMessage === TRUE) { + // Display a message + displayMessage('{--SETTINGS_SAVED--}'); + } // END - if // Return affected rows return $affected; @@ -585,7 +700,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement // Generate a selection box function adminAddMenuSelectionBox ($menu, $type, $name, $default = '') { // Open the requested menu directory - $menuArray = getArrayFromDirectory(sprintf("inc/modules/%s/", $menu), $type . '-', false, false); + $menuArray = getArrayFromDirectory(sprintf('inc/modules/%s/', $menu), $type . '-', FALSE, FALSE); // Init the selection box $OUT = '