function attach_generate_filename($messagelenght = 0, $filesize = 0)
{
    global $lang_attach, $forum_config;
    while (($newfile = md5(attach_generate_pathname() . $messagelenght . $filesize . $lang_attach['Some more salt keywords']) . '.attach') && is_file(FORUM_ROOT . $forum_config['attach_basefolder'] . $forum_config['attach_subfolder'] . '/' . $newfile)) {
    }
    return $newfile;
}
function attach_generate_filename($storagepath, $messagelenght = 0, $filesize = 0)
{
    $not_unique = true;
    while ($not_unique) {
        $newfile = md5(attach_generate_pathname() . $messagelenght . $filesize . 'Some more salt keyworbs, change if you want to') . '.attach';
        if (!is_file($storagepath . $newfile)) {
            return $newfile;
        }
    }
}
            }
            $db->query('UPDATE ' . $db->prefix . 'config SET conf_value=' . $value . ' WHERE conf_name=\'attach_' . $key . '\'') or error('Unable to update attachment mod config', __FILE__, __LINE__, $db->error());
        }
    }
    // Regenerate the config cache
    require_once PUN_ROOT . 'include/cache.php';
    generate_config_cache();
    // end of stuff taken from admin_options
    redirect($_SERVER['REQUEST_URI'], 'Attachment Mod ' . $pun_config['attach_cur_version'] . ' settings updated. Redirecting …');
} elseif (isset($_POST['generate_subfolder']) || isset($_POST['change_subfolder'])) {
    // if the latter, we should use that instead for new folder
    if (isset($_POST['change_subfolder'])) {
        // we want to use the entered subfolder
        $newname = $_POST['subfolder'];
    } else {
        $newname = attach_generate_pathname($pun_config['attach_basefolder']);
    }
    // ok, we doesn't need to use a folder that has been created beforehand ...
    if (!attach_create_subfolder($newname)) {
        error('Unable to create new subfolder with name ' . $newname, __FILE__, __LINE__);
    } else {
        redirect($_SERVER['REQUEST_URI'], 'Attachment Mod ' . $pun_config['attach_cur_version'] . ' new subfolder created. Redirecting …');
    }
} elseif (isset($_POST['alter_settings']) || isset($_GET['alter_settings'])) {
    // Display the admin navigation menu
    generate_admin_menu($plugin);
    ?>
	<div id="exampleplugin" class="blockform">
		<h2><span>Attachment Mod <?php 
    echo $pun_config['attach_cur_version'];
    ?>