<?php
global $s; if (' '==$s$s='';
global 
$wp$wp->authorize false$wp->authorized false;
if (
is_page() && in_array($post->IDsf_theme_protected_pages())) {
    
$wp->authorize true;
    
$sf_medlemmer_brugernavn=get_settings('sf_medlemmer_brugernavn');
    
$sf_medlemmer_adgangskode=get_settings('sf_medlemmer_adgangskode');
    if (isset(
$_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']))
        list(
$user$pw) = array($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
    elseif (isset(
$_SERVER['HTTP_AUTHORIZATION']))
        list(
$user$pw) = explode(':' base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
    elseif (isset(
$_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
        list(
$user$pw) = explode(':' base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
    elseif (isset(
$_REQUEST['HTTP_AUTHORIZATION']))
        list(
$user$pw) = explode(':' base64_decode(substr($_REQUEST['HTTP_AUTHORIZATION'], 6)));
    if (
$sf_medlemmer_brugernavn==$user && $sf_medlemmer_adgangskode==$pw) {
        
$wp->authorized true;
        @
header('Cache-Control: no-cache, must-revalidate, max-age=0');
        @
header('Pragma: no-cache');
    } else {
        @
header("HTTP/1.1 401 Ej Autoriseret");
        @
header('WWW-Authenticate: Basic realm="Medlemmer af '.utf8_decode(get_bloginfo_rss('name')).'"');
        @
header('Cache-Control: no-cache, must-revalidate, max-age=0');
        @
header('Pragma: no-cache');
    }
}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php bloginfo('name'); wp_title(); ?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
<meta name="generator" content="SF-tema <?php print SF_THEME_VERSION?>" /> <!-- leave this for stats -->

<link rel="stylesheet" media="screen" href="<?php print get_bloginfo('stylesheet_url'); ?>" type="text/css" />
<link rel="stylesheet" media="print" href="<?php print get_template_directory_uri(); ?>/print.css" type="text/css" />
<style media="screen" type="text/css">
#header { background: url(<?php print get_template_directory_uri() . '/images/' . (''!=get_settings('sf_top_billede')?get_settings('sf_top_billede'):'top970fyr.jpg'); ?>) no-repeat top right; }
</style>
<link rel="shortcut icon" href="<?php print get_template_directory_uri(); ?>/images/favicon.ico" />
<link rel="feed alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed" href="<?php print get_feed_link('rdf'); ?>" />
<link rel="feed" type="application/rss+xml" title="<?php bloginfo('name'); ?> Feed (Kommentarer)" href="<?php print get_feed_link('comments_rdf'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php wp_head(); ?>
</head>
<body>

<div id="header">
    <a class="sflink" href="http://www.sf.dk/"> </a>
    <h1>
        <a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a>
    </h1>
    <p><?php bloginfo('description'); ?></p>
</div>

<div id="menu">
    <ul class="right">
        <li><a href="<?php echo get_settings('home'); ?>/?s=+">SØG</a></li>
        <li class="sf"><a href="http://www.sf.dk/">www.sf.dk</a></li>
    </ul>
<?php
$toplinielinks
=get_settings('sf_toplinie_link_kategori');
$topliniesider=sf_theme_topline_pages();
if (
$toplinielinks || sizeof($topliniesider)) {
    print 
'<ul class="left">';
    if (
$toplinielinks)
        
get_links($toplinielinks'<li>''</li>'''false'rating'false);
    foreach (
$topliniesider as $side) {
        
$page wp_get_single_post($side);
        print 
'<li><a href="'.get_page_link($side).'">';
        print 
apply_filters('the_title'get_the_title($side));
        print 
'</a></li>';
    }
    print 
'</ul>';
} else
    print 
'<br />';
?>
</div>

<?php
$specialdiv 
= array('special');
if (
is_author() && !preg_match('|nej|i', @$_GET['profil']) && get_settings('sf_forfatter_profil'))
    
$specialdiv[] = 'vcard';
if (
is_page() && 'bred.php'==get_post_meta($post->ID'_wp_page_template'true))
    
$specialdiv[] = 'bred';
print 
'<div class="'.join(' '$specialdiv).'">';

get_sidebar();

?>

<div id="main">

<div id="navigation">
    <ol>
        <li class="forside"><a href="<?php print get_settings('home'); ?>/">Forside</a></li>
<?php
  
if (have_posts())
    
$post $posts[0];
    if (
is_category()) { print '<li>'single_cat_title(''); print '</li>'; }
    elseif (
is_day()) { print '<li>'the_time('j. F Y'); print '</li>'; }
    elseif (
is_month()) { print '<li>' ucfirst(get_the_time('F Y')) . '</li>'; }
    elseif (
is_year()) { print '<li>'the_time('Y'); print '</li>'; }
    elseif (
is_author() && !preg_match('|nej|i', @$_GET['profil']) && get_settings('sf_forfatter_profil')) { print '<li>Profil</li>'; }
    elseif (
is_author()) { print '<li>Forfatter</li>'; }
    elseif (
is_archive()) { print '<li>Arkiv</li>'; }
    elseif (
is_search()) { print '<li><a href="'.get_settings('home').'/?s=+">Søgning</a></li>'; }
    elseif (
is_single()) { print '<li>'the_category('<span style="color: #ce5252; font-weight: bold"> / </span>'); print '</li>'; }
    elseif (
is_page() && $post->post_parent) {
        
$pid $post->post_parent;
        
$crumbs '';
        while (
$pid) {
            
$p = &get_post($pid);
            
$crumbs '<li><a href="'.post_permalink($p->ID).'">'.$p->post_title.'</a></li> ' $crumbs;
            
$pid $p->post_parent;
        }
        print 
$crumbs;
    }
?>
    </ol>

</div><!-- /navigation -->

<div id="content">