Esempio n. 1
0
    echo $admincontrol_out;
    $output .= rounded_corners_tabs_bottom();
}
if (is_privilegied('user_management_admin')) {
    //$out = '<h2 style="margin: 0px;">Varningar</h2>';
    //$query = 'SELECT
    $out .= '<h2 style="margin-top: 0px; margin-bottom: 0px;">Abuse log</h2>';
    $query = 'SELECT * FROM user_abuse WHERE user = "******" ORDER BY id DESC';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    $out .= '<ul style="margin: 0px;">' . "\n";
    while ($data = mysql_fetch_assoc($result)) {
        $out .= '<li>' . "\n";
        $out .= date('Y-m-d H:i', $data['timestamp']) . ' <strong>' . $data['admin'] . '</strong> ' . $data['freetext'];
        $out .= '</li>' . "\n";
    }
    $out .= '</ul>' . "\n";
    echo rounded_corners($out, $void, true);
    echo '<h2>De senaste inläggen i forumet och gästboken</h2>' . "\n";
    echo '<p>Inga knappar funkar, men det ska ändå inte visas publikt.</p>' . "\n";
    $forum_posts = discussion_forum_post_fetch(array('disable_forum_lookup' => true, 'author' => $params['user_id'], 'limit' => 7, 'order-direction' => 'DESC'));
    foreach ($forum_posts as $post) {
        echo '<a href="' . forum_get_url_by_post($post['id']) . '"><h2>Goto goto! Jalla Jalla! Jihad! Jihad! Go fetch it!</h2></a>' . "\n";
        echo discussion_forum_post_render($post, array(), array('show_post_controls' => false));
    }
}
if (is_privilegied('use_ghosting_tools')) {
    $guestbook_posts = guestbook_fetch(array('sender' => $params['user_id'], 'is_private' => 0, 'limit' => 5));
    echo guestbook_list($guestbook_posts);
}
echo $output;
ui_bottom();
Esempio n. 2
0
function ui_top($options = array())
{
    /* Den här raden skapades när nya ui_top skapades. Låt den vara kvar, så kommer man ha något att le åt av nostalgiska syften. 2008-08-15, Joel.
     */
    if (rand(0, 73) == 50) {
        $query = 'UPDATE pageviews SET views = views + 73 WHERE date = "' . date('Y-m-d') . '" LIMIT 1';
        mysql_query($query);
        if (mysql_affected_rows() == 0) {
            $query = 'INSERT INTO pageviews (views, date) VALUES(73, "' . date('Y-m-d') . '")';
            mysql_query($query);
        }
    }
    if (login_checklogin() && rand(1, 5) == 2) {
        $query = 'UPDATE login SET lastrealaction="' . time() . '" WHERE id="' . $_SESSION['login']['id'] . '"';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    }
    if (isset($_SERVER['HTTP_REFERER']) && preg_match('/hamsterpaj\\.eu/', $_SERVER['HTTP_REFERER'])) {
        header('Location: http://child-abuse-trap.telia.se/');
    }
    $options['adtoma_category'] = isset($options['adtoma_category']) ? $options['adtoma_category'] : 'other';
    define('ADTOMA_CATEGORY', $options['adtoma_category']);
    $output = '';
    $output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' . "\n";
    $output .= '	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
    $output .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
    $output .= '	<head>' . "\n";
    $options['meta_description'] = isset($options['meta_description']) ? $options['meta_description'] : '';
    $options['meta_keywords'] = isset($options['meta_keywords']) ? $options['meta_keywords'] : '';
    $output .= '<meta name="description" content="' . $options['meta_description'] . '" />' . "\n";
    $output .= '<meta name="keywords" content="' . $options['meta_keywords'] . '" />' . "\n";
    $output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
    $output .= '<meta http-equiv="X-UA-Compatible" content="IE=8" />' . "\n";
    $options['title'] = isset($options['title']) ? $options['title'] : 'Hamsterpaj.net - Onlinespel, community, forum och annat kul ;)';
    $output .= '		<title>' . $options['title'] . '</title>' . "\n";
    $output .= '		<link rel="icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
    $output .= '		<link rel="shortcut icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
    $options['stylesheets'] = isset($options['stylesheets']) && is_array($options['stylesheets']) ? $options['stylesheets'] : array();
    // Stylesheets
    array_unshift($options['stylesheets'], 'ui.css');
    $options['stylesheets'][] = 'shared.css';
    $options['stylesheets'][] = 'new_guestbook.css';
    $options['stylesheets'][] = 'poll.css';
    $options['stylesheets'][] = 'ui_modules.css';
    $today_day = date('j');
    if (date('m') == 12 && $today_day >= 1 && $today_day <= 24) {
        $options['stylesheets'][] = 'ui_christmas.css';
    }
    // Remove duplicates
    $options['stylesheets'] = array_unique($options['stylesheets']);
    $output .= '<style type="text/css">' . "\n";
    foreach ($options['stylesheets'] as $stylesheet) {
        $output .= '@import url(\'/stylesheets/' . $stylesheet . '?version=' . filemtime(PATHS_WEBROOT . 'stylesheets/' . $stylesheet) . '\');' . "\n";
    }
    $output .= '</style>' . "\n";
    $options['adtoma_category'] = isset($options['adtoma_category']) ? $options['adtoma_category'] : 'other';
    define('ADTOMA_CATEGORY', $options['adtoma_category']);
    // Create HP namespace...
    $output .= '<script type="text/javascript" language="javascript">var hp = new Object();</script>' . "\n";
    $output .= '<script type="text/javascript" language="javascript">' . 'hp.login_checklogin = function(){ return ' . (login_checklogin() ? 'true' : 'false') . '; }' . '</script>' . "\n";
    $options['javascripts'] = isset($options['javascripts']) && is_array($options['javascripts']) ? $options['javascripts'] : array();
    $javascripts_path = PATHS_WEBROOT . 'javascripts/';
    global $js_compress_important_files;
    // standard_javascripts.conf.php
    if (ENVIRONMENT == 'development') {
        foreach ($js_compress_important_files as $javascript) {
            $output .= '<script type="text/javascript" language="javascript" src="/javascripts/' . $javascript . '?version=' . filemtime(PATHS_WEBROOT . 'javascripts/' . $javascript) . '"></script>' . "\n";
        }
        foreach ($options['javascripts'] as $javascript) {
            $output .= '<script type="text/javascript" language="javascript" src="/javascripts/' . $javascript . '"></script>' . "\n";
        }
    } else {
        $output .= '<script type="text/javascript" language="javascript" src="/javascripts/merge_' . filemtime(PATHS_STATIC . 'javascripts/merged.js') . '.js"></script>' . "\n";
        $options['javascripts'] = array_unique($options['javascripts']);
        foreach ($options['javascripts'] as $javascript) {
            $internal_path = PATHS_STATIC . 'javascripts/specified/' . $javascript;
            if (!in_array($javascript, $js_compress_important_files) && file_exists($internal_path)) {
                $output .= '<script type="text/javascript" language="javascript" src="/javascripts/compressed_' . preg_replace('/\\.js$/i', '', $javascript) . '_' . filemtime($internal_path) . '.js"></script>' . "\n";
            }
        }
    }
    $output .= isset($options['header_extra']) ? $options['header_extra'] : '';
    $output .= '<script type="text/javascript" src="http://nyheter24.se/template/1-0-1/javascript/ads.js?20090605"></script>';
    $output .= '<script type="text/javascript">Ads.init(\'http://ads.nyheter24.se/\', false);</script>';
    $output .= '</head> ' . "\n";
    $output .= '<body' . (isset($options['body_extra']) ? ' ' . $options['body_extra'] : '') . '>' . "\n";
    $output .= '<script type="text/javascript">' . "\n";
    $adtoma_gender = in_array($_SESSION['userinfo']['gender'], array('P', 'F')) ? $_SESSION['userinfo']['gender'] : 'xx';
    $adtoma_age = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? date_get_age($_SESSION['userinfo']['birthday']) : 'xx';
    $adtoma_birthyear = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? substr($_SESSION['userinfo']['birthday'], 0, 4) : 'xx';
    $output .= "\t" . 'var CM8Server = "ad.adtoma.com";' . "\n";
    $output .= "\t" . 'var CM8Cat = "hp.' . ADTOMA_CATEGORY . '";' . "\n";
    $output .= "\t" . 'var CM8Profile = "hp_age=' . $adtoma_age . '&hp_birthyear=' . $adtoma_birthyear . '&hp_gender=' . $adtoma_gender . '"' . "\n";
    $output .= '</script>' . "\n";
    $output .= '<script language="JavaScript" type="text/javascript" src="http://ad.adtoma.com/adam/cm8adam_1_call.js"></script>' . "\n";
    $output .= '<div>' . "\n";
    $output .= '	<script type="text/javascript">CM8ShowAd("Bigbanner");</script>' . "\n";
    $output .= '</div>' . "\n";
    if (isset($_SESSION['user_message'])) {
        $output .= jscript_alert($_SESSION['user_message'], true) . "\n";
        unset($_SESSION['user_message']);
    }
    // A big notice-bar shown on top, 60px height.
    /*	
    	$full_page_notice = '<h2>Något är jävligt fel med Amanda. Lef felsöker, därför kan det vara lite mobbat för stunden</h2>';
    	$full_page_notice .= '<span>Lol</span>';
    	$full_page_notice_id = 'dynamadsic01ochumbaaerkaera'; //Set this to a unique ID for this notice
    */
    // Don't remove those lines
    if (isset($full_page_notice) && $_COOKIE[$full_page_notice_id] != 'closed') {
        $output .= '<div id="ui_full_page_notice" class="' . $full_page_notice_id . '">' . "\n";
        $output .= '<img src="" alt="[close]" id="ui_full_page_notice_close" />' . "\n";
        $output .= $full_page_notice . "\n";
        $output .= '</div>' . "\n";
    }
    $output .= '<div>' . "\n";
    $output .= '<script type=\'text/javascript\'>Ads.insert(250, \'\');</script>' . "\n";
    $output .= '</div>' . "\n";
    //The ad-wrapper is there to make sure right side ad's doesn't fall down
    $output .= '<div id="ad_wrapper">' . "\n";
    $output .= '	<div id="ui_wrapper">' . "\n";
    $custom_logo_style = isset($options['custom_logo']) ? 'style="background-image: url(\'' . $options['custom_logo'] . '\');"' : '';
    $output .= '		<div id="ui_header">' . "\n";
    $output .= '			<h1>' . "\n";
    $output .= '				<a href="/"' . $custom_logo_style . '>Hamsterpaj.net</a>' . "\n";
    $output .= '			</h1>' . "\n";
    if (login_checklogin()) {
        $output .= '			<div id="ui_noticebar">' . "\n";
        $output .= '				<ul>' . "\n";
        $notices = ui_notices_fetch();
        $output .= '					<li>' . "\n";
        $output .= '						<a id="ui_noticebar_guestbook" ' . ($notices['guestbook'] > 0 ? 'class="ui_noticebar_active"' : '') . ' href="/traffa/guestbook.php?user_id=' . $_SESSION['login']['id'] . '">';
        $output .= $notices['guestbook'] > 0 ? $notices['guestbook'] == 1 ? 'Ett nytt' : $notices['guestbook'] . ' nya' : 'Gästbok';
        $output .= '						</a>';
        $output .= '					</li>' . "\n";
        $output .= '					<li id="ui_noticebar_forum_container">' . "\n";
        $output .= '						<a id="ui_noticebar_forum" ' . ($notices['discussion_forum']['new_notices'] > 0 ? 'class="ui_noticebar_active"' : '') . ' href="/diskussionsforum/notiser.php">';
        $output .= $notices['discussion_forum']['new_notices'] > 0 ? $notices['discussion_forum']['new_notices'] == 1 ? 'Ny notis' : $notices['discussion_forum']['new_notices'] . ' nya' : 'Forum';
        $output .= '						</a>' . "\n";
        $output .= '						<ul class="ui_noticebar_info">' . "\n";
        $output .= '							<li class="ui_noticebar_infoheader"><h3>Dina forumnotiser</h3></li>' . "\n";
        foreach ($notices['discussion_forum']['subscriptions'] as $subscription) {
            $output .= '							<li><a href="' . $subscription['url'] . '">' . $subscription['title'] . ' (<strong>' . $subscription['unread_posts'] . ' nya</strong>)</a></li>' . "\n";
        }
        $output .= '						</ul>' . "\n";
        $output .= '					</li>' . "\n";
        $output .= '					<li id="ui_noticebar_groups_container">' . "\n";
        $output .= '						<a id="ui_noticebar_groups" ' . ($notices['groups']['unread_notices'] > 0 ? 'class="ui_noticebar_active"' : '') . ' href="/traffa/groupnotices.php">';
        $output .= $notices['groups']['unread_notices'] >= 1 ? $notices['groups']['unread_notices'] == 1 ? 'Ett nytt' : $notices['groups']['unread_notices'] . ' nya' : 'Grupper';
        $output .= '						</a>' . "\n";
        $output .= '						<ul class="ui_noticebar_info">' . "\n";
        $output .= '							<li class="ui_noticebar_infoheader"><h3>Dina gruppinl&auml;gg</h3></li>' . "\n";
        foreach ($notices['groups']['groups'] as $group_id => $group) {
            $output .= '							<li><a href="/traffa/groups.php?action=goto&groupid=' . $group_id . '">' . ($group['unread_messages'] > 0 ? '<strong>' : '') . $group['title'] . ' (' . $group['unread_messages'] . ' nya)' . ($group['unread_messages'] > 0 ? '</strong>' : '') . '</a></li>' . "\n";
        }
        $output .= '						</ul>' . "\n";
        $output .= '					</li>' . "\n";
        $output .= '					<li>' . "\n";
        $output .= '						<a id="ui_noticebar_events" ' . ($notices['photo_comments'] + $notices['messages'] > 0 ? 'class="ui_noticebar_active"' : '') . ' style="background-image: url(http://images.hamsterpaj.net/ui/events/events' . date('j') . '.png)" href="/traffa/events.php">' . ($notices['photo_comments'] >= 1 ? $notices['photo_comments'] == 1 ? 'En ny' : $notices['photo_comments'] . ' nya' : 'Händelser') . '</a>' . "\n";
        $output .= '						<ul class="ui_noticebar_info">' . "\n";
        $output .= '							<li class="ui_noticebar_infoheader"><h3>Dina h&auml;ndelser</h3></li>' . "\n";
        $output .= '						</ul>' . "\n";
        $output .= '					</li>' . "\n";
        $output .= '				</ul>' . "\n";
        $output .= '			</div>' . "\n";
        $output .= '			<div id="ui_statusbar">' . "\n";
        //$output .= '				<a href="#">' . "\n";
        //$output .= '					<img src="' . IMAGE_URL . 'images/users/thumb/' . $_SESSION['login']['id'] . '.jpg" alt="" onclick="window.open(\'/avatar.php?id=' . $_SESSION['login']['id'] . '\',\'' . rand() . '\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=410, height=600\')"/>' . "\n";
        $output .= '					' . ui_avatar($_SESSION['login']['id']) . "\n";
        //$output .= '				</a>' . "\n";
        $output .= '				<div id="ui_statusbar_username">' . "\n";
        $output .= '					<a href="/traffa/profile.php?user_id=' . $_SESSION['login']['id'] . '"><strong>' . $_SESSION['login']['username'] . '</strong></a><span> | </span><a href="/login/logout.php">Logga ut</a><br />' . "\n";
        $output .= '				</div>' . "\n";
        $output .= '				<div id="ui_statusbar_logintime">' . "\n";
        $online_secs = time() - $_SESSION['login']['lastlogon'];
        $online_days = floor($online_secs / 86400);
        $online_hrs = floor(($online_secs - $online_days * 86400) / 3600);
        $online_mins = floor($online_secs % 3600 / 60);
        $time_online_readable = $online_days == 1 ? '1 d, ' : ($online_days > 1 ? $online_days . ' d ' : '');
        $time_online_readable .= $online_hrs > 0 ? $online_hrs . ' tim ' : '';
        $time_online_readable .= $online_mins > 0 ? $online_mins . ' min' : ($online_hrs == 0 && $online_days == 0 && $online_mins == 0 ? '0 min' : '');
        $output .= '					<span>' . $time_online_readable . '</span>' . "\n";
        $output .= '				</div>' . "\n";
        $output .= '				<div id="ui_statusbar_forumstatus">' . "\n";
        $output .= '					<span title="' . $_SESSION['userinfo']['user_status'] . '">' . (strlen(trim($_SESSION['userinfo']['user_status'])) > 0 ? mb_strlen($_SESSION['userinfo']['user_status'], 'UTF8') > 22 ? mb_substr($_SESSION['userinfo']['user_status'], 0, 19, 'UTF8') . '...' : $_SESSION['userinfo']['user_status'] : 'Ingen status') . '</span>' . "\n";
        $output .= '				</div>' . "\n";
        $output .= '			</div>' . "\n";
    } else {
        $output .= '			<div id="ui_login">' . "\n";
        $output .= '				<form action="/login/login.php?action=login" method="post">' . "\n";
        $output .= '					<p><label><strong>Användarnamn:</strong><br /><input id="ui_login_username" type="text" name="username" /></label></p>' . "\n";
        $output .= '					<p><label><strong>Lösenord:</strong><br /><input id="ui_login_password" type="password" name="password" /></label></p>' . "\n";
        $output .= '					<p><input class="ui_login_submit" type="submit" value="Logga in" /></p>' . "\n";
        $output .= '				</form>' . "\n";
        $output .= '				<form action="/register.php" method="get">' . "\n";
        $output .= '					<p><input class="ui_login_submit" type="submit" value="Registrera" /></p>' . "\n";
        $output .= '				</form>' . "\n";
        $output .= '			</div>' . "\n";
    }
    // end login_checklogin
    $output .= '		</div>' . "\n";
    $output .= '		<div id="ui_menu">' . "\n";
    $output .= '				<ul>' . "\n";
    global $menu;
    if (isset($options['menu_addition'])) {
        $menu = array_merge_recursive($menu, $options['menu_addition']);
    }
    foreach ($menu as $handle => $current_menu) {
        if (isset($current_menu['is_privilegied'])) {
            $current_menu['is_privilegied'] = is_array($current_menu['is_privilegied']) ? $current_menu['is_privilegied'] : array($current_menu['is_privilegied']);
            $is_privilegied = false;
            foreach ($current_menu['is_privilegied'] as $privilegie) {
                if (is_privilegied($privilegie)) {
                    $is_privilegied = true;
                }
            }
        } else {
            $is_privilegied = true;
        }
        if ($is_privilegied == true) {
            $target = isset($current_menu['target']) ? ' target="' . $current_menu['target'] . '"' : '';
            $output .= '					<li style="z-index: 3;">' . "\n";
            $output .= '						<a href="' . $current_menu['url'] . '" class="root-a"' . $target . '>' . $current_menu['label'] . '</a>' . "\n";
            $output .= '							<ul>' . "\n";
            $output .= '								<li><a href="' . $current_menu['url'] . '">Start</a></li>' . "\n";
            if (count($current_menu['children']) > 0) {
                $output .= ui_menu_subcategories_fetch($current_menu['children'], $options);
            }
            $output .= '							</ul>' . "\n";
            $output .= '					</li>' . "\n";
        }
    }
    $output .= '				</ul>' . "\n";
    $output .= '<img src="http://images.hamsterpaj.net/steve/empty.gif" id="steve" />' . "\n";
    $output .= '		</div>' . "\n";
    if (isset($_SESSION['notice_message'])) {
        if (login_checklogin()) {
            $noticemessages[] = array('html' => $_SESSION['notice_message']);
        }
        unset($_SESSION['notice_message']);
    }
    $data = cache_load('recent_update');
    if ($data['timestamp'] > time() - 1200 && $_SESSION['recent_update_notifier'][$data['id']] < 10) {
        global $RECENT_UPDATES;
        $content = '<span class="ui_notice_time">' . date('H:i', $data['timestamp']) . '</span>' . "\n";
        $content .= '<span class="ui_notice_event">' . $RECENT_UPDATES[$data['type']] . '</span>' . "\n";
        $content .= '<span class="ui_notice_link"><a href="/recent_updates_redirect.php?id=' . $data['id'] . '&url=' . urlencode($data['url']) . '&source=global_notice">' . $data['label'] . '</a></span>' . "\n";
        $noticemessages[] = array('html' => $content);
        $_SESSION['recent_update_notifier'][$data['id']]++;
    }
    $data = cache_load('live_chat_new_message');
    if (isset($_SESSION['seen_live_chat_notice']) && $_SESSION['seen_live_chat_notice'][$data['id']] < 2 && $data['timestamp'] > time() - 60 && login_checklogin()) {
        $_SESSION['seen_live_chat_notice'][$data['id']]++;
        $content = '<a href="/traffa/klotterplanket.php">';
        $content .= $data['author'] . ' skrev precis på klotterplanket. Skriv något du med?';
        $content .= '</a>';
        $noticemessages[] = array('html' => $content);
    }
    if (isset($noticemessages) && count($noticemessages)) {
        foreach ($noticemessages as $noticemessage) {
            $output .= '<div id="ui_notice">' . "\n";
            if (isset($noticemessage['timestamp'])) {
                $output .= '<span class="ui_notice_time">' . date('H:i', $noticemessage['timestamp']) . '</span>' . "\n";
            }
            $output .= $noticemessage['html'];
            $output .= '</div>' . "\n";
        }
    }
    //		$output .= '			<div id="ui_noticebar">' . "\n";
    //	$output .= 'Nu finns det en risk att forumet (och kanske hela sidan) kommer uppföra sig lite knepigt. Vi behöver rätta till en gammal tankemiss i kategorihanteringen för fourmet... Klagomål hänvisas till <a href="/traffa/profile.php?id=15">heggan</a>. //Johan';
    //	$output .= '			</div>' . "\n";
    if (login_checklogin()) {
        if (isset($_SESSION['unread_gb_entries'])) {
            $output .= guestbook_list($_SESSION['unread_gb_entries']);
            unset($_SESSION['unread_gb_entries']);
        }
    }
    if (isset($options['xxl'])) {
        $output .= '<div>' . $options['xxl'] . '</div>' . "\n";
    }
    $output .= '		<div id="ui_content">' . "\n";
    if (isset($options['return']) && $options['return'] == true) {
        return $output;
    } else {
        echo $output;
    }
}
Esempio n. 3
0
function guestbook_page()
{
    //Get pagenumber
    $page = 1;
    if (isset($_GET['page']) && is_numeric($_GET['page'])) {
        $page = intval($_GET['page']);
        if ($page < 1 || $page > 999) {
            $page = 1;
        }
    }
    $fetch['offset'] = ($page - 1) * 30;
    $fetch['limit'] = 30;
    $entries = guestbook_fetch($fetch);
    $out .= guestbook_list($entries);
    //Create Pagination links
    if (isset($_GET['page']) && is_numeric($_GET['page'])) {
        $page = intval($_GET['page']);
        if ($page > 1) {
            $out .= ' <a href="' . $_SERVER['PHP_SELF'];
            $out .= isset($_GET['view']) ? '?view=' . $_GET['view'] . '&page' : '?page';
            $out .= '=' . ($page - 1) . '">&laquo; Föregående</a> |';
        }
        if ($page > 0) {
            $out .= ' ' . $page . ' | <a href="' . $_SERVER['PHP_SELF'];
            $out .= isset($_GET['view']) ? '?view=' . $_GET['view'] . '&page' : '?page';
            $out .= '=' . ($page + 1) . '">Nästa &raquo;</a>';
        }
    } else {
        $out .= ' <a href="' . $_SERVER['PHP_SELF'];
        $out .= isset($_GET['view']) ? '?view=' . $_GET['view'] . '&page' : '?page';
        $out .= '=2">Nästa &raquo;</a>';
    }
    return $out;
}
Esempio n. 4
0
    }
    $ui_options['stylesheets'][] = 'profile_themes/' . $profile['profile_theme'] . '.css';
    $out .= '<div class="profile_' . $profile['profile_theme'] . '">' . "\n";
    $out .= profile_head($profile);
    $out .= '</div>' . "\n";
    $ui_options['stylesheets'][] = 'user_profile.css';
    $ui_options['javascripts'][] = 'user_profile.js';
    if (isset($_GET['history'])) {
        $fetch['recipient'] = array($fetch['recipient'], $_GET['history']);
        $fetch['sender'] = $fetch['recipient'];
    }
    if (!isset($_GET['history']) && login_checklogin() && $fetch['recipient'] != $_SESSION['login']['id'] && !is_array($fetch['recipient'])) {
        $out .= guestbook_form(array('recipient' => $fetch['recipient']));
    }
    $entries = guestbook_fetch($fetch);
    $out .= guestbook_list($entries);
    if (login_checklogin()) {
        foreach ($entries as $entry) {
            if ($entry['recipient'] == $_SESSION['login']['id'] && $entry['read'] == 0) {
                $update_read[] = $entry['id'];
            }
        }
        if (count($update_read) > 0) {
            $query = 'UPDATE traffa_guestbooks SET `read` = 1 WHERE id IN("' . implode('", "', $update_read) . '")';
            mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
            $_SESSION['notices']['unread_gb_entries'] -= count($update_read);
        }
        $_SESSION['notices']['unread_gb_entries'] = 0;
    }
} else {
    $out .= '<h1>Oops, du verkar ha loggats ut</h1>' . "\n";
Esempio n. 5
0
function ui_new_top($options = array())
{
    /* Den här raden skapades när nya ui_top skapades. Låt den vara kvar, så kommer
    	   man ha något att le åt av nostalgiska syften. 2008-08-15, Joel.
    	*/
    if (rand(0, 73) == 50) {
        $query = 'UPDATE pageviews SET views = views + 73 WHERE date = "' . date('Y-m-d') . '" LIMIT 1';
        mysql_query($query);
        if (mysql_affected_rows() == 0) {
            $query = 'INSERT INTO pageviews (views, date) VALUES(73, "' . date('Y-m-d') . '")';
            mysql_query($query);
        }
    }
    if (login_checklogin() && rand(1, 5) == 2) {
        $query = 'UPDATE login SET lastrealaction="' . time() . '" WHERE id="' . $_SESSION['login']['id'] . '"';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    }
    $options['adtoma_category'] = isset($options['adtoma_category']) ? $options['adtoma_category'] : 'other';
    define('ADTOMA_CATEGORY', $options['adtoma_category']);
    $output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' . "\n";
    $output .= '	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
    $output .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
    $output .= '	<head>' . "\n";
    $output .= '<meta name="description" content="' . $options['meta_description'] . '" />' . "\n";
    $output .= '<meta name="keywords" content="' . $options['meta_keywords'] . '" />' . "\n";
    $output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
    $options['title'] = isset($options['title']) ? $options['title'] : 'Hamsterpaj.net - Onlinespel, community, forum och annat kul ;)';
    $output .= '		<title>' . $options['title'] . '</title>' . "\n";
    $output .= '		<link rel="icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
    $output .= '		<link rel="shortcut icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
    $options['javascripts'] = isset($options['javascripts']) && is_array($options['javascripts']) ? $options['javascripts'] : array();
    $options['stylesheets'] = isset($options['stylesheets']) && is_array($options['stylesheets']) ? $options['stylesheets'] : array();
    // Javascripts (Order: jQuery, Womlib (needs jQuery to work properly!), synchronize, The rest...)
    $options['javascripts'] = array_merge(array('jquery.js', 'womlib.js', 'jquery.dimensions.js', 'jquery-ui.js', 'synchronize.js'), $options['javascripts']);
    $options['javascripts'][] = 'ui_server_message.js';
    $options['javascripts'][] = 'scripts.js';
    $options['javascripts'][] = 'steve.js';
    $options['javascripts'][] = 'new_guestbook.js';
    $options['javascripts'][] = 'forum.js';
    $options['javascripts'][] = 'posts.js';
    $options['javascripts'][] = 'abuse_report.js';
    $options['javascripts'][] = 'poll.js';
    $options['javascripts'][] = 'swfobject.js';
    $options['javascripts'][] = 'md5.js';
    $options['javascripts'][] = 'xmlhttp_login.js';
    $options['javascripts'][] = 'xmlhttp.js';
    $options['javascripts'][] = 'fult_dhml-skit_som_faar_bilder_att_flyga.js';
    $options['javascripts'][] = 'wave_effect.js';
    $options['javascripts'][] = 'joels_hackerkod.js';
    $options['javascripts'][] = 'ui.js';
    $options['javascripts'][] = 'ui_modules.js';
    $options['javascripts'][] = 'ui_business_card.js';
    $options['javascripts'][] = 'ui_multisearch.js';
    if (!login_checklogin()) {
        $options['javascripts'][] = 'tiny_reg_form.js';
    }
    if ($_SESSION['login']['id'] > 0) {
        $options['javascripts'][] = 'stay_online.js';
    }
    // Stylesheets
    array_unshift($options['stylesheets'], 'ui.css');
    $options['stylesheets'][] = 'tiny_reg_form.css';
    $options['stylesheets'][] = 'shared.css';
    $options['stylesheets'][] = 'modules.css';
    $options['stylesheets'][] = 'buttons.css';
    $options['stylesheets'][] = 'new_guestbook.css';
    $options['stylesheets'][] = 'rounded_corners.css';
    $options['stylesheets'][] = 'message.css';
    $options['stylesheets'][] = 'domTT.css';
    $options['stylesheets'][] = 'poll.css';
    $options['stylesheets'][] = 'ui_modules/friends_online.css';
    $options['stylesheets'][] = 'ui_modules/friends_notices.css';
    $options['stylesheets'][] = 'ui_modules/forum_threads.css';
    $options['stylesheets'][] = 'ui_modules/forum_posts.css';
    // Remove duplicates
    $options['stylesheets'] = array_unique($options['stylesheets']);
    $options['javascripts'] = array_unique($options['javascripts']);
    $output .= '<style type="text/css">' . "\n";
    foreach ($options['stylesheets'] as $stylesheet) {
        $output .= '@import url(\'/stylesheets/' . $stylesheet . '?version=' . filemtime(PATHS_WEBROOT . 'stylesheets/' . $stylesheet) . '\');' . "\n";
    }
    $output .= '</style>' . "\n";
    foreach ($options['javascripts'] as $javascript) {
        $output .= '<script type="text/javascript" language="javascript" src="/javascripts/' . $javascript . '?version=' . filemtime(PATHS_WEBROOT . 'javascripts/' . $javascript) . '"></script>' . "\n";
    }
    $output .= $options['header_extra'];
    $output .= '</head> ' . "\n";
    $output .= '<body' . (isset($options['body_extra']) ? ' ' . $options['body_extra'] : '') . '>' . "\n";
    $output .= '<script type="text/javascript">' . "\n";
    $adtoma_gender = in_array($_SESSION['userinfo']['gender'], array('P', 'F')) ? $_SESSION['userinfo']['gender'] : 'xx';
    $adtoma_age = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? date_get_age($_SESSION['userinfo']['birthday']) : 'xx';
    $adtoma_birthyear = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? substr($_SESSION['userinfo']['birthday'], 0, 4) : 'xx';
    $output .= "\t" . 'var CM8Server = "ad.adtoma.com";' . "\n";
    $output .= "\t" . 'var CM8Cat = "hp.' . ADTOMA_CATEGORY . '";' . "\n";
    $output .= "\t" . 'var CM8Profile = "hp_age=' . $adtoma_age . '&amp;hp_birthyear=' . $adtoma_birthyear . '&amp;hp_gender=' . $adtoma_gender . '"' . "\n";
    $output .= '</script>' . "\n";
    $output .= '<script language="JavaScript" type="text/javascript" src="http://ad.adtoma.com/adam/cm8adam_1_call.js"></script>' . "\n";
    $output .= '<div>' . "\n";
    $output .= '	<script type="text/javascript">CM8ShowAd("Bigbanner");</script>' . "\n";
    $output .= '</div>' . "\n";
    $output .= '	<div id="ui_wrapper">' . "\n";
    $output .= '		<div id="ui_header">' . "\n";
    $output .= '			<h1>' . "\n";
    $output .= '				<a href="/">Hamsterpaj.net</a>' . "\n";
    $output .= '			</h1>' . "\n";
    $output .= '			<div id="ui_noticebar">' . "\n";
    $output .= '				<ul>' . "\n";
    $notices = ui_notices_fetch();
    $output .= '					<li>' . "\n";
    $output .= '						<a id="ui_noticebar_guestbook' . ($notices['guestbook'] > 0 ? '_active' : '') . '" href="/traffa/guestbook.php?user_id=' . $_SESSION['login']['id'] . '">';
    $output .= $notices['guestbook'] > 0 ? $notices['guestbook'] == 1 ? 'Ett nytt' : $notices['guestbook'] . ' nya' : 'Gästbok';
    $output .= '						</a>';
    $output .= '					</li>' . "\n";
    $output .= '					<li id="ui_noticebar_forum_container">' . "\n";
    $output .= '						<a id="ui_noticebar_forum' . ($notices['discussion_forum']['new_notices'] > 0 ? '_active' : '') . '" href="/diskussionsforum/notiser.php">';
    $output .= $notices['discussion_forum']['new_notices'] > 0 ? $notices['discussion_forum']['new_notices'] == 1 ? 'Ny notis' : $notices['discussion_forum']['new_notices'] . ' nya' : 'Forum';
    $output .= '						</a>' . "\n";
    $output .= '						<ul class="ui_noticebar_info">' . "\n";
    $output .= '							<li class="ui_noticebar_infoheader"><h3>Dina forumnotiser</h3></li>' . "\n";
    foreach ($notices['discussion_forum']['subscriptions'] as $subscription) {
        $output .= '							<li><a href="' . $subscription['url'] . '">' . $subscription['title'] . ' (<strong>' . $subscription['unread_posts'] . ' nya</strong>)</a></li>' . "\n";
    }
    $output .= '						</ul>' . "\n";
    $output .= '					</li>' . "\n";
    $output .= '					<li id="ui_noticebar_groups_container">' . "\n";
    $output .= '						<a id="ui_noticebar_groups' . ($notices['groups']['unread_notices'] > 0 ? '_active' : '') . '" href="/traffa/groupnotices.php">';
    $output .= $notices['groups']['unread_notices'] > 1 ? $notices['groups']['unread_notices'] == 0 ? 'Ett nytt' : $notices['groups']['unread_notices'] . ' nya' : 'Grupper';
    $output .= '						</a>' . "\n";
    $output .= '						<ul class="ui_noticebar_info">' . "\n";
    $output .= '							<li class="ui_noticebar_infoheader"><h3>Dina gruppinl&auml;gg</h3></li>' . "\n";
    foreach ($notices['groups']['groups'] as $group_id => $group) {
        $output .= '							<li><a href="/traffa/groups.php?action=goto&groupid=' . $group_id . '">' . ($group['unread_messages'] > 0 ? '<strong>' : '') . $group['title'] . ' (' . $group['unread_messages'] . ' nya)' . ($group['unread_messages'] > 0 ? '</strong>' : '') . '</a></li>' . "\n";
    }
    $output .= '						</ul>' . "\n";
    $output .= '					</li>' . "\n";
    $output .= '					<li>' . "\n";
    $output .= '						<a id="ui_noticebar_events" href="#">Händelser</a>' . "\n";
    $output .= '						<ul class="ui_noticebar_info">' . "\n";
    $output .= '							<li class="ui_noticebar_infoheader"><h3>Dina h&auml;ndelser</h3></li>' . "\n";
    $output .= '						</ul>' . "\n";
    $output .= '					</li>' . "\n";
    $output .= '				</ul>' . "\n";
    $output .= '			</div>' . "\n";
    $output .= '			<div id="ui_statusbar">' . "\n";
    $output .= '				<a href="#" title="Byt visningsbild">' . "\n";
    $output .= '					<img src="http://images.hamsterpaj.net/images/users/thumb/' . $_SESSION['login']['id'] . '.jpg" alt="" onclick="window.open(\'/avatar.php?id=' . $_SESSION['login']['id'] . '\',\'' . rand() . '\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=410, height=600\')"/>' . "\n";
    $output .= '				</a>' . "\n";
    $output .= '				<div id="ui_statusbar_username">' . "\n";
    $output .= '					<a href="/traffa/profile.php?user_id=' . $_SESSION['login']['id'] . '"><strong>' . $_SESSION['login']['username'] . '</strong></a><span> | </span><a href="/logout.php">Logga ut</a><br />' . "\n";
    $output .= '				</div>' . "\n";
    $output .= '				<div id="ui_statusbar_logintime">' . "\n";
    $online_secs = time() - $_SESSION['login']['lastlogon'];
    $online_days = floor($online_secs / 86400);
    $online_hrs = floor(($online_secs - $online_days * 86400) / 3600);
    $online_mins = floor($online_secs % 3600 / 60);
    $time_online_readable = $online_days == 1 ? '1 d, ' : ($online_days > 1 ? $online_days . ' d ' : '');
    $time_online_readable .= $online_hrs > 0 ? $online_hrs . ' tim ' : '';
    $time_online_readable .= $online_mins > 0 ? $online_mins . ' min' : ($online_hrs == 0 && $online_days == 0 && $online_mins == 0 ? '0 min' : '');
    $output .= '					<span>' . $time_online_readable . '</span>' . "\n";
    $output .= '				</div>' . "\n";
    $output .= '				<div id="ui_statusbar_forumstatus">' . "\n";
    $output .= '					<span title="' . $_SESSION['userinfo']['user_status'] . '">' . (strlen(trim($_SESSION['userinfo']['user_status'])) > 0 ? mb_strlen($_SESSION['userinfo']['user_status'], 'UTF8') > 22 ? mb_substr($_SESSION['userinfo']['user_status'], 0, 19, 'UTF8') . '...' : $_SESSION['userinfo']['user_status'] : 'Ingen status') . '</span>' . "\n";
    $output .= '				</div>' . "\n";
    $output .= '			</div>' . "\n";
    $output .= '		</div>' . "\n";
    $output .= '		<div id="ui_menu">' . "\n";
    $output .= '				<ul>' . "\n";
    global $menu;
    if (isset($options['menu_addition'])) {
        $menu = array_merge_recursive($menu, $options['menu_addition']);
    }
    foreach ($menu as $handle => $current_menu) {
        if (isset($current_menu['is_privilegied'])) {
            $current_menu['is_privilegied'] = is_array($current_menu['is_privilegied']) ? $current_menu['is_privilegied'] : array($current_menu['is_privilegied']);
            $is_privilegied = false;
            foreach ($current_menu['is_privilegied'] as $privilegie) {
                if (is_privilegied($privilegie)) {
                    $is_privilegied = true;
                }
            }
        } else {
            $is_privilegied = true;
        }
        if ($is_privilegied == true) {
            $target = isset($current_menu['target']) ? ' target="' . $current_menu['target'] . '"' : '';
            $output .= '					<li>' . "\n";
            $output .= '						<a href="' . $current_menu['url'] . '" class="root-a"' . $target . '>' . $current_menu['label'] . '</a>' . "\n";
            $output .= '							<ul>' . "\n";
            if (count($current_menu['children']) > 0) {
                $output .= ui_menu_subcategories_fetch($current_menu['children'], $options);
            }
            $output .= '							</ul>' . "\n";
            $output .= '					</li>' . "\n";
        }
    }
    $output .= '				</ul>' . "\n";
    $output .= '		</div>' . "\n";
    /*$output .= 'Rektangel:';
    	$output .= '<script type="text/javascript">CM8ShowAd("Rektangel");</script>' . "\n";
    	$output .= 'Skyscrape (Höger?):';
    	$output .= '<div id="skyscraper">' . "\n";
    	$output .= '<script type="text/javascript">CM8ShowAd("Skyscraper");</script>' . "\n";
    	$output .= '</div>' . "\n";*/
    if (isset($_SESSION['notice_message'])) {
        if (login_checklogin()) {
            $notices[] = array('html' => $_SESSION['notice_message']);
        }
        unset($_SESSION['notice_message']);
    }
    $data = cache_load('recent_update');
    if ($data['timestamp'] > time() - 1200 && $_SESSION['recent_update_notifier'][$data['id']] < 10) {
        global $RECENT_UPDATES;
        $content = '<span class="ui_notice_time">' . date('H:i', $data['timestamp']) . '</span>' . "\n";
        $content .= '<span class="ui_notice_event">' . $RECENT_UPDATES[$data['type']] . '</span>' . "\n";
        $content .= '<span class="ui_notice_link"><a href="/recent_updates_redirect.php?id=' . $data['id'] . '&url=' . urlencode($data['url']) . '&source=global_notice">' . $data['label'] . '</a></span>' . "\n";
        $noticemessages[] = array('html' => $content);
        $_SESSION['recent_update_notifier'][$data['id']]++;
    }
    foreach ($noticemessages as $noticemessage) {
        $output .= '<div id="ui_notice">' . "\n";
        if (isset($noticemessage['timestamp'])) {
            $output .= '<span class="ui_notice_time">' . date('H:i', $noticemessage['timestamp']) . '</span>' . "\n";
        }
        $output .= $noticemessage['html'];
        $output .= '</div>' . "\n";
    }
    if (login_checklogin()) {
        if (isset($_SESSION['unread_gb_entries'])) {
            $output .= guestbook_list($_SESSION['unread_gb_entries']);
            unset($_SESSION['unread_gb_entries']);
        }
    }
    $output .= '		<div id="ui_content_thin">' . "\n";
    if (isset($options['return']) && $options['return'] == true) {
        return $output;
    } else {
        echo $output;
    }
}
Esempio n. 6
0
function ui_top($options)
{
    if (isset($_SESSION['new_design'])) {
        echo ui_new_top($options);
        return;
    }
    global $SIDE_MODULES;
    if (!isset($options['adtoma_category'])) {
        $options['adtoma_category'] = 'other';
    }
    define('ADTOMA_CATEGORY', $options['adtoma_category']);
    if (login_checklogin() && rand(1, 5) == 2) {
        $query = 'UPDATE login SET lastrealaction="' . time() . '" WHERE id="' . $_SESSION['login']['id'] . '"';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    }
    $options['title'] = isset($options['title']) ? $options['title'] : 'Hamsterpaj.net - Onlinespel, community, forum och annat kul ;)';
    $options['stylesheets'][] = 'shared.css';
    $options['stylesheets'][] = 'modules.css';
    $options['stylesheets'][] = 'buttons.css';
    $options['stylesheets'][] = 'new_guestbook.css';
    $options['stylesheets'][] = 'rounded_corners.css';
    $options['stylesheets'][] = 'message.css';
    $options['stylesheets'][] = 'domTT.css';
    $options['stylesheets'][] = 'poll.css';
    /* Order:
    			jQuery
    			Womlib (needs jQuery to work properly!)
    			The rest...
    		*/
    if (is_array($options['javascripts'])) {
        array_unshift($options['javascripts'], 'womlib.js');
    } else {
        $options['javascripts'] = array('womlib.js');
    }
    if ($_SESSION['login']['id'] > 0) {
        $options['javascripts'][] = 'stay_online.js';
    }
    $options['javascripts'][] = 'ui_server_message.js';
    $options['javascripts'][] = 'scripts.js';
    $options['javascripts'][] = 'steve.js';
    $options['javascripts'][] = 'new_guestbook.js';
    $options['javascripts'][] = 'forum.js';
    $options['javascripts'][] = 'posts.js';
    $options['javascripts'][] = 'abuse_report.js';
    $options['javascripts'][] = 'poll.js';
    array_unshift($options['javascripts'], 'jquery.js');
    $options['javascripts'][] = 'swfobject.js';
    $options['javascripts'][] = 'md5.js';
    $options['javascripts'][] = 'xmlhttp_login.js';
    $options['javascripts'][] = 'xmlhttp.js';
    $options['javascripts'][] = 'fult_dhml-skit_som_faar_bilder_att_flyga.js';
    $options['javascripts'][] = 'wave_effect.js';
    $options['javascripts'][] = 'joels_hackerkod.js';
    $options['javascripts'][] = 'ui.js';
    if (!login_checklogin()) {
        $options['javascripts'][] = 'tiny_reg_form.js';
        $options['stylesheets'][] = 'tiny_reg_form.css';
    }
    if (rand(0, 73) == 50) {
        $query = 'UPDATE pageviews SET views = views + 73 WHERE date = "' . date('Y-m-d') . '" LIMIT 1';
        mysql_query($query);
        if (mysql_affected_rows() == 0) {
            $query = 'INSERT INTO pageviews (views, date) VALUES(73, "' . date('Y-m-d') . '")';
            mysql_query($query);
        }
    }
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
    echo '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
    echo '<head>' . "\n";
    echo '<meta name="description" content="' . $options['meta_description'] . '" />' . "\n";
    echo '<meta name="keywords" content="' . $options['meta_keywords'] . '" />' . "\n";
    echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
    echo '<title>' . $options['title'] . '</title>' . "\n";
    echo '<link rel="icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
    echo '<link rel="shortcut icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
    array_unshift($options['stylesheets'], 'ui.css.php');
    echo "\n\n" . '<!-- Load stylesheets, version is timestamp of last file modification. Current timestamp is: ' . time() . ' -->' . "\n";
    echo '<style type="text/css">' . "\n";
    foreach ($options['stylesheets'] as $stylesheet) {
        echo '@import url(\'/stylesheets/' . $stylesheet . '?version=' . filemtime(PATHS_WEBROOT . 'stylesheets/' . $stylesheet) . '\');' . "\n";
    }
    echo '</style>' . "\n";
    echo "\n\n" . '<!-- Load javascripts, version is timestamp of last file modification. -->' . "\n";
    foreach ($options['javascripts'] as $javascript) {
        echo '<script type="text/javascript" language="javascript" ';
        echo 'src="/javascripts/' . $javascript . '?version=' . filemtime(PATHS_WEBROOT . 'javascripts/' . $javascript) . '"></script>' . "\n";
    }
    if (isset($options['enable_rte'])) {
        echo '<script language="javascript" type="text/javascript" src="/javascripts/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
						<script language="javascript" type="text/javascript">
						tinyMCE.init({
							mode : "exact",
							elements: "post_form_content",
							theme: "advanced",
							theme_advanced_buttons1 : "bold,italic,underline,separator,bullist,numlist,separator,sup,charmap",
							theme_advanced_buttons2 : "",
							theme_advanced_buttons3 : "",
							theme_advanced_resize_horizontal : false,
							theme_advanced_resizing : true,
							theme_advanced_path : false,
							theme_advanced_toolbar_location : "top",
							theme_advanced_statusbar_location : "bottom",
							theme_advanced_toolbar_align : "left",
							auto_reset_designmode : true
						});
						</script>';
    }
    echo "\n\n";
    echo $options['header_extra'];
    echo '</head>' . "\n";
    echo isset($options['body_extra']) ? '<body ' . $options['body_extra'] . '>' . "\n" : '<body>' . "\n";
    echo '<div id="hamsterpaj_website">' . "\n";
    echo '<!-- Nej, fråga oss inte varför vi har typ tio olika divar som verkar göra samma sak... -->' . "\n";
    echo '<!-- Ad management, adtoma -->' . "\n";
    echo '<script type="text/javascript">' . "\n";
    $adtoma_gender = in_array($_SESSION['userinfo']['gender'], array('P', 'F')) ? $_SESSION['userinfo']['gender'] : 'xx';
    $adtoma_age = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? date_get_age($_SESSION['userinfo']['birthday']) : 'xx';
    $adtoma_birthyear = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? substr($_SESSION['userinfo']['birthday'], 0, 4) : 'xx';
    echo "\t" . 'var CM8Server = "ad.adtoma.com";' . "\n";
    echo "\t" . 'var CM8Cat = "hp.' . ADTOMA_CATEGORY . '";' . "\n";
    echo "\t" . 'var CM8Profile = "hp_age=' . $adtoma_age . '&amp;hp_birthyear=' . $adtoma_birthyear . '&amp;hp_gender=' . $adtoma_gender . '"' . "\n";
    echo '</script>' . "\n";
    echo '<script language="JavaScript" type="text/javascript" src="http://ad.adtoma.com/adam/cm8adam_1_call.js"></script>' . "\n";
    echo "\n\n";
    echo '<div>' . "\n";
    echo '	<script type="text/javascript">CM8ShowAd("Bigbanner");</script>' . "\n";
    echo '</div>' . "\n";
    echo '<div style="width: 1200px;margin-top: 10px">' . "\n";
    if (!login_checklogin() && rand(0, 5) == 4 || login_checklogin() && rand(0, 30) == 7) {
        echo '<a href="/sex_och_sinne/"><img src="http://images.hamsterpaj.net/sex_and_sense/ui_to_new_sex_sense.png" alt="Till nya sex och sinne!" style="margin-left: 670px" /></a>';
    }
    echo '<img src="http://images.hamsterpaj.net/ui/site_top_rounded_corners.png" id="site_top_rounded_corners" />' . "\n";
    echo '<div id="site_container">' . "\n";
    echo '<div id="main">' . "\n";
    echo '<div id="top">' . "\n";
    if (true) {
        if ($_SESSION['login']['id'] == 148153 || isset($_GET['illerpaj'])) {
            echo '<a href="/"><img src="http://images.hamsterpaj.net/illerpaj2.png" id="logo" /></a>' . "\n";
        } elseif (NATTPAJ == true) {
            echo '<a href="/"><img src="http://images.hamsterpaj.net/nattpaj/nattpaj_logo.png" id="logo" /></a>' . "\n";
        } else {
            echo '<a href="/"><img src="http://images.hamsterpaj.net/ui/logo.png" id="logo" /></a>' . "\n";
        }
    } else {
        echo '<div id="logo">' . "\n";
        if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
            ?>
	<object type="application/x-shockwave-flash" data="http://images.hamsterpaj.net/ui/hamsterpaj_logo.swf" width="320" height="60">
		<param name="movie" value="http://images.hamsterpaj.net/ui/hamsterpaj_logo.swf" />
		<img src="http://images.hamsterpaj.net/logo.png" alt="Hamsterpaj logo" />
	</object>
<?php 
        }
        echo '</div>' . "\n";
    }
    echo '<div id="login_pane">' . "\n";
    if (login_checklogin()) {
        echo ui_login_status_bar('page_init');
    } else {
        ?>
			<form action="/login.php?action=login" method="post" id="login_form">
				<div class="username">
					<h5>Användarnamn</h5> 
					<input type="text" name="username"  />
				</div>
				<div class="password">
					<h5>Lösenord</h5>
					<input type="password" name="password" />
				</div>
			<ul class="login_buttons">
				<li>
						<div class="icon">
							<a onclick="javascript: document.getElementById('login_form').submit();">
								<img src="http://images.hamsterpaj.net/login_bar/login_color.png" alt="Logga in" />
							</a>
						</div>
					<a onclick="javascript: document.getElementById('login_form').submit();">
						Logga in
					</a>
				</li>
				
				<li>
						<div class="icon">
						<a href="/register.php">
							<img src="http://images.hamsterpaj.net/login_bar/register_color.png" alt="Bli medlem" />
						</a>
						</div>
						<a href="/register.php">
							Bli medlem
						</a>
				</li>
			</ul>
			<input type="submit" value="logga in" style="width: 0px; height: 0px; float: left; border: none;" />
			<!-- Submit med enterslag fungerar inte i IE om det inte finns en submit-knapp, dessutom får den inte ha display: none; för då funkar det inte i IE... Skitläsare! -->
			</form>
			<?php 
    }
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    ?>
		
		<div id="search_and_status">
				<div id="quicksearch">
					<form action="/quicksearch.php">
					<input type="text" id="quicksearch_input" class="quicksearch_input" value="Sök Hamsterpajare..." name="search" />
					<input type="hidden" name="type" value="user" />
		
		<?php 
    if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0')) {
        //			echo '<img src="' . IMAGE_URL . 'steve/icon_gun.gif" id="steve_gun"/>' . "\n";
    }
    echo '<input type="submit" value="" class="button_magnifier" />' . "\n";
    echo '</form>' . "\n";
    echo '</div>' . "\n";
    echo '<div class="status">' . "\n";
    if ($_SESSION['disablesteve'] != 1) {
        echo '<img src="http://images.hamsterpaj.net/steve/steve.gif" id="steve" />' . "\n";
    }
    if (login_checklogin()) {
        $status = strlen(trim($_SESSION['userinfo']['user_status'])) > 0 ? $_SESSION['userinfo']['user_status'] : 'Ingen status';
        echo '<input type="text" id="user_status_input" value="' . stripslashes($status) . '" />' . "\n";
        echo '<button class="button_50" id="user_status_save_button">Spara</button>' . "\n";
    }
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '<div id="main_left">' . "\n";
    global $menu;
    /* Merge the users additions to the menu array */
    if (isset($options['menu_addition'])) {
        $menu = array_merge_recursive($menu, $options['menu_addition']);
    }
    foreach ($menu as $handle => $current_menu) {
        if (isset($current_menu['is_privilegied'])) {
            $current_menu['is_privilegied'] = is_array($current_menu['is_privilegied']) ? $current_menu['is_privilegied'] : array($current_menu['is_privilegied']);
            $is_privilegied = false;
            foreach ($current_menu['is_privilegied'] as $privilegie) {
                if (is_privilegied($privilegie)) {
                    $is_privilegied = true;
                }
            }
        } else {
            $is_privilegied = true;
        }
        if ($is_privilegied == true) {
            $class = $handle == $options['menu_path'][0] ? 'menu_active' : 'menu';
            echo '<div class="' . $class . '" id="menu_div_' . $handle . '">' . "\n";
            $target = isset($current_menu['target']) ? ' target="' . $current_menu['target'] . '"' : '';
            echo '<h3><a href="' . $current_menu['url'] . '" class="menu_title" id="menu_title_' . $handle . '"' . $target . '>' . $current_menu['label'] . '</a></h3>' . "\n";
            echo '<div class="menu_content">' . "\n";
            echo '<ul>' . "\n";
            $label = isset($current_menu['index_label']) ? $current_menu['index_label'] : 'Start';
            $class = count($options['menu_path']) == 1 && $handle == $options['menu_path'][0] ? ' class="active"' : '';
            echo '<li' . $class . '><a href="' . $current_menu['url'] . '">' . $label . '</a></li>' . "\n";
            if (count($current_menu['children']) > 0) {
                $count_menu_items = ui_menu_recurse($current_menu['children'], $options, 1);
            }
            echo '</ul>' . "\n";
            echo '</div>' . "\n";
            echo '<img src="http://images.hamsterpaj.net/ui/menu/menu_box_open_bottom.png" class="menu_box_open_bottom" />' . "\n";
            echo '<img src="http://images.hamsterpaj.net/ui/menu/menu_box_closed_bottom.png" class="menu_box_closed_bottom" />' . "\n";
            echo '</div>' . "\n";
        }
    }
    $serialized = file_get_contents(PATHS_INCLUDE . 'cache/live_stats.phpserialized');
    $info = unserialize($serialized);
    echo '<img src="http://images.hamsterpaj.net/ui/menu/left_module_top_bottom.png" class="left_module_top" />' . "\n";
    echo '<div class="left_module">' . "\n";
    echo '<h4>Besökare</h4>' . "\n";
    echo cute_number($info['visitors']) . "\n";
    echo '<h4>Inloggade</h4>' . "\n";
    echo cute_number($info['logged_in']) . "\n";
    echo '<h4>Medlemmar</h4>' . "\n";
    echo cute_number($info['members']) . "\n";
    echo '<h4>Sidvisningar idag</h4>' . "\n";
    $pageviews = query_cache(array('query' => 'SELECT views FROM pageviews WHERE date = "' . date('Y-m-d') . '" LIMIT 1'));
    echo cute_number($pageviews[0]['views']);
    echo '</div>' . "\n";
    echo '<img src="http://images.hamsterpaj.net/ui/menu/left_module_top_bottom.png" class="left_module_bottom" />' . "\n";
    if (login_checklogin()) {
        echo '<img src="http://images.hamsterpaj.net/ui/menu/left_module_top_bottom.png" class="left_module_top" />' . "\n";
        echo '<div class="left_module">' . "\n";
        echo '<h4>Minneslapp</h4>' . "\n";
        echo '<textarea id="note">' . "\n";
        echo htmlentities(stripslashes($_SESSION['note']));
        echo '</textarea>' . "\n";
        echo '<input type="button" value="Spara" class="button_50" onclick="note_save()" />' . "\n";
        echo '</div>' . "\n";
        echo '<img src="http://images.hamsterpaj.net/ui/menu/left_module_top_bottom.png" class="left_module_bottom" />' . "\n";
    }
    echo '</div>' . "\n";
    echo '<div id="middle">' . "\n";
    if (isset($_SESSION['notice_message'])) {
        if (login_checklogin()) {
            $notices[] = array('html' => $_SESSION['notice_message']);
        }
        unset($_SESSION['notice_message']);
    }
    $data = cache_load('recent_update');
    if ($data['timestamp'] > time() - 1200 && $_SESSION['recent_update_notifier'][$data['id']] < 10) {
        global $RECENT_UPDATES;
        $content = '<span class="time">' . date('H:i', $data['timestamp']) . '</span>' . "\n";
        $content .= '<span class="event">' . $RECENT_UPDATES[$data['type']] . '</span>' . "\n";
        $content .= '<span class="link"><a href="/recent_updates_redirect.php?id=' . $data['id'] . '&url=' . urlencode($data['url']) . '&source=global_notice">' . $data['label'] . '</a></span>' . "\n";
        $notices[] = array('html' => $content);
        $_SESSION['recent_update_notifier'][$data['id']]++;
    }
    foreach ($notices as $notice) {
        echo '<div class="notice">' . "\n";
        if (isset($notice['timestamp'])) {
            echo '<span class="time">' . date('H:i', $notice['timestamp']) . '</span>' . "\n";
        }
        echo $notice['html'];
        echo '</div>' . "\n";
    }
    echo '<div id="content">' . "\n";
    echo '<script type="text/javascript">CM8ShowAd("Rektangel");</script>' . "\n";
    if (isset($_SESSION['posted_gb_to_webmaster'])) {
        rounded_corners_top(array('color' => 'red'));
        echo 'Men tjockis, det behövs inte mycket IQ för att förstå att användaren Webmaster inte är en riktig människa, utan en BOT som används för att maskineriet bakom Hamsterpaj ska fungera.<br /><br />Om ditt inlägg var speciellt (alltså inte som allt annat som hamnar i Webmasters inkorg, nämligen spam eller hatbrev) är du välkommen vända dig till någon ordningsvakt (se lista bland högermodulerna här till höger&raquo;).';
        rounded_corners_bottom(array('color' => 'red'));
    }
    if (login_checklogin()) {
        if (isset($_SESSION['unread_gb_entries'])) {
            echo guestbook_list($_SESSION['unread_gb_entries']);
            unset($_SESSION['unread_gb_entries']);
        }
    }
}