
<ul id="adminmenu">
<?php
// This array constructs the admin menu bar.
//
// Menu item name
// The minimum level the user needs to access the item: between 0 and 10
// The URL of the item's file
$menu = array(
              array(_LANG_ADMIN_MENU_WRITE, 1, 'post.php'),
              array(_LANG_ADMIN_MENU_EDIT, 1, 'edit.php'),
              array(_LANG_ADMIN_MENU_CATE, 3, 'categories.php'),
              array(_LANG_ADMIN_MENU_LINK, 5, 'link-manager.php'),
              array(_LANG_ADMIN_MENU_USER, 3, 'users.php'),
              array(_LANG_ADMIN_MENU_OPTION, 6, 'options-general.php'),
              array(_LANG_ADMIN_MENU_PLUG, 8, 'plugins.php'),
              array(_LANG_ADMIN_MENU_TEMP, 4, 'templates.php'),
              array(_LANG_ADMIN_MENU_UPLOAD, get_settings('fileupload_minlevel'), 'upload.php'),
              array(_LANG_ADMIN_MENU_PROFILE, 0, 'profile.php')
);

$self = preg_replace('|.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
if (!isset($parent_file)) $parent_file = '';
foreach ($menu as $item) {
	$class = '';

    // 0 = name, 1 = user_level, 2 = file
    if ((substr($self, -10) == substr($item[2], -10) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
    
    if ($user_level >= $item[1]) {
        if (
('upload.php' == $item[2] && 
get_settings('use_fileupload') && 
($user_level >= get_settings('fileupload_minlevel'))
             ) || 'upload.php' != $item[2])
            echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
    }
}

?>
    <li><a href="<?php echo get_settings('home') . '/' . get_settings('blogfilename'); ?>" title="View your site"><?php echo _LANG_ADMIN_MENU_VIEW; ?></a></li>
	<li class="last"><a href="<?php echo get_settings('siteurl')
	 ?>/wp-login.php?action=logout" title="Log out of this account"><?php printf(_LANG_ADMIN_MENU_LOGOUT, stripslashes($user_nickname)); ?></a></li>
</ul>
