Topic: Optimizations
In function generate_navlinks(), count($extra_links[1]) is being redundantly executed with each loop iteration.
In function check_bans(), count($cur_ban_ips) is being redundantly executed with each loop iteration.
You can actually remove the entire for(; ; ) loop in check_bans() with this code:
//after line 363 in rev 1084
$cur_ban_ips = array_map(create_function('$ip', 'return "$ip.";'), $cur_ban_ips); //I don't even think you need this part, along with line 328.
if(in_array($user_ip, $cur_ban_ips)) {
//lines 371-379
}