Så här ser min kod ut idag för just navigationen:
//
// Generate the "navigator" that appears at the top of every page
//
function generate_navlinks()
{
global $pun_config, $lang_common, $pun_user;
// Index and Userlist should always be displayed
$links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>';
if ($pun_config['o_rules'] == '1')
$links[] = '<li id="navrules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>';
$links[] = '<li id="navuserlist"><a href="calendar.php">'.$lang_common['Calendar'].'</a>';
if ($pun_user['is_guest'])
{
if ($pun_user['g_search'] == '1')
$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>';
$links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>';
$info = $lang_common['Not logged in'];
}
else
{
if ($pun_user['g_id'] > PUN_MOD)
{
if ($pun_user['g_search'] == '1')
$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>';
$links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
require(PUN_ROOT.'include/pms/functions_navlinks.php');
$links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
}
else
{
$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
$links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
require(PUN_ROOT.'include/pms/functions_navlinks.php');
$links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
}
}
// Are there any additional navlinks we should insert into the array before imploding it?
if ($pun_config['o_additional_navlinks'] != '')
{
if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_navlinks']."\n", $extra_links))
{
// Insert any additional links into the $links array (at the correct index)
for ($i = 0; $i < count($extra_links[1]); ++$i)
array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i]));
}
}
return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>';
}