<?php /* It is very important that output is properly escaped. If not, we may end upp with a XSS-attack. If you don't know what you're doing, HANDS OFF!!! */ require '../include/core/common.php'; if (isset($_GET['fetch']) && !empty($_GET['fetch'])) { $objects_to_fetch = explode(',', $_GET['fetch']); $fetched_ui_notices = false; foreach ($objects_to_fetch as $object_to_fetch) { if (in_array($object_to_fetch, array('ui_noticebar_guestbook', 'ui_noticebar_discussion_forum', 'ui_noticebar_groups')) && !$fetched_ui_notices) { $notices = ui_notices_fetch(); $fetched_ui_notices = true; } switch ($object_to_fetch) { case 'ui_noticebar_guestbook': $data = $notices['guestbook']; break; case 'ui_noticebar_discussion_forum': foreach ($notices['discussion_forum']['subscriptions'] as $subscription) { $url = isset($subscription['url']) ? $subscription['url'] : $subscription['handle'] . '/sida_1.php'; $subscriptions[] = '{"title": "' . addslashes($subscription['title']) . '", "url": "' . addslashes($url) . '", "unread_posts": ' . $subscription['unread_posts'] . '}'; } $data = '{"new_notices": ' . $notices['discussion_forum']['new_notices'] . ', "subscriptions": [' . implode(', ', $subscriptions) . ']}'; break; case 'ui_noticebar_groups': $groups = array();
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ä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ä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; } }
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 . '&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"; $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ä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ä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; } }