Example #1
0
function render_entries($entries, $options)
{
    $content .= '<ul class="group_entries">' . "\n";
    foreach ($entries as $entry) {
        $options['user_id'] = $entry['user_id'];
        $content .= message_top($options);
        $content .= '<div style="border-bottom: 1px solid #ababab;">' . "\n";
        $content .= '<span class="timestamp">' . fix_time($entry['timestamp']) . '</span>' . "\n";
        $content .= '<h2 style="display: inline;">' . $entry['header'] . '</h2> - <a href="/traffa/profile.php?id=' . $entry['user_id'] . '">' . $entry['username'] . '</a> ' . "\n";
        $content .= $entry['gender'];
        $content .= date_get_age($entry['birthday']);
        $content .= '<p>' . "\n";
        $content .= nl2br(html_entity_decode($entry['content'])) . "\n";
        $content .= '</p>' . "\n";
        $content .= '</div>' . "\n";
        // ----START----
        $content .= $_GET['action'] != 'show' ? '<a href="/hamsterpaj/hamsterblogg.php?action=show&id=' . $entry['id'] . '">Kommentera &raquo;</a>' : '<a href="/hamsterpaj/hamsterblogg.php">&laquo; Tillbaka</a>';
        // ----END------
        $content .= message_bottom();
        if ($options['enable_comments'] == true) {
            $content .= rounded_corners_top();
            $content .= '<label>Kommentera:</label>' . "\n";
            $content .= comments_input_draw($entry['id'], 'hamsterblog');
            $content .= rounded_corners_bottom();
            $content .= '<div style="clear: both;"></div>' . "\n";
            $content .= comments_list($entry['id'], 'hamsterblog');
        }
    }
    $content .= '</ul>' . "\n";
    return $content;
}
Example #2
0
function irl_attending($options)
{
    $query = 'SELECT DISTINCT l.id, l.username, i.*, u.birthday, z.spot, u.gender ';
    $query .= 'FROM login AS l, userinfo AS u, irl_attendings AS i, zip_codes AS z ';
    $query .= 'WHERE i.user_id = l.id AND z.zip_code = u.zip_code AND i.user_id = u.userid AND i.irl_id = "' . $_GET['irl'] . '" AND i.attending = "' . $options['attending'] . '" ';
    $query .= 'ORDER BY i.irl_title DESC LIMIT 200';
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    $output .= $options['attending'] == 'yes' ? '<h2 style="margin-top: 0;">De som kommer(' . mysql_num_rows($result) . ')</h2>' : '<h2 style="margin-top: 0;">De som kanske kommer(' . mysql_num_rows($result) . ')</h2>' . "\n";
    $output .= '<table style="width: 638px;">' . "\n";
    $output .= '<tr>' . "\n";
    $output .= '<th>Användare</th>' . "\n";
    $output .= '<th></th>' . "\n";
    $output .= '<th>Titel</th>' . "\n";
    $output .= '<th>Har sängplatser för</th>' . "\n";
    $output .= '<th>Behöver sängplats</th>' . "\n";
    $output .= '<th>Bor</th>' . "\n";
    $output .= '</tr>' . "\n";
    while ($data = mysql_fetch_assoc($result)) {
        $output .= '<tr>' . "\n";
        $output .= '<td><a href="http://www.hamsterpaj.net/traffa/profile.php?user_id=' . $data['user_id'] . '">' . $data['username'] . '</a></td>' . "\n";
        $output .= '<td>' . "\n";
        $genders = array('m' => 'kille', 'f' => 'tjej');
        $output .= $data['gender'];
        $output .= $data['birthday'] != '0000-00-00' ? '<span class="age">' . date_get_age($data['birthday']) . '</span> ' : '';
        $output .= '</td>' . "\n";
        $output .= '<td>' . $data['irl_title'] . '</td>' . "\n";
        $output .= '<td>' . $data['has_beds'] . '</td>' . "\n";
        $output .= '<td>' . ($data['needs_beds'] == '1' ? 'Ja' : 'Nej') . '</td>' . "\n";
        $output .= '<td>' . $data['spot'] . '</td>' . "\n";
        $output .= '</tr>' . "\n";
    }
    $output .= '</table>' . "\n";
    return $output;
}
Example #3
0
function viewPosts($mode = 'normal', $criteria = NULL)
{
    //Visar alla inlägg
    $query = makeQuery($mode, $criteria);
    $result = mysql_query($query) or die('Ett fel har upstått:<br/>' . mysql_error());
    $genderlabels['P'] = 'Pojke';
    $genderlabels['F'] = 'Flicka';
    while ($data = mysql_fetch_assoc($result)) {
        $userage = date_get_age($data['birthday']);
        if ($data['gender'] == 'P') {
            $divbg = 'blue_faded_div';
        } elseif ($data['gender'] == 'F') {
            $divbg = 'pink_faded_div';
        } else {
            $divbg = 'grey_faded_div';
        }
        if (isset($_SESSION['login']['username'])) {
            if (preg_match("/" . $_SESSION['login']['username'] . "/i", $data['text'])) {
                $divbg = 'orange_faded_div';
            } elseif ($_SESSION['login']['username'] == $data['username']) {
                $divbg = 'green_faded_div';
            }
        }
        echo '<div class="' . $divbg . '" style="repeat-x; margin-top: 10px; border: 1px solid #CCCCCC;">' . "\n";
        echo '<table class="body" style="width: 100%;"><tr><td style="vertical-align: top; width: 75px;">' . "\n";
        if ($data['image'] == 1 || $data['image'] == 2) {
            echo insert_avatar($data['userid']);
        } else {
            echo '<img src="/images/noimage.png" style="width: 75px; height: 75px; border: 1px solid #cccccc;" alt="Ingen visningsbild"/>' . "\n";
        }
        echo '</td><td style="vertical-align: top;">';
        echo fix_time($data['timestamp']) . ' (inlägg #' . $data['id'] . ') <a style="text-decoration:none;" href="javascript:#;" onclick="javascript:document.gbform.message.value=document.gbform.message.value+\'' . $data['username'] . ' : \';document.gbform.message.focus();">[^]</a><br/>' . "\n";
        echo '<a href="' . $hp_url . '/traffa/profile.php?id=' . $data['userid'] . '">' . "\n";
        echo '<b>' . $data['username'] . '</b></a> ' . "\n";
        echo birthdaycake($data['birthday']) . ' ' . "\n";
        echo $genderlabels[$data['gender']];
        if ($userage > 1) {
            echo ' ' . $userage . 'år' . "\n";
        }
        if (strlen($data['geo_location']) > 1) {
            echo ' från ' . htmlentities($data['geo_location']) . "\n";
        }
        echo '<br/>' . "\n";
        echo setsmilies($data['text']) . "\n";
        echo '</td></tr></table>' . "\n";
        echo '</div>' . "\n";
    }
    //while-satsen för att skriva ut inlägg
}
Example #4
0
function live_chat_event($options)
{
    $event['id'] = live_chat_event_id(array('type' => $options['type'], 'reference_id' => $options['reference_id']));
    $event['timestamp'] = date('H:i');
    $event['event_type'] = $options['event_type'];
    $event['message'] = str_replace(array("\r", "\n"), null, nl2br($options['message']));
    $event['username'] = isset($options['username']) ? $options['username'] : $_SESSION['login']['username'];
    $event['user_id'] = $_SESSION['login']['id'];
    $event['age'] = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? date_get_age($_SESSION['userinfo']['birthday']) : 0;
    if ($options['username'] == $_SESSION['login']['username'] && $_SESSION['userinfo']['image'] == 2) {
        $event['user_photo'] = $_SESSION['login']['id'];
    }
    if ($_SESSION['login']['username'] == 'Snaxman' && rand(1, 5) == 3) {
        $event['message'] .= ' Förresten, Justin Timberlake är inte så bra...';
    }
    $line = "\n" . serialize($event);
    file_put_contents(LIVE_CHAT_STORAGE_PATH . $options['type'] . '/' . $options['reference_id'], $line, FILE_APPEND);
}
Example #5
0
function render_friends_list($friends, $params = array())
{
    $return .= '<ul class="friends_list">' . "\n";
    foreach ($friends as $friend) {
        $return .= '<li>' . "\n";
        if ($friend['image'] == 1 || $friend['image'] == 2) {
            $return .= ui_avatar($friend['user_id']) . "\n";
        }
        $return .= '<a href="/traffa/profile.php?id=' . $friend['user_id'] . '">' . $friend['username'] . '</a>' . "\n";
        $genders = array('f' => 'F', 'm' => 'P');
        $return .= isset($genders[$friend['gender']]) ? $genders[$friend['gender']] : '';
        $return .= $friend['birthday'] != '0000-00-00' ? date_get_age($friend['birthday']) : '';
        $return .= $friend['lastaction'] > time() - 600 ? '<span class="online">online</span>' : '';
        if ($params['user_id'] == $_SESSION['login']['id'] && ($params['friend_type'] == 'idol' || $params['friend_type'] == 'friend')) {
            $return .= '<a class="relation_end_control" href="/traffa/friends.php?user_id=' . $friend['user_id'] . '&action=removefriend">[Avsluta relationen]</a>' . "\n";
        }
        $return .= '</li>' . "\n";
    }
    $return .= '</ul>' . "\n";
    return $return;
}
Example #6
0
function guestbook_list($entries)
{
    $out .= '<ul class="guestbook_entries">' . "\n";
    foreach ($entries as $entry) {
        $out .= "\n\n";
        $out .= '<!-- Post #' . cute_number($entry['id']) . ' by ' . $entry['username'] . ' at ' . date('Y-m-d H:i:s', $entry['timestamp']) . '-->' . "\n";
        /*
        $class = ($entry['read'] == 0) ? ' class="unread"': '';
        $out .= '<li' . $class . '>' . "\n";
        if($entry['image'] == 1 || $entry['image'] == 2)
        {
        	$out .= '<img src="http://images.hamsterpaj.net/images/users/thumb/' . $entry['sender'] . '.jpg" class="user_avatar" id="entry_' . $entry['id'] . '_photo" />' . "\n";
        }
        else
        {
        	$out .= '<img src="http://images.hamsterpaj.net/images/users/no_image_mini.png" class="user_avatar" id="entry_' . $entry['id'] . '_photo" />' . "\n";
        }
        
        $out .= '<div class="container">' . "\n";
        $out .= '<div class="top_bg">' . "\n";
        $out .= '<div class="bottom_bg">' . "\n";
        */
        $options['user_id'] = $entry['sender'];
        $options['type'] = $entry['read'] == 0 ? 'unread' : 'standard';
        $out .= message_top($options);
        $out .= '<div id="guestbook_entry_' . $entry['id'] . '">' . "\n";
        $out .= '<span class="timestamp">' . fix_time($entry['timestamp']) . '</span>' . "\n";
        $out .= '<a href="/traffa/profile.php?id=' . $entry['sender'] . '">' . $entry['username'] . '</a> ' . "\n";
        $genders = array('f' => 'F', 'm' => 'P');
        $out .= $genders[$entry['gender']];
        $out .= date_get_age($entry['birthday']) > 0 ? date_get_age($entry['birthday']) : '';
        $out .= '<span class="unanswered" id="unanswered_label_' . $entry['id'] . '"' . $style . '>' . "\n";
        $out .= $entry['answered'] != 'Y' ? '(Obesvarat)' : '';
        $out .= '</span>' . "\n";
        $style = $entry['is_private'] == 0 ? ' style="display: none;"' : '';
        $out .= '<span class="private" id="private_label_' . $entry['id'] . '"' . $style . '>(Privat)</span>' . "\n";
        $out .= '<p>' . setSmilies(nl2br($entry['message'])) . '</p>' . "\n";
        $out .= '<p class="gb_entry_controls">' . "\n";
        $out .= login_checklogin() && $entry['recipient'] == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_reply_control" id="reply_control_' . $entry['id'] . '">Svara</a>' . "\n" : '';
        $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '&history=' . $entry['recipient'] . '">Historik</a>' . "\n";
        $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '">Gå till</a>' . "\n";
        $out .= $entry['recipient'] == $_SESSION['login']['id'] ? '<a href="/installningar/userblock.php?action=block&username='******'username'] . '" class="gb_block_control">Blockera</a>' . "\n" : '';
        if (login_checklogin() && $entry['recipient'] == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id']) {
            $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_delete_control" id="delete_control_' . $entry['id'] . '">Ta bort</a>' . "\n";
        }
        if (login_checklogin() && $entry['recipient'] == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id']) {
            $private_style = $entry['is_private'] == 1 ? ' style="display: none;"' : '';
            $unprivate_style = $entry['is_private'] == 0 ? ' style="display: none;"' : '';
            $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_private_control" id="private_control_' . $entry['id'] . '"' . $private_style . '>';
            $out .= 'Gör privat</a>' . "\n";
            $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_unprivate_control" id="unprivate_control_' . $entry['id'] . '"' . $unprivate_style . '>';
            $out .= 'Gör offentligt</a>' . "\n";
            $out .= '<a href="/hamsterpaj/abuse.php?report_type=guestbook_entry&reference_id=' . $entry['id'] . '" class="abuse_button"><img src="http://images.hamsterpaj.net/abuse.png" /></a>' . "\n";
        }
        $out .= '</p>' . "\n";
        $out .= guestbook_form(array('recipient' => $entry['sender'], 'reply-to' => $entry['id'], 'form_id' => 'gb_reply_form_' . $entry['id']));
        $out .= '</div>' . "\n";
        $out .= message_bottom();
        /*
        $out .= '</div>' . "\n";
        $out .= '</div>' . "\n";
        $out .= '</div>' . "\n";
        
        $out .= '</li>' . "\n";
        */
    }
    $out .= '</ul>' . "\n";
    return $out;
}
Example #7
0
                $genders = array('f' => 'F', 'm' => 'P');
                $out .= $genders[$event['gender']];
                $out .= date_get_age($event['birthday']) > 0 ? date_get_age($event['birthday']) : '';
                $out .= '<p>Tjoho, läs min senaste bloggning: <a href="' . $event['url'] . '">' . $event['label'] . '</a><br />Och glöm för sablen inte att kommentera!</p>' . "\n";
                $out .= message_bottom();
                break;
            case 'photos':
                $photos = photos_fetch(array('id' => substr($event['url'], 22), 'limit' => 1));
                if (!isset($photos)) {
                } else {
                    $options['user_id'] = $event['friend_id'];
                    $out .= message_top($options);
                    $out .= '<span class="timestamp">' . fix_time($event['timestamp']) . '</span>' . "\n";
                    $out .= '<a href="/traffa/profile.php?id=' . $event['friend_id'] . '">' . $event['username'] . '</a> ' . "\n";
                    $genders = array('f' => 'F', 'm' => 'P');
                    $out .= $genders[$event['gender']];
                    $out .= date_get_age($event['birthday']) > 0 ? date_get_age($event['birthday']) : '';
                    $out .= photos_list_mini($photos);
                    $out .= '<p>Jag är en cool kis, så jag ladda precis upp ett foto. Titta på det och kommentera vetja :) <a href="' . $event['url'] . '">' . $event['label'] . '</a></p>' . "\n";
                    $out .= message_bottom();
                }
                break;
        }
    }
    $out .= '</ul>' . "\n";
}
ui_top($ui_options);
echo $out;
ui_bottom();
?>
 
Example #8
0
/**
*	The default behavior is to list the four latest comments. The selection and number of 
*	comments can be changed thru settings in $options
	item_id
	item_type
	options			array_support	description
	user_id				yes				include these users comments first in the array
	limit_offset		no
	limit				no
*/
function comments_list($item_id, $item_type, $options)
{
    log_to_file('comments', LOGLEVEL_DEBUG, __FILE__, __LINE__, 'comments_list', $item_type . ' ' . $item_id);
    $query = 'SELECT c.id, c.user_id, c.timestamp, c.comment, c.answer, l.username, lo.username AS answerer_username, u.image, u.gender, u.birthday, ur.rank, u.image FROM login l, userinfo u, user_comments c';
    $query .= ' LEFT OUTER JOIN user_ranks ur';
    $query .= ' ON ur.user_id = c.user_id';
    $query .= ' AND ur.item_id="' . $item_id . '" AND ur.item_type="' . $item_type . '"';
    $query .= ' LEFT OUTER JOIN login lo';
    $query .= ' ON lo.id = c.answerer_id';
    $query .= ' WHERE c.user_id = l.id AND u.userid = l.id AND c.item_type="' . $item_type . '" AND c.item_id="' . $item_id . '" AND c.item_type="' . $item_type . '" AND removed="0"';
    $query .= ' ORDER BY c.timestamp DESC';
    if (isset($options['limit']) && $options['limit'] != 'no_limit') {
        $query .= ' LIMIT ' . $options['limit'];
        if (isset($options['limit_offset'])) {
            $query .= ', ' . $options['limit_offset'];
        }
    } elseif ($options['limit'] != 'no_limit') {
        $query .= ' LIMIT 6';
    }
    $options['style'] = isset($options['style']) ? $options['style'] : 'normal';
    $result = mysql_query($query) or die(report_sql_error($query));
    if ($options['list_style'] == 'compact') {
        $output = '<div style="width: 575px; height: 590px; scroll: auto; overflow: auto;" id="comments_list" class="comments_list_compact">' . "\n";
        $output .= '<dl>' . "\n";
        while ($data = mysql_fetch_assoc($result)) {
            $output .= '<dt>' . $data['username'] . '</dt>' . "\n";
            $output .= '<dd style="margin-left: 70px;">' . $data['comment'] . '</dd>' . "\n";
        }
        $output .= '</dl>' . "\n";
    } else {
        $output = '<div id="comments_list" class="comments_list">' . "\n";
        while ($data = mysql_fetch_assoc($result)) {
            $output .= '<div class="comment_' . $options['style'] . '" id="comment_' . $data['id'] . '">' . "\n";
            if ($options['style'] == 'normal') {
                $output .= ui_avatar($data['user_id']) . "\n";
            }
            $output .= '<div class="comment_main_';
            if (($data['image'] == 1 || $data['image'] == 2) && $options['style'] == 'normal') {
                $output .= 'normal';
            } else {
                $output .= $options['style'];
            }
            $output .= '">' . "\n";
            if (isset($data['rank'])) {
                $output .= rank_draw($data['rank']);
            }
            $output .= '<div class="comment_author_name"><a href="/traffa/profile.php?id=' . $data['user_id'] . '">' . $data['username'] . '</a> ';
            $genders = array('m' => 'P', 'f' => 'F');
            $output .= $genders[$data['gender']];
            $output .= date_get_age($data['birthday']) > 0 ? date_get_age($data['birthday']) : '';
            $output .= '</div>' . "\n";
            $output .= '<span class="comment_time">(' . fix_time($data['timestamp']) . ')';
            if (login_checklogin() && ($_SESSION['login']['id'] == $data['user_id'] || is_privilegied('comments_admin') || is_privilegied('comments_admin', 'entertain') && $item_type == 'entertain' || $_SESSION['login']['id'] == $options['photo_owner'])) {
                $output .= ' <strong><a href="#img_full" onclick="comment_remove(' . $data['id'] . ')">[X]</a></strong>' . "\n";
            }
            $output .= '</span><p class="comment_text">' . $data['comment'] . '</p>' . "\n";
            // Shows a answer
            if (strlen($data['answer']) > 1) {
                $output .= '<span class="comment_answerer">' . $data['answerer_username'] . '\'s svar:</span> <p class="comment_answer">' . $data['answer'] . '</p>' . "\n";
            } elseif ($_SESSION['login']['id'] == $options['photo_owner'] && login_checklogin()) {
                $output .= '<button type="submit" onclick="comment_answer(' . $data['id'] . ', ' . $item_id . ')" class="button_60">Svara</button>' . "\n";
            }
            $output .= '</div>' . "\n";
            $output .= '</div>' . "\n";
        }
        $output .= '<br style="clear: both" />' . "\n";
        if (mysql_num_rows($result) == 6) {
            $output .= '<button class="button_150" id="comments_view_all_button">Visa alla kommentarer</button>' . "\n";
        }
    }
    $output .= '</div>' . "\n";
    // comments_list
    return $output;
}
			<div style="float: left; width: 23%;">Från</div>
			<div style="float: left; width: 33%; text-align: right;">Besökstid</div>
			<br style="clear: both;"/>
		</div>';
$x = 0;
while ($data = mysql_fetch_assoc($result)) {
    /* Only display each user one time, should be done with DISTINCT in query, but I can't ger it to work */
    if (in_array($data['user_id'], $duplicates)) {
        continue;
    }
    $duplicates[] = $data['user_id'];
    $x++;
    echo '
		<div style="padding: 3px; ' . ($x % 2 ? 'background: #fffaef;' : '') . '">
			<div style="float: left; width: 3%;"><img src="' . IMAGE_URL . '/famfamfam_icons/' . ($data['gender'] == 'f' ? 'user_female.png' : ($data['gender'] == 'm' ? 'user.png' : 'user_gray.png')) . '"/></div>
			<div style="float: left; width: 40%;">
				<div style="float: left; width: 90%;">
					<a href="/traffa/profile.php?id=' . $data['user_id'] . '">' . $data['username'] . '</a>' . ($data['birthday'] != '0000-00-00' ? ', ' . date_get_age($data['birthday']) . ' år' : '') . ($data['lastaction'] > time() - 600 ? '<span style="color: green;"> (Online)</span>' : '') . '
				</div>
				<div style="float: left; width: 10%; text-align: center;">
					' . (in_array($data['image'], array(1, 2)) ? '<a href="javascript:;" style="text-decoration: none;" onclick="window.open(\'http://www.hamsterpaj.net/avatar.php?id=' . $data['user_id'] . '\',\'' . time() . '\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=320, height=427\')"><img src="' . IMAGE_URL . '/famfamfam_icons/pictures.png"></a>' : '') . '
				</div>
				<br style="clear: both;"/>
			</div>
			<div style="float: left; width: 23%;">' . (strlen($data['spot']) > 0 ? $data['spot'] : 'Okänd ort') . '</div>
			<div style="float: left; width: 33%; text-align: right;">' . fix_time($data['timestamp']) . '</div>
			<br style="clear: both;"/>
		</div>
		';
}
ui_bottom();
Example #10
0
function digga_view($artist_id)
{
    $artist_info = digga_fetch_info($artist_id);
    echo '<h1>Digga ger dig info om ' . $artist_info['name'] . '</h1>' . "\n";
    echo '<h3>' . cute_number($artist_info['popularity']) . ' Hamsterpajare diggar ' . $artist_info['name'] . '!</h3>' . "\n";
    if (strlen($artist_info['description']) > 0) {
        echo '<p class="digga_description">' . "\n";
        echo nl2br($artist_info['description']);
        echo '</p>' . "\n";
    } else {
        echo '<p class="digga_no_description">' . "\n";
        echo 'Vi har tyvärr ingen beskrivning om ' . $artist_info['name'] . ' än. Om du känner att du kan mycket om det ';
        echo 'här bandet eller den här artisten så får du hemskt gärna skriva en egen beskrivning och skicka den som ett ';
        echo 'privat meddelande till <a href="/traffa/profile.php?id=774586">Joar</a>. Glöm inte att tala om vilken artist ';
        echo 'det gäller!' . "\n";
        echo '</p>' . "\n";
    }
    if (is_privilegied('digga_admin')) {
        echo 'Du kan <a href="?action=edit&artist_id=' . $artist_id . '">';
        echo 'ändra beskrivningen och namnet</a>';
    }
    $diggers = digga_fetch_diggers($artist_id);
    if (count($diggers) > 0) {
        echo '<div id="digga_diggers">' . "\n";
        echo '<h2>Hamsterpajare som diggar ' . $artist_info['name'] . '</h2>' . "\n";
        echo '<table>' . "\n";
        foreach ($diggers as $digger) {
            echo '<tr>' . "\n";
            echo '<td><a href="/traffa/profile.php?id=' . $digger['id'] . '">' . $digger['username'] . '</a></td>' . "\n";
            echo '<td>' . $digger['gender'] . date_get_age($digger['birthday']) . '</td>' . "\n";
            echo '<td>';
            echo $digger['lastaction'] > time() - 900 ? 'online' : 'offline';
            echo '</td>' . "\n";
            echo '</tr>' . "\n";
        }
        echo '</table>' . "\n";
        echo '</div>' . "\n";
    }
    echo '<div id="digga_songs">' . "\n";
    echo '<h2>Låtar av ' . $artist_info['name'] . '</h2>' . "\n";
    $query = 'SELECT title FROM songs WHERE artist = "' . $artist_id . '" ORDER BY popularity DESC';
    $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    echo '<ul style="list-style-type: none;">' . "\n";
    while ($data = mysql_fetch_assoc($result)) {
        echo '<li>' . $data['title'] . '</li>' . "\n";
    }
    echo '</ul>' . "\n";
    echo '</div>' . "\n";
}
Example #11
0
function profile_head($params)
{
    $include_profile_theme_style = isset($params['include_profile_theme_style']) ? $params['include_profile_theme_style'] == true : true;
    $id = isset($params['id']) ? ' id="' . $params['id'] . '"' : '';
    $out .= '<div class="profile_head"' . $id . '>' . "\n";
    $img = $params['image'] == 1 || $params['image'] == 2 ? IMAGE_URL . 'images/users/thumb/' . $params['user_id'] : IMAGE_URL . 'user_no_image.png';
    $class = $params['image'] == 1 || $params['image'] == 2 ? 'user_avatar' : 'no_avatar';
    $out .= '<div class="avatar_passepartout">' . "\n";
    $out .= ui_avatar($params['user_id']);
    //$out .= '<img src="' . $img . '" class="' . $class . '" />' . "\n";
    $out .= '</div>' . "\n";
    $out .= '<div class="name_asl">' . "\n";
    $out .= '<span class="username">' . $params['username'] . '</span> ';
    $genders = array('m' => 'kille', 'f' => 'tjej');
    $out .= isset($genders[$params['gender']]) ? '<span class="gender">' . $genders[$params['gender']] . '</span> ' : '';
    $out .= $params['birthday'] != '0000-00-00' ? '<span class="age">' . date_get_age($params['birthday']) . '</span> ' : '';
    $out .= strlen($params['spot']) > 0 ? '<span class="spot">' . $params['spot'] . '</span> ' : '';
    if ($params['lastaction'] > time() - 600) {
        $out .= '<span class="online">online</span>' . "\n";
    } else {
        $out .= '<span class="last_seen">senast ' . fix_time($params['lastlogon']) . '</span>' . "\n";
    }
    $out .= '</div>' . "\n";
    $out .= '<p class="user_status">' . $params['user_status'] . '</p>' . "\n";
    $query = 'SELECT * FROM user_action_log WHERE user = "******" ORDER BY id DESC LIMIT 3';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    while ($event = mysql_fetch_assoc($result)) {
        $events[] = $event;
    }
    array_reverse($events);
    if (count($events) > 0) {
        $out .= '<ul class="user_action_log">' . "\n";
        foreach ($events as $event) {
            switch ($event['action']) {
                case 'friendship':
                    $out .= '<li><span class="time">' . fix_time($event['timestamp']) . '</span> blev kompis med <a href="' . $event['url'] . '">' . $event['label'] . '</a></li>' . "\n";
                    break;
                case 'diary':
                    $out .= '<li><span class="time">' . fix_time($event['timestamp']) . '</span> skrev i dagboken <a href="' . $event['url'] . '">' . $event['label'] . '</a></li>' . "\n";
                    break;
                case 'photos':
                    $out .= '<li><span class="time">' . fix_time($event['timestamp']) . '</span> ny bild <a href="' . $event['url'] . '">' . substr($event['label'], 0, 45) . '</a></li>' . "\n";
                    break;
            }
        }
        $out .= '</ul>' . "\n";
    }
    $profile_modules['presentation']['label'] = 'Presentation';
    $profile_modules['presentation']['url'] = '/traffa/profile.php?user_id=%USERID%';
    $profile_modules['guestbook']['label'] = 'Gästbok';
    $profile_modules['guestbook']['url'] = '/traffa/guestbook.php?view=%USERID%';
    $profile_modules['old_profile']['label'] = 'Gammal presentation';
    $profile_modules['old_profile']['url'] = '/traffa/old_profile.php?id=%USERID%';
    $profile_modules['photos']['label'] = 'Fotoalbum';
    $profile_modules['photos']['url'] = '/traffa/photos.php?user_id=%USERID%';
    $profile_modules['diary']['label'] = 'Dagbok';
    $profile_modules['diary']['url'] = '/traffa/diary.php?user_id=%USERID%';
    $profile_modules['friends']['label'] = 'Vänner';
    $profile_modules['friends']['url'] = '/traffa/friends.php?user_id=%USERID%';
    $profile_modules['facts']['label'] = 'Fakta';
    $profile_modules['facts']['url'] = '/traffa/user_facts.php?user_id=%USERID%';
    $profile_modules['my_visitors']['label'] = 'Besökare';
    $profile_modules['my_visitors']['url'] = '/traffa/my_visitors.php?user_id=%USERID%';
    $out .= '<div class="navigation">' . "\n";
    $out .= '<ul>' . "\n";
    foreach ($profile_modules as $handle => $module) {
        $class = $handle == $params['active_tab'] ? ' class="active"' : '';
        if (isset($module['url'])) {
            $out .= '<li' . $class . '><a href="' . str_replace('%USERID%', $params['user_id'], $module['url']) . '">' . $module['label'] . '</a></li>' . "\n";
        } else {
            $out .= '<li' . $class . '>' . $module['label'] . '</li>' . "\n";
        }
    }
    $out .= '</ul>' . "\n";
    $out .= '</div>' . "\n";
    $out .= '</div>' . "\n";
    return $out;
}
Example #12
0
if (!isset($_GET['user_id']) || !is_numeric($_GET['user_id'])) {
    $user_id = 65654;
} else {
    $user_id = $_GET['user_id'];
}
// user
$query = 'SELECT l.username, l.lastaction, l.lastlogon, u.gender, u.birthday, u.image, u.user_status, u.profile_theme, u.gb_entries, z.spot, u.presentation_text, p.gb_anti_p12';
$query .= ' FROM login AS l, userinfo AS u, zip_codes AS z, preferences AS p';
$query .= ' WHERE l.id = ' . $user_id . ' AND u.userid = l.id AND z.zip_code = u.zip_code AND p.userid = l.id';
$query .= ' AND l.is_removed = 0';
$query .= ' LIMIT 1';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
$user = mysql_fetch_assoc($result);
$gender = array('m' => 'P', 'f' => 'F');
$gender = isset($gender[$user['gender']]) ? $gender[$user['gender']] : '';
$birthday = $user['birthday'] != '0000-00-00' ? date_get_age($user['birthday']) : '';
$location = empty($user['spot']) ? '' : ' från ' . $user['spot'];
$online = $user['lastaction'] > time() - 600 ? 'true' : 'false';
// user flags
$query = 'SELECT ufl.* FROM user_flags AS uf, user_flags_list AS ufl';
$query .= ' WHERE user = '******' AND ufl.id = uf.flag';
$query .= ' LIMIT 5';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
$flags = array();
while ($data = mysql_fetch_assoc($result)) {
    $flags[] = $data;
}
?>
{
	username: '******'username'];
Example #13
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;
    }
}
Example #14
0
function posts_list_old($posts, $discussions = null, $options)
{
    $options['enable_quality_rank'] = $options['enable_quality_rank'] === false ? false : true;
    $options['quality_level'] = isset($options['quality_level']) ? $options['quality_level'] : 0;
    $options['mode'] = isset($options['mode']) ? $options['mode'] : 'forum';
    echo '<input type="hidden" id="debug_input" />';
    foreach ($posts as $i => $post) {
        /* Shall we display any discussion splits before the post? */
        $display_discussions = array();
        foreach ($discussions as $key => $discussion) {
            if ($discussion['timestamp'] <= $post['timestamp']) {
                $display_discussions[] = $discussion;
                unset($discussions[$key]);
            }
        }
        if (count($display_discussions) > 0) {
            discussions_list_splits($display_discussions);
        }
        /* Shall we hide this post, due to low quality? */
        $low_quality = $post['quality_level'] >= 0 && ($i > 0 && $options['enable_quality_rank'] && $post['quality_rank'] < $options['quality_level'] - 0.4 ? true : false);
        $low_quality = false;
        if (in_array('private_gb', $post['flags'])) {
            echo '<h5 class="private_header">Privat inlägg</h5>' . "\n";
            if ($_SESSION['login']['id'] != $post['author'] && $_SESSION['login']['id'] != $options['gb_recipient']) {
                continue;
            }
        }
        echo '<!-- Post #' . $post['post_id'] . ' by ' . $post['username'] . ' at ' . date('Y-m-d H:i:s', $post['timestamp']) . '-->' . "\n";
        echo '<a name="post_' . $post['post_id'] . '_anchor"></a>' . "\n";
        if (in_array('removed', $post['flags'])) {
            echo '<div class="removed_post">' . "\n";
            echo '<h2>Borttaget inlägg, skrevs ' . fix_time($post['timestamp']) . ' av <a href="/traffa/profile.php?id=' . $post['author'] . '">' . $post['username'] . '</a></h2>' . "\n";
            echo '</div>' . "\n";
            $displayed_posts[] = $post['post_id'];
            continue;
        }
        if ($low_quality) {
            echo '<div class="low_quality">';
        }
        echo '<div class="post" id="post_' . $post['post_id'] . '"';
        if (login_checklogin() && strpos($post['content'], $_SESSION['login']['username'])) {
            echo ' style="background: #f9cc88;"';
        }
        echo '>' . "\n";
        echo '<div class="author">' . "\n";
        if ($low_quality) {
            echo 'Detta inlägg har lägre kvalitét än vad skaparen av diskussionen vill ha.';
        } elseif ($post['image'] == 1 || $post['image'] == 2) {
            echo user_avatar($post['author']) . "\n";
        }
        echo '</div>' . "\n";
        echo '<div class="date_time">Skrevs ' . fix_time($post['timestamp']) . '</div>' . "\n";
        echo '<div class="author_text"><a href="/traffa/profile.php?id=' . $post['author'] . '">' . $post['username'] . '</a>';
        echo ($post['gender'] == 'm' ? ', pojke' : ($post['gender'] == 'f' ? ', flicka' : '')) . ' ' . date_get_age($post['birthday']);
        if (strlen($post['spot']) > 0) {
            echo ' från ' . $post['spot'];
        }
        echo '</div>';
        if ($post['userlevel'] >= 3) {
            echo '<img class="badge" src="' . IMAGE_URL . 'forum/ordningsvakt.png" alt="" />';
        }
        if ($post['lastaction'] > time() - 600) {
            echo '<img class="badge" src="' . IMAGE_URL . 'forum/online.png" alt="" />';
        }
        echo '<div id="post_content_' . $post['post_id'] . '" class="' . ($low_quality ? 'low_quality_content' : 'content') . '">' . "\n";
        $options_markup['post_id'] = $post['post_id'];
        $options_markup['context'] = 'forum';
        echo setsmilies(markup_parse($post['content'], $options_markup));
        if (strlen($post['forum_signature']) > 0) {
            echo '<div class="signature">' . $post['forum_signature'] . '</div>' . "\n";
        }
        echo '</div>' . "\n";
        echo '<div class="controls">' . "\n";
        if (login_checklogin()) {
            $control_buttons['answer'] = '<input type="button" class="post_answer_button" id="post_answer_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Svara]" />';
            $control_buttons['quote'] = '<input type="button" class="post_quote_button" id="post_quote_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Citera]" />';
            $control_buttons['history'] = '<input type="button" class="post_history_button" id="post_history_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Historik]" />';
            $control_buttons['delete'] = '<input type="button" class="post_delete_button" id="post_delete_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Ta bort]" />';
            $control_buttons['censor'] = '<input type="button" class="post_censor_button" id="post_censor_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Censurera]" />';
            $control_buttons['addition'] = '<input type="button" class="post_addition_button" id="post_addition_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Tillägg]" />';
            $control_set['forum'] = array('answer', 'quote');
            $control_set['guestbook'] = array('answer', 'quote', 'history');
            $control_set['admin'] = array('delete', 'censor', 'addition');
            foreach ($control_set[$options['mode']] as $button) {
                echo $control_buttons[$button] . "\n";
            }
            if (posts_admin_check($post)) {
                foreach ($control_set['admin'] as $button) {
                    echo $control_buttons[$button] . "\n";
                }
            } elseif ($post['author'] == $_SESSION['login']['id']) {
                echo $control_buttons['addition'];
            }
        }
        echo '</div>' . "\n";
        echo '<div class="post_addition" id="post_addition_' . $post['post_id'] . '">' . "\n";
        echo '	<textarea id="post_addition_content_' . $post['post_id'] . '" rows="3" cols="50"  ></textarea>' . "\n";
        echo '	<button class="button_30" id="post_addition_submit_' . $post['post_id'] . '" value="post_addition_' . $post['post_id'] . '">Spara</button>' . "\n";
        echo '</div>';
        echo '</div>' . "\n";
        if ($low_quality) {
            echo '</div>' . "\n";
        }
        echo "\n\n";
        $displayed_posts[] = $post['post_id'];
    }
    if (login_checklogin()) {
        /* Remove all notices and answer notices for read posts */
        $query = 'DELETE FROM notices WHERE post_id IN("' . implode('", "', $displayed_posts) . '") AND user_id = "' . $_SESSION['login']['id'] . '"';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
    }
    /* List the remaining discussions */
    if (count($discussions) > 0) {
        discussions_list_splits($discussions);
    }
}
Example #15
0
$ui_options['admtoma_category'] = 'chat';
$ui_options['menu_path'] = array('chatt');
$ui_options['stylesheets'][] = 'chat.css';
ui_top($ui_options);
$url = 'http://ved.hamsterpaj.net/chatt/index.php?';
if (login_checklogin()) {
    $url .= 'nick=';
    /* Please comment this if you understand the following lines */
    /* Ask Joel, he can explain it. /Joel */
    if (!preg_match("/^[A-Za-z]\$/i", substr($_SESSION['login']['username'], 0, 1))) {
        $url .= substr($_SESSION['login']['username'], 1, strlen($_SESSION['login']['username']));
    } else {
        $url .= $_SESSION['login']['username'];
    }
    $url .= '&amp;realname=';
    $ageArray = date_get_age($_SESSION['userinfo']['birthday']);
    $url .= urlencode($ageArray . ';');
    $url .= urlencode($_SESSION['userinfo']['gender'] . ';');
    $url .= urlencode($_SESSION['userinfo']['location'] . ';');
    $url .= urlencode($_SESSION['login']['id'] . ';');
    $url .= urlencode($_SESSION['userinfo']['image'] . ';');
} else {
    $url .= 'guest';
}
$fjortis_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&amp;chan=fjortis' . '\',\'' . rand() . '\',\'location=no, width=640, height=478\')">';
$traffa_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&amp;chan=' . urlencode('träffa') . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$kuddhornan_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&amp;chan=' . urlencode('kuddhörnan') . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$trivia_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&amp;chan=trivia' . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$webdesign_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&amp;chan=webdesign' . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$musik_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&amp;chan=musik' . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$chattare = file_get_contents('clients.txt');
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
while ($data = mysql_fetch_assoc($result)) {
    /* Only display each user one time, should be done with DISTINCT in query, but I can't ger it to work */
    if (in_array($data['user_id'], $duplicates)) {
        continue;
    }
    $duplicates[] = $data['user_id'];
    $entry = '<div class="visitor">' . "\n";
    if (in_array($data['image'], array(1, 2))) {
        $entry .= insert_avatar($data['user_id']);
    }
    $entry .= fix_time($data['timestamp']);
    $entry .= '<div>' . "\n";
    $entry .= '<h3><a href="/traffa/profile.php?id=' . $data['user_id'] . '">' . $data['username'] . '</a></h3>' . "\n";
    $entry .= '<h4>';
    $entry .= $data['birthday'] != '0000-00-00' ? date_get_age($data['birthday']) . 'år ' : '';
    $entry .= strlen($data['spot']) > 0 ? 'från ' . $data['spot'] : '';
    $entry .= '</h4>' . "\n";
    $entry .= $data['lastaction'] > time() - 600 ? 'Online nu!' : 'Loggade senast in ' . date('Y-m-d', $data['lastlogon']) . "\n";
    $entry .= '</div>';
    $entry .= '</div>' . "\n";
    switch ($data['gender']) {
        case 'm':
            $output_boys .= $entry;
            break;
        case 'f':
            $output_girls .= $entry;
            break;
        default:
            $output_unknown .= $entry;
            break;
Example #17
0
        echo '<p class="digga_no_description">' . "\n";
        echo 'Vi har tyvärr ingen beskrivning om ' . $artist_info['name'] . ' än. Om du känner att du kan mycket om det ';
        echo 'här bandet eller den här artisten så får du hemskt gärna skriva en egen beskrivning och skicka den som ett ';
        echo 'privat meddelande till <a href="/traffa/profile.php?id=65654">Rojk</a>. Glöm inte att tala om vilken artist ';
        echo 'det gäller!' . "\n";
        echo '</p>' . "\n";
    }
    $diggers = digga_fetch_diggers($_GET['artist_id']);
    if (count($diggers) > 0) {
        echo '<div id="digga_diggers">' . "\n";
        echo '<h2>Hamsterpajare som diggar ' . $artist_info['name'] . '</h2>' . "\n";
        echo '<table>' . "\n";
        foreach ($diggers as $digger) {
            echo '<tr>' . "\n";
            echo '<td><a href="/traffa/profile.php?id=' . $digger['id'] . '">' . $digger['username'] . '</a></td>' . "\n";
            echo '<td>' . $digger['gender'] . date_get_age($digger['birthday']) . '</td>' . "\n";
            echo '<td>';
            echo $digger['lastaction'] > time() - 900 ? 'online' : 'offline';
            echo '</td>' . "\n";
            echo '</tr>' . "\n";
        }
        echo '</table>' . "\n";
        echo '</div>' . "\n";
    }
    digga_search_form();
}
if (!isset($_GET['artist_id'])) {
    echo '<h1>Digga visar dig vad andra diggar och du visar andra vad du diggar</h1>' . "\n";
    echo '<div id="digga_top_100">' . "\n";
    digga_top_100();
    echo '</div>' . "\n";
Example #18
0
function games_comments_list($posts)
{
    $output = '';
    foreach ($posts as $post) {
        if (in_array('removed', $post['flags'])) {
            continue;
        }
        //		$output .= print_r($post, true);
        $output .= '<div class="post" id="game_comment_' . $post['post_id'] . '">' . "\n";
        $output .= '<div class="head">' . "\n";
        $output .= '<div class="date_time">' . fix_time($post['timestamp']) . '</div>' . "\n";
        $output .= '<img class="author_icon" onmouseover="javascript: makeTrue(domTT_activate(this, event, \'content\', \'<img src=' . IMAGE_URL . 'images/users/thumb/' . $post['author'] . '.jpg />\', \'trail\', true));" src="' . IMAGE_URL . 'images/icons/user.png" />' . "\n";
        $output .= '<div class="author"><a href="/traffa/profile.php?id=' . $post['author'] . '">' . $post['username'] . '</a>' . "\n";
        $output .= $post['gender'];
        $output .= date_get_age($post['birthday']) > 0 ? ' ' . date_get_age($post['birthday']) . ' ' : '';
        $output .= '</div>' . "\n";
        //end author
        $output .= '</div>' . "\n";
        //end head
        $output .= '<p>' . $post['content'] . '</p>' . "\n";
        if ($_SESSION['login']['userlevel'] >= 3) {
            $output .= '<div class="controls">' . "\n";
            $output .= '<button onclick="javascript: games_comment_delete(\'' . $post['post_id'] . '\');" class="comment_delete_button" id="comment_delete_button_' . $post['post_id'] . '">Ta bort</button>' . "\n";
            $output .= '</div>' . "\n";
            //end controls
        }
        $output .= '</div>' . "\n";
        //end post
    }
    return $output;
}
Example #19
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;
    }
}
    }
}
if (isset($_GET['id']) && is_numeric($_GET['id']) && (int) $_GET['id'] > 0) {
    $query = 'SELECT l.username, u.user_status, u.gender, u.birthday, z.spot, z.x_rt90, z.y_rt90, uv.count AS total_visits, uv.timestamp AS last_visit, GROUP_CONCAT(DISTINCT f.flag) AS flags';
    $query .= ' FROM user_visits AS uv, userinfo AS u, zip_codes AS z, login AS l';
    $query .= ' LEFT OUTER JOIN user_flags AS f ON l.id = f.user';
    $query .= ' WHERE l.id = ' . $_GET['id'] . ' AND u.userid = l.id AND z.zip_code = u.zip_code AND uv.item_id = l.id AND uv.user_id = ' . $fetch_for_userid . ' AND uv.type = "profile_visit"';
    $query .= ' GROUP BY l.id';
    $query .= ' LIMIT 1';
    $result = mysql_query($query) or report_sql_error($query);
    if (mysql_num_rows($result) == 0) {
        die('Error2');
    }
    $data = mysql_fetch_assoc($result);
    $output = array();
    $output['age'] = $data['birthday'] == '0000-00-00' ? 0 : date_get_age($data['birthday']);
    /* Some strange conditions... */
    if ($output['age'] == '') {
        $output['age'] = 0;
    }
    $output['username'] = htmlentities($data['username']);
    // Never trust the user (eg. Ekonomi-pär and such).
    $output['have_visited'] = htmlentities($fetch_for_username);
    $output['gender'] = $data['gender'];
    $output['location'] = htmlentities(trim($data['spot']), ENT_QUOTES, 'UTF-8');
    // Hmm, I like to escape data...
    $output['total_visits'] = $data['total_visits'];
    $output['last_visit'] = htmlentities(strtolower(fix_time($data['last_visit'])), ENT_QUOTES, 'UTF-8');
    $output['x_rt90'] = $data['x_rt90'];
    $output['y_rt90'] = $data['y_rt90'];
    $output['user_status'] = addslashes(htmlentities($data['user_status'], ENT_QUOTES, 'UTF-8'));
Example #21
0
function age_guess_image()
{
    $date_min = date('Y-m-d', strtotime('-25 years'));
    $date_max = date('Y-m-d', strtotime('-6 years'));
    $query = 'SELECT l.id, l.username, u.birthday FROM login AS l, userinfo AS u';
    $query .= ' WHERE l.id NOT IN ("' . implode('", "', $_SESSION['age_guess']['seen_users']) . '")';
    $query .= ' AND u.birthday != "0000-00-00" AND l.id = u.userid AND u.image = 2 AND l.username NOT LIKE "Borttagen"';
    $query .= ' AND u.birthday > "' . $date_min . '" AND u.birthday < "' . $date_max . '"';
    $query .= ' ORDER BY l.lastlogon DESC LIMIT ' . rand(0, 100) . ', 1';
    $result = mysql_query($query);
    $data = mysql_fetch_assoc($result);
    $_SESSION['age_guess']['current_user'] = $data['id'];
    $_SESSION['age_guess']['current_age'] = date_get_age($data['birthday']);
    $_SESSION['age_guess']['current_username'] = $data['username'];
    $_SESSION['age_guess']['seen_users'][] = $data['id'];
    $_SESSION['age_guess']['viewed_images']++;
    $return .= '<img src="' . IMAGE_URL . 'images/users/full/' . $_SESSION['age_guess']['current_user'] . '.jpg" />' . "\n";
    return $return;
}
Example #22
0
<?php

require '../include/core/common.php';
$query = 'SELECT l.username, u.gender, u.birthday, z.spot, u.image';
$query .= ' FROM login AS l, userinfo AS u, zip_codes AS z';
$query .= ' WHERE u.userid = l.id AND z.zip_code = u.zip_code';
$query .= ' AND l.id = "' . $_GET['user'] . '" LIMIT 1';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
$data = mysql_fetch_assoc($result);
echo '<a href="/traffa/profile.php?id=' . $_GET['user'] . '">' . $data['username'] . '</a>' . "\n";
if ($data['gender'] == 'm') {
    echo ' kille ';
} elseif ($data['gender'] == 'f') {
    echo ' tjej ';
}
if ($data['birthday'] != '0000-00-00') {
    echo ' ' . date_get_age($data['birthday']) . ' ';
}
if (strlen($data['spot']) > 0) {
    echo ' från ' . $data['spot'];
}
if ($data['image'] == 2 || $data['image'] == 3) {
    echo '<br /><img src="' . IMAGE_URL . 'images/users/thumb/' . $_GET['user'] . '.jpg" />' . "\n";
}
Example #23
0
function discussion_forum_post_render($data, $parent_post = array(), $options = array())
{
    $options['post'] = $data;
    /*
    			[id] => 2 [handle] => normal_vikt [author] => 3 [timestamp] => 1200341971 [parent_post] => 0 [forum_id] => 0
    			[forum_type] => public_forum [title] => Normal vikt? [content] => Denna post har skapats av en funktion! [score] => 0 
    			[verified] => 0 [removed] => 0 [removal_comment] => [remover] => 0 [child_count] => 1 [locked] => 0 [sticky] => 0
    			[last_post] => 0 [anonymous] => 0 [username] => Johan [birthday] => 1988-09-10 [gender] => m [spot] => Göteborg
    */
    $warned = 0;
    $options['show_post_controls'] = isset($options['show_post_controls']) ? $options['show_post_controls'] : true;
    $options['show_removed_posts_content'] = isset($options['show_removed_posts_content']) ? $options['show_removed_posts_content'] : false;
    $return = '<a name="post_' . $data['id'] . '"></a>' . "\n";
    $return .= '<input type="hidden" id="post_' . $data['id'] . '_author_username" value="' . $data['username'] . '" />' . "\n";
    $return .= '<div class="forum_post_container">' . "\n";
    if ($data['removed'] == 1 && $options['show_removed_posts_content'] != true) {
        $return .= '<div class="forum_post_removed">Inlägget har tagits bort' . "\n";
        $return .= $options['show_post_controls'] == true && forum_security(array('action' => 'unremove_post')) ? '<button value="' . $data['id'] . '" class="forum_unremove_button">trob At</button>, Borttaget av <a href="/traffa/profile.php?id=' . $data['remover'] . '">' . $data['remover'] . '</a>.' . "\n" : '';
        $return .= '</div>';
    } else {
        $return .= strpos(strtolower($data['content']), strtolower($_SESSION['login']['username'])) ? '<div class="highlight">' . "\n" : '';
        $return .= '<div class="forum_post_top"></div>' . "\n";
        $return .= '<div class="forum_post" id="forum_post_' . $data['id'] . '">' . "\n";
        $return .= '<div class="author">' . "\n";
        if (strtolower($data['username']) == 'vit_seger') {
            $data['username'] = '******';
        }
        $return .= '<a class="username" href="/traffa/profile.php?id=' . $data['author'] . '">' . $data['username'];
        $return .= '</a>' . "\n";
        $return .= $data['author'] == 2 ? '&nbsp;<a href="/diskussionsforum/hamsterpaj/veckans_ros/" title="Veckans ros"><img src="http://images.hamsterpaj.net/ros.png" alt="Ros" style="width: 11px; height: 17px;border:0;" /></a><br style="clear: both;" />' . "\n" : '';
        $return .= '<div class="passepartout">' . "\n";
        $return .= ui_avatar($data['author']);
        $return .= '</div>' . "\n";
        $return .= '<span class="gender">' . str_replace(array('m', 'f', 'u'), array('P', 'F', ''), $data['gender']) . '</span>' . "\n";
        if ($data['birthday'] != '0000-00-00') {
            $return .= '<span class="age">' . date_get_age($data['birthday']) . '</span>' . "\n";
        }
        if (strlen($data['spot']) > 0) {
            $return .= ' <span class="location">' . $data['spot'] . '</span>' . "\n";
        }
        if ($data['last_warning'] > time() - 604800) {
            $return .= '<span class="warned">Varnad ' . '</span>' . "\n";
        } elseif (strlen($data['forum_userlabel']) > 0) {
            $return .= '<span class="userlevel">' . $data['forum_userlabel'] . '</span>' . "\n";
        } elseif ($data['regtimestamp'] < time() - 86400 * 356 * 2.5) {
            $return .= '<span class="userlevel">Veteran</span>' . "\n";
        } elseif ($data['regtimestamp'] < time() - 86400 * 356) {
            $return .= '<span class="userlevel">Stammis</span>' . "\n";
        } elseif ($data['regtimestamp'] > time() - 86400 * 7) {
            $return .= '<span class="userlevel">Nykomling</span>' . "\n";
        }
        if ($data['quality_level'] == 1) {
            $return .= '<span class="post_count">' . cute_number($data['author_spam_count']) . ' spam</span>' . "\n";
        } else {
            if ($data['author'] == 15) {
                $author_post_count = 'Några osöta';
            } elseif ($data['author'] == 87926) {
                $author_post_count = 'Många söta';
            } elseif ($data['author'] == 774586) {
                $author_post_count = 'Inte många';
            } elseif ($data['author'] == 787082) {
                $author_post_count = 'Många schmarta';
            } elseif ($data['author'] == 891711) {
                $author_post_count = '';
            } elseif ($data['author'] == 299825) {
                $author_post_count = '666 hatiska inlägg';
            } else {
                $author_post_count = cute_number($data['author_post_count']);
            }
            $return .= '<span class="post_count">' . $author_post_count . ' inlägg</span>' . "\n";
        }
        if ($data['lastaction'] > time() - 600) {
            $return .= '<span class="online_status">Online</span>' . "\n";
        }
        $return .= ui_birthday_cake($data['birthday']) . "\n";
        $return .= '</div>' . "\n";
        $return .= '<div class="post_info">' . "\n";
        $return .= '<span class="post_timestamp">' . fix_time($data['timestamp']) . '</span>' . "\n";
        $return .= $data['parent_post'] == 0 ? '<h3>' . $data['title'] . '</h3>' : '';
        $return .= '</div>' . "\n";
        $return .= '<div class="post_content">' . "\n";
        $return .= $data['removed'] == 1 ? '<strong>Inlägget är borttaget!</strong><br />' . "\n" : '';
        $return .= discussion_forum_parse_output($data['content'], $options);
        if (strlen($data['user_status']) > 0) {
            $return .= '<p class="user_status">' . $data['user_status'] . '</p>' . "\n";
        }
        $return .= '</div>' . "\n";
        $return .= '<div class="controls">' . "\n";
        if ($options['show_post_controls'] == true) {
            $return .= '<input type="text" class="forum_direct_link_input" id="forum_direct_link_input_' . $data['id'] . '" />';
            $return .= '<button id="forum_direct_link_button_' . $data['id'] . '" class="forum_direct_link_button">Länk</button>' . "\n";
            $return .= forum_security(array('action' => 'remove_post')) ? '<button value="' . $data['id'] . '" class="forum_remove_button">Ta bort</button>' . "\n" : '';
            $return .= forum_security(array('action' => 'edit_post', 'post' => $data)) || forum_security(array('action' => 'post_addition', 'post' => $data)) ? '<button id="forum_edit_button_' . $data['id'] . '" class="forum_edit_button">Ändra</button>' . "\n" : '';
            $return .= forum_security() ? '<button id="post_reply_' . $data['id'] . '" class="forum_reply_button">Citera</button>' . "\n" : '';
            $return .= forum_security(array('action' => 'reply', 'post' => $parent_post)) === true ? '<button id="post_reply_' . $data['id'] . '" class="forum_reply_button">Svara</button>' . "\n" : '';
            $return .= login_checklogin() ? '<button id="post_comment_' . $data['author'] . '" class="forum_comment_button" value="' . $data['id'] . '">Gästbok</button>' . "\n" : '';
            if (forum_security()) {
                $return .= '<input type="checkbox" class="post_move_check" name="post[]" value="' . $data['id'] . '" id="forum_move_check_' . $data['id'] . '" />';
                $return .= '<label for="forum_move_check_' . $data['id'] . '">Flytta</label>' . "\n";
            }
            $return .= forum_security(array('action' => 'user_ro')) ? '<button value="' . $data['username'] . '" class="forum_user_ro">QL</button>' . "\n" : '';
            $return .= forum_security(array('action' => 'report')) ? '<a href="/hamsterpaj/abuse.php?report_type=forum_post&reference_id=' . $data['id'] . '" class="abuse_button"><img src="http://images.hamsterpaj.net/abuse.png" /></a>' . "\n" : '';
            $return .= guestbook_form(array('recipient' => $data['author'], 'form_id' => 'forum_comment_' . $data['id']));
        } else {
            $return .= '<small>Knappar har inaktiverats</small>';
        }
        $return .= '</div>' . "\n";
        $return .= '</div>' . "\n";
        $return .= '<div class="forum_post_bottom"> </div>' . "\n";
        $return .= strpos(strtolower($data['content']), strtolower($_SESSION['login']['username'])) ? '</div>' . "\n" : '';
    }
    $return .= '</div>' . "\n";
    return $return;
}
Example #24
0
function radio_chat_url_render()
{
    $url = 'http://ved.hamsterpaj.net/chatt/index.php?';
    if (login_checklogin()) {
        $url .= 'nick=';
        /* Please comment this if you understand the following lines */
        /* Ask Joel, he can explain it. /Joel */
        if (!preg_match("/^[A-Za-z]\$/i", substr($_SESSION['login']['username'], 0, 1))) {
            $url .= substr($_SESSION['login']['username'], 1, strlen($_SESSION['login']['username']));
        } else {
            $url .= $_SESSION['login']['username'];
        }
        $url .= '&amp;realname=';
        $ageArray = date_get_age($_SESSION['userinfo']['birthday']);
        $url .= urlencode($ageArray . ';');
        $url .= urlencode($_SESSION['userinfo']['gender'] . ';');
        $url .= urlencode($_SESSION['userinfo']['location'] . ';');
        $url .= urlencode($_SESSION['login']['id'] . ';');
        $url .= urlencode($_SESSION['userinfo']['image'] . ';');
    } else {
        $url .= 'guest';
    }
    $url .= '&amp;chan=hamsterradio' . ',\'' . rand() . '\'';
    return $url;
}
Example #25
0
function list_entries($recipient, $entries, $offset = 0, $filter = 0)
{
    global $hp_includepath;
    if ($offset < 1 || !is_numeric($offset)) {
        $offset = 0;
    }
    $list_sql = 'SELECT gb.id, gb.timestamp, gb.message, gb.sender, gb.read, gb.answered, gb.forum_post, login.username, info.image, ';
    $list_sql .= 'info.birthday, info.gender, is_private, zip_codes.* ';
    $list_sql .= 'FROM traffa_guestbooks AS gb, login, userinfo AS info, zip_codes ';
    if ($filter > 0) {
        $list_sql .= 'WHERE (';
        $list_sql .= '(gb.recipient ="' . $recipient . '" AND gb.sender = "' . $filter . '") ';
        $list_sql .= 'OR (gb.recipient = "' . $filter . '" AND gb.sender = "' . $recipient . '") ';
        $list_sql .= ') AND login.id = gb.sender AND info.userid = gb.sender AND zip_codes.zip_code = info.zip_code ';
    } else {
        $list_sql .= 'WHERE gb.recipient = "' . $recipient . '" AND zip_codes.zip_code = info.zip_code ';
    }
    $list_sql .= 'AND login.id = gb.sender AND info.userid = gb.sender AND deleted = 0 ';
    if (isset($_SESSION['login']['id'])) {
        $list_sql .= 'AND (gb.is_private = 0 OR gb.sender = ' . $_SESSION['login']['id'] . ' OR gb.recipient = ' . $_SESSION['login']['id'] . ') ';
    } else {
        $list_sql .= 'AND gb.is_private = 0 ';
    }
    if ($filter > 0) {
        $list_sql .= 'ORDER BY gb.id DESC';
    } else {
        $list_sql .= 'ORDER BY gb.id DESC LIMIT ' . $offset . ', ' . GUESTBOOK_MESSAGES_PER_PAGE;
    }
    $list_result = mysql_query($list_sql) or die(report_sql_error($list_sql));
    if ($filter == 0) {
        echo '<p class="subtitle">Gästbok - ' . cute_number($entries) . ' inlägg</p>' . "\n";
    } else {
        echo '<p class="subtitle">Gästbok - Visar historik</p>' . "\n";
    }
    if ($offset > 0) {
        echo ' - sida ' . intval($offset / GUESTBOOK_MESSAGES_PER_PAGE + 1) . ' av ' . intval($entries / GUESTBOOK_MESSAGES_PER_PAGE + 1);
    }
    echo '</p>' . "\n";
    $unread = array();
    if (true) {
        while ($entry = mysql_fetch_assoc($list_result)) {
            if ($entry['read'] != 1) {
                rounded_corners_top(array('color' => 'orange_deluxe', 'id' => 'gb_entry_' . $entry['id']));
            } else {
                rounded_corners_top(array('color' => 'blue_deluxe', 'id' => 'gb_entry_' . $entry['id']));
                $button_color = 'blue_';
            }
            echo '<div class="entry_picture">' . "\n";
            if ($entry['image'] == 1 || $entry['image'] == 2) {
                echo ui_avatar($entry['sender']);
            }
            echo '</div>' . "\n";
            echo '<div class="entry_main">' . "\n";
            echo '<div class="entry_info">' . "\n";
            echo '<span class="gb_private" id="gb_private_' . $entry['id'] . '_label">';
            echo $entry['is_private'] == 1 ? 'Detta inlägg är privat' : '';
            echo '</span>' . "\n";
            echo '<span class="gb_unanswered" id="gb_unanswered_' . $entry['id'] . '_label">';
            echo $entry['answered'] != 'Y' ? 'Obesvarat' : '';
            echo '</span>' . "\n";
            echo '<span class="timestamp">Skrevs ' . fix_time($entry['timestamp']) . '</span>';
            echo '<a href="/traffa/profile.php?id=' . $entry['sender'] . '">' . $entry['username'] . '</a>' . "\n";
            echo $entry['gender'] == 'm' ? ' Pojke' : '';
            echo $entry['gender'] == 'f' ? ' Flicka' : '';
            echo $entry['birthday'] != '0000-00-00' ? ' ' . date_get_age($entry['birthday']) . ' år' : '';
            echo strlen($entry['spot']) > 0 ? ' från <a style="cursor: pointer;" onclick="window.open(\'http://www.hitta.se/LargeMap.aspx?ShowSatellite=false&pointX=' . $entry['y_rt90'] . '&pointY=' . $entry['x_rt90'] . '&cx=' . $entry['y_rt90'] . '&cy=' . $entry['x_rt90'] . '&z=6&name=' . $entry['username'] . '%20i%20' . urlencode($entry['spot']) . '\', \'user_map_3\', \'location=false, width=750, height=500\');">' . $entry['spot'] . '</a>' : '';
            echo '</div>' . "\n";
            echo '<p>' . "\n";
            echo setsmilies(nl2br($entry['message']));
            //			preint_r($entry);
            echo '</p>' . "\n";
            echo '</div>' . "\n";
            echo '<div class="entry_controls">' . "\n";
            echo $recipient == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<a href="/hamsterpaj/abuse.php?report_type=guestbook_entry&reference_id=' . $entry['id'] . '" class="abuse_button"><img src="http://images.hamsterpaj.net/abuse.png" /></a> ' . "\n" : '';
            echo $recipient == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<button class="' . $button_color . 'button_70" onclick="gb_block_user(\'' . $entry['username'] . '\');">Blockera</button> ' . "\n" : '';
            echo $recipient == $_SESSION['login']['id'] || $entry['sender'] == $_SESSION['login']['id'] ? '<button id="gb_private_' . $entry['id'] . '" class="' . $button_color . 'button_80" onclick="gb_private(' . $entry['id'] . ');"' . ($entry['is_private'] == 1 ? ' style="display: none;"' : '') . '>Privatisera</button> ' . "\n" : '';
            echo $recipient == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<button id="gb_unprivate_' . $entry['id'] . '" class="' . $button_color . 'button_90" onclick="gb_unprivate(' . $entry['id'] . ');"' . ($entry['is_private'] == 1 ? '' : ' style="display: none;"') . '>Avprivatisera</button> ' . "\n" : '';
            echo '<button class="' . $button_color . 'button_70" onclick="gb_history(' . $recipient . ', ' . $entry['sender'] . ');">Historik</button> ' . "\n";
            echo '<button class="' . $button_color . 'button_60" onclick="gb_goto(' . $entry['sender'] . ');">Gå till</button> ' . "\n";
            echo $recipient == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<button class="' . $button_color . 'button_60" onclick="gb_remove(' . $entry['id'] . ', \'' . $entry['username'] . '\', \'' . fix_time($entry['timestamp']) . '\');">Ta bort</button> ' . "\n" : '';
            echo $recipient == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<button class="' . $button_color . 'button_50" onclick="gb_answer(\'' . $entry['username'] . '\', ' . $entry['sender'] . ', ' . $entry['id'] . ');">Svara</button> ' . "\n" : '';
            echo '</div>' . "\n";
            if ($entry['read'] != 1) {
                rounded_corners_bottom(array('color' => 'orange_deluxe'));
            } else {
                rounded_corners_bottom(array('color' => 'blue_deluxe'));
            }
            if ($entry['read'] == 0) {
                array_push($unread, $entry['id']);
            }
        }
    } else {
        while ($list_data = mysql_fetch_assoc($list_result)) {
            if ($list_data['read'] == 1) {
                echo '<div style="background: #f7f7f7">' . "\n";
            } else {
                echo '<div style="background: #ffc777">' . "\n";
            }
            echo '<table class="body"><tr><td style="width: 80px; vertical-align: top;">' . "\n";
            if ($list_data['image'] == 1 || $list_data['image'] == 2) {
                echo insert_avatar($list_data['sender']);
            }
            echo '</td>' . "\n" . '<td style="vertical-align: top; width: 650px;">' . "\n";
            if ($list_data['is_private'] == 1) {
                echo '<b>Detta inlägg är privat</b>' . "\n";
            }
            if ($list_data['forum_post'] > 0) {
                echo '<div class="orange_faded_div" style="width: auto;">Detta är en kommentar på ett forumsinlägg. <a href="javascript: void(0);" onclick="window.open(\'/forum_new/read_post_popup.php?id=' . $list_data['forum_post'] . '\', Math.random(), \'width=600, height=450, scrollbars=yes\');">Läs inlägget i en popup</a> eller <a href="/forum_new/index.php?action=redirect_to_post&post_id=' . $list_data['forum_post'] . '">gå till tråden i forumet</a>.</div>';
            }
            if ($_SESSION['login']['id'] == $recipient) {
                $reply_status = $list_data['answered'] == 'Y' ? null : ' Obesvarat';
            }
            echo '<p style="color: grey;">';
            echo $list_data['read'] == 0 ? '<strong>' : null;
            echo '(skrevs ' . fix_time($list_data['timestamp']) . $reply_status . ')';
            echo $list_data['read'] == 0 ? '</strong>' : null;
            echo '<br />' . "\n";
            echo '<a href="/traffa/profile.php?id=' . $list_data['sender'] . '"><b>' . $list_data['username'] . '</b></a> ';
            if ($list_data['gender'] == 'm') {
                echo 'Kille ';
            } elseif ($list_data['gender'] == 'f') {
                echo 'Tjej ';
            }
            $userage = date_get_age($list_data['birthday']);
            if ($userage > 0) {
                echo $userage . ' år ';
            }
            if (strlen($list_data['spot']) > 0) {
                echo 'från ' . $list_data['spot'] . ' ';
            }
            echo '</p>' . "\n";
            echo '<p>';
            echo setSmilies(nl2br($list_data['message']));
            echo '</p>' . "\n";
            echo '<p style="text-align: right;">' . "\n";
            echo '<form action="/traffa/userblocks.php" method="post" style="display: inline; float: right;">' . "\n";
            if ($_SESSION['login']['id'] == $recipient && $filter == 0) {
                echo '<input type="submit" value="Blockera" class="button_70" style="display: inline;" onclick="return confirm(\'Du är på väg att blockera avsändaren från att skicka fler gästboksinlägg och meddelanden till dig\');" />' . "\n";
            }
            if ($filter == 0) {
                echo '<input type="button" onClick="window.location=\'' . $_SERVER['PHP_SELF'] . '?action=history&view=' . $recipient . '&remote=' . $list_data['sender'] . '\';" class="button_70" value="Historik" /> ' . "\n";
            }
            echo '<input type="button" onclick="window.location=\'' . $_SERVER['PHP_SELF'] . '?view=' . $list_data['sender'] . '\';" class="button_60" value="Gå till" /> ' . "\n";
            if ($_SESSION['login']['id'] == $recipient) {
                echo '<input type="button" onclick="window.open(\'/traffa/gb-reply.php?action=reply&username='******'username'] . '&userid=' . $list_data['sender'] . '&answereid=' . $list_data['id'];
                echo '\',\'\' ,\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=250, height=200\');" value="Svara" class="button_50" /> ' . "\n";
                if ($filter == 0) {
                    echo '<input type="button" onclick="var name=confirm(\'Vill du verkligen ta bort inlägget?\'); if(name==true){ window.location=\'' . $_SERVER['PHP_SELF'] . '?action=delete&entry_id=' . $list_data['id'] . '&return_offset=' . $_GET['offset'] . '\'; }" value="Ta bort" class="button_70" />' . "\n";
                    echo '<input type="hidden" name="addblock" value="' . $list_data['username'] . '" />' . "\n";
                }
            }
            echo '</form>' . "\n";
            if ($_SESSION['login']['id'] == $recipient && $filter == 0) {
                echo '<button class="button_80" style="display: inline;" onclick="idiot_report(\'' . $list_data['sender'] . '\');" />Rapportera</button>' . "\n";
            }
            echo '</p>' . "\n";
            echo '</td></tr>' . "\n" . '</table>' . "\n";
            echo '</div>' . "\n";
            echo '<br />' . "\n";
            if ($list_data['read'] == 0) {
                array_push($unread, $list_data['id']);
            }
        }
    }
    if ($offset > 0) {
        echo '<input type="button" onclick="window.location=\'' . $_SERVER['PHP_SELF'] . '?offset=' . intval($offset - GUESTBOOK_MESSAGES_PER_PAGE) . '&view=' . $recipient . '\';" value="<<Föregående sida" class="button" style="float: left;" />';
    }
    if ($offset + GUESTBOOK_MESSAGES_PER_PAGE < $entries && $entries > GUESTBOOK_MESSAGES_PER_PAGE) {
        echo '<input type="button" onclick="window.location=\'' . $_SERVER['PHP_SELF'] . '?offset=' . intval($offset + GUESTBOOK_MESSAGES_PER_PAGE) . '&view=' . $recipient . '\';" value="Nästa sida>>" class="button" style="float: right;" />';
    }
    echo '<div style="text-align: center; margin-bottom: 15px;">';
    for ($pages = 1; $pages < intval($entries / GUESTBOOK_MESSAGES_PER_PAGE + 1) && $pages < 32; $pages++) {
        echo '<a href="' . $_SERVER['PHP_SELF'] . '?view=' . $recipient . '&offset=' . ($pages - 1) * GUESTBOOK_MESSAGES_PER_PAGE . '">' . $pages . '</a> ';
    }
    echo '</div>';
    if ($recipient == $_SESSION['login']['id'] && $filter == 0) {
        $read_sql = 'UPDATE traffa_guestbooks SET `read` = 1 WHERE id = 1 ';
        //Bara för att göra foreach-loopen smidigare :P
        foreach ($unread as $current) {
            $read_sql .= 'OR id = ' . $current . ' ';
        }
        mysql_query($read_sql) or die(report_sql_error($read_sql, __FILE__, __LINE__));
    }
}
Example #26
0
    if ($_SESSION['userinfo']['gender'] == 'P') {
        $query .= 'AND DATE_SUB(CURDATE(),INTERVAL ' . ($userage + 1) . ' YEAR) <= u.birthday AND DATE_SUB(CURDATE(),INTERVAL ' . ($userage - 2) . ' YEAR) >= u.birthday ';
    } else {
        $query .= 'AND DATE_SUB(CURDATE(),INTERVAL ' . ($userage + 2) . ' YEAR) <= u.birthday AND DATE_SUB(CURDATE(),INTERVAL ' . ($userage - 1) . ' YEAR) >= u.birthday ';
    }
    $query .= 'AND l.id = u.userid AND z.zip_code = u.zip_code ';
    $query .= 'LIMIT 30';
    $result = mysql_query($query) or die(report_sql_error());
    echo '<pre>';
    echo $query . '<br /><br />';
    while ($data = mysql_fetch_assoc($result)) {
        print_r($data);
        $map_points .= '<Point X=\'' . $data['y_rt90'] . '\' Y=\'' . $data['x_rt90'] . '\'>';
        $map_points .= '<Name>' . $data['username'] . '</Name>';
        $map_points .= '<IconImage>http://www.hitta.se/images/point.png</IconImage>';
        $map_points .= '<Content><![CDATA[' . $data['gender'] . ' ' . date_get_age($data['birthday']);
        if ($data['image'] == 1 || $data['image'] == 2) {
            $map_points .= '<br /><a href=\'http://www.hamsterpaj.net/hittapunktse_map_link_redirect.php?id=' . $data['userid'] . '\'><img src=\'http://images.hamsterpaj.net/images/users/thumb/' . $data['userid'] . '.jpg\' /></a>';
        }
        if (login_checklogin()) {
            $map_points .= '<br />' . rt90_readable(rt90_distance($_SESSION['userinfo']['x_rt90'], $_SESSION['userinfo']['y_rt90'], $data['x_rt90'], $data['y_rt90']));
        }
        $map_points .= ']]></Content>';
        $map_points .= '</Point>';
    }
    echo '<form method="post" action="http://www.hitta.se/LargeMap.aspx" target="hittapunktse" onsubmit="window.open(\'\', \'hittapunktse\', \'location=no, width=750, height=500\');">' . "\n";
    echo '<input type="hidden" name="MapPoints" value="<?xml version=\'1.0\' encoding=\'utf-8\'?><MapPoints xmlns=\'http://tempuri.org/XMLFile1.xsd\'>' . $map_points . '</MapPoints>">' . "\n";
    echo '<input type="submit" value="Tjejer 15-19 år online" class="button">' . "\n";
    echo '</form>' . "\n";
}
ui_bottom();
Example #27
0
*/
$query = 'SELECT ';
$query .= 'login.username AS username, login.id AS userid, login.userlevel AS userlevel, userinfo.birthday AS birthday, ';
$query .= 'userinfo.gender AS gender, userinfo.image AS image ';
$query .= 'FROM login, userinfo ';
$query .= 'WHERE userinfo.userid = login.id AND login.userlevel > 2 ';
$result = mysql_query($query) or die('Ett fel uppstod vid hämtning av data<br><br>' . $query . '<br><br>' . mysql_error());
//echo '<pre>';
//	echo '<table><tr>';
$last_user_level = 0;
//rounded_corners_top();
while ($data = mysql_fetch_assoc($result)) {
    echo '<div style="width: 110px;height: 150px;' . ($last_user_level != $data['userlevel'] ? 'clear: left;' : '') . 'float: left;margin: 0px;' . '">' . "\n";
    $last_user_level = $data['userlevel'];
    echo '<a href="/traffa/profile.php?id=' . $data['userid'] . '"><b>' . $data['username'] . '</b></a>';
    echo ' ' . $data['gender'] . date_get_age($data['birthday']);
    echo '<br />';
    if ($data['userlevel'] == 5) {
        echo '<font color="red">SysOp</font>';
    } elseif ($data['userlevel'] == 4) {
        echo '<font color="green">Administratör</font>';
    } elseif ($data['userlevel'] == 3) {
        echo '<font color="blue">Ordningsvakt</font>';
    } else {
        echo 'Level 2';
    }
    echo '<br />';
    echo ui_avatar($data['userid']);
    echo '</div>' . "\n";
}
//rounded_corners_bottom();
Example #28
0
function profile_head($params)
{
    $include_profile_theme_style = isset($params['include_profile_theme_style']) ? $params['include_profile_theme_style'] == true : true;
    $id = isset($params['id']) ? ' id="' . $params['id'] . '"' : '';
    $out .= '<div class="profile_head"' . $id . '>' . "\n";
    $img = $params['image'] == 1 || $params['image'] == 2 ? IMAGE_URL . 'images/users/thumb/' . $params['user_id'] : IMAGE_URL . 'user_no_image.png';
    $class = $params['image'] == 1 || $params['image'] == 2 ? 'user_avatar' : 'no_avatar';
    $out .= '<div class="avatar_passepartout">' . "\n";
    $out .= ui_avatar($params['user_id']);
    //$out .= '<img src="' . $img . '" class="' . $class . '" />' . "\n";
    $out .= '</div>' . "\n";
    $out .= '<div class="name_asl">' . "\n";
    $out .= '<span class="username">' . $params['username'] . '</span> ';
    $genders = array('m' => 'kille', 'f' => 'tjej');
    $out .= isset($genders[$params['gender']]) ? '<span class="gender">' . $genders[$params['gender']] . '</span> ' : '';
    $out .= $params['birthday'] != '0000-00-00' ? '<span class="age">' . date_get_age($params['birthday']) . '</span> ' : '';
    if ($params['x_rt90'] > 0 && $params['y_rt90'] > 0) {
        $location = $params['spot'];
        if (login_checklogin() && $_SESSION['userinfo']['x_rt90'] > 0 && $_SESSION['userinfo']['y_rt90'] > 0 && $params['zip_code'] != $_SESSION['userinfo']['zip_code']) {
            $location .= ' (' . rt90_readable(rt90_distance($params['x_rt90'], $params['y_rt90'], $_SESSION['userinfo']['x_rt90'], $_SESSION['userinfo']['y_rt90'])) . ')';
        }
        /* Note RT90 Y and X values are flipped, due to a "bug" at hitta.se */
        /* Reference: daniel.eklund@hitta.se */
        $location .= ' <input type="button" value="Visa på karta" class="button_90" onclick="window.open(\'' . 'http://www.hitta.se/LargeMap.aspx?ShowSatellite=false&pointX=' . $params['y_rt90'] . '&pointY=' . $params['x_rt90'] . '&cx=' . $params['y_rt90'] . '&cy=' . $params['x_rt90'] . '&z=6&name=' . $params['username'] . '\', \'user_map_' . $params['username'] . '\', \'location=false, width=750, height=500\');" />' . "\n";
        $out .= '<span class="spot">' . $location . '</span> ';
    }
    if ($params['lastaction'] > time() - 600) {
        $out .= '<span class="online">online</span>' . "\n";
    } else {
        $out .= '<span class="last_seen">senast ' . fix_time($params['lastlogon']) . '</span>' . "\n";
    }
    $out .= '</div>' . "\n";
    $out .= '<p class="user_status">' . $params['user_status'] . '</p>' . "\n";
    $query = 'SELECT * FROM user_action_log WHERE user = "******" ORDER BY id DESC LIMIT 3';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    while ($event = mysql_fetch_assoc($result)) {
        $events[] = $event;
    }
    array_reverse($events);
    if (count($events) > 0) {
        $out .= '<ul class="user_action_log">' . "\n";
        foreach ($events as $event) {
            switch ($event['action']) {
                case 'friendship':
                    $out .= '<li><span class="time">' . fix_time($event['timestamp']) . '</span> blev kompis med <a href="' . $event['url'] . '">' . $event['label'] . '</a></li>' . "\n";
                    break;
                case 'diary':
                    $out .= '<li><span class="time">' . fix_time($event['timestamp']) . '</span> skrev i dagboken <a href="' . $event['url'] . '">' . $event['label'] . '</a></li>' . "\n";
                    break;
                case 'photos':
                    $out .= '<li><span class="time">' . fix_time($event['timestamp']) . '</span> ny bild <a href="' . $event['url'] . '">' . substr($event['label'], 0, 45) . '</a></li>' . "\n";
                    break;
            }
        }
        $out .= '</ul>' . "\n";
    }
    $profile_modules['presentation']['label'] = 'Presentation';
    $profile_modules['presentation']['url'] = '/traffa/profile.php?user_id=%USERID%';
    $profile_modules['guestbook']['label'] = 'Gästbok';
    $profile_modules['guestbook']['url'] = '/traffa/guestbook.php?view=%USERID%';
    $profile_modules['photos']['label'] = 'Fotoalbum';
    $profile_modules['photos']['url'] = '/traffa/photos.php?user_id=%USERID%';
    $profile_modules['diary']['label'] = 'Dagbok';
    $profile_modules['diary']['url'] = '/traffa/diary.php?user_id=%USERID%';
    $profile_modules['friends']['label'] = 'Vänner';
    $profile_modules['friends']['url'] = '/traffa/friends.php?user_id=%USERID%';
    $profile_modules['facts']['label'] = 'Fakta';
    $profile_modules['facts']['url'] = '/traffa/user_facts.php?user_id=%USERID%';
    $profile_modules['my_visitors']['label'] = 'Besökare';
    $profile_modules['my_visitors']['url'] = '/traffa/my_visitors.php?user_id=%USERID%';
    $out .= '<div class="navigation">' . "\n";
    $out .= '<ul>' . "\n";
    foreach ($profile_modules as $handle => $module) {
        $class = $handle == $params['active_tab'] ? ' class="active"' : '';
        if (isset($module['url'])) {
            $out .= '<li' . $class . '><a href="' . str_replace('%USERID%', $params['user_id'], $module['url']) . '">' . $module['label'] . '</a></li>' . "\n";
        } else {
            $out .= '<li' . $class . '>' . $module['label'] . '</li>' . "\n";
        }
    }
    $out .= '</ul>' . "\n";
    $out .= '</div>' . "\n";
    $out .= '</div>' . "\n";
    return $out;
}
Example #29
0
    $file_content .= '<a href="/traffa/profile.php?id=' . $data['id'] . '" title="' . $data['username'] . $strAge . '">';
    $file_content .= '<img src="' . IMAGE_URL . '/images/users/thumb/' . $data['id'] . '.jpg" style="border: 1px solid #CCCCCC;" /></a>';
    $file_content .= '</td>';
    unset($userAge);
}
$file_content .= '</table>';
$file_content .= '</div><br />';
$file_content .= '<div style="background: #F7F7F7 url(\'/images/klotterplankbgP.png\') repeat-x; border: 1px solid #CCCCCC;">';
$file_content .= '<h2 style="margin: 3px;">Pojkar</h2>';
$sql = 'SELECT login.id, login.username, userinfo.birthday FROM login, userinfo WHERE userinfo.userid = login.id AND userinfo.gender = "m" && (userinfo.image = "1" || userinfo.image = "2") ORDER BY login.lastlogon DESC LIMIT 21';
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
// && userinfo.traffa = "1"
$file_content .= '<table style="width: 100%;"><tr>';
$rowcount = 0;
while ($data = mysql_fetch_assoc($result)) {
    $age = date_get_age($data['birthday']);
    if ($rowcount == 7) {
        $file_content .= '</tr><tr>';
        $rowcount = 1;
    } else {
        $rowcount++;
    }
    if (isset($age)) {
        $strAge = ' (' . $age . ')';
    } else {
        $strAge = '';
    }
    $file_content .= '<td>';
    $file_content .= '<a href="/traffa/profile.php?id=' . $data['id'] . '" title="' . $data['username'] . $strAge . '"><img src="' . IMAGE_URL . '/images/users/thumb/' . $data['id'] . '.jpg" style="border: 1px solid #CCCCCC;" /></a>';
    $file_content .= '</td>';
    unset($userAge);
Example #30
0
 //Main card
 $o .= '<li id="' . $userid . '" class="userbox ' . ($data['gender'] == 'm' ? 'male' : ($data['gender'] == 'f' ? 'female' : 'undefined')) . ' birth' . $birthsplit[0] . ' ' . ' newbox" style="display: none;" onClick="kottmarknad_displayuser(' . $userid . ', \'' . $data['gender'] . '\');">' . "\n";
 $o .= '<p class="username">' . $data['username'] . ' ' . ($data['gender'] == 'm' ? 'P' : 'F') . date_get_age($data['birthday']) . '</p><br />' . "\n";
 $o .= '<img src="' . IMAGE_URL . 'images/users/thumb/' . $userid . '.jpg" height="90" style="float: left; margin: 5px;" />';
 $o .= '<div class="flagcontainer">';
 foreach ($limited_flags as $flag) {
     $o .= $flag != 0 ? '<img src="' . IMAGE_URL . 'user_flags/' . $flags_list[$flag]['handle'] . '.png" /><br />' : '';
 }
 $o .= '</div>' . "\n";
 $o .= '</li>' . "\n";
 //Popup information
 $o .= '<div class="displayuser" id="wnd_' . $userid . '">';
 $genders = array('m' => 'kille', 'f' => 'tjej');
 $o .= '<p><a href="/traffa/profile.php?user_id=' . $userid . '">' . $data['username'] . '</a>';
 $o .= isset($genders[$data['gender']]) ? ', ' . $genders[$data['gender']] : '';
 $o .= $data['birthday'] != '0000-00-00' ? ', ' . date_get_age($data['birthday']) . ' år' : '';
 $o .= !empty($data['spot']) ? ', ' . $data['spot'] : '';
 $o .= '</p>' . "\n";
 $o .= '<img src="' . IMAGE_URL . 'images/users/full/' . $userid . '.jpg" height="265" style="float: left; margin: 5px;" />' . "\n";
 $o .= '<div class="wndflagcontainer">';
 foreach ($flagsplit as $flag) {
     $o .= $flag != 0 ? '<img class="bigflag" src="' . IMAGE_URL . 'user_flags/' . $flags_list[$flag]['handle'] . '.png" alt="' . $flags_list[$flag]['title'] . '" title="' . $flags_list[$flag]['title'] . '" />' : '';
 }
 $o .= '</div>' . "\n";
 $o .= '<form name="kottmarknad_card" id="kottmarknad_card" class="gb_form">' . "\n";
 $o .= '<input type="hidden" name="recipient" value="' . $userid . '" />' . "\n";
 $o .= '<textarea name="message" id="kottmarknad_card_message"></textarea>' . "\n";
 $o .= '<input type="button" class="button_60" value="Skicka" onClick="kottmarknad_sendmessage();" />' . "\n";
 $o .= '</form>' . "\n";
 $o .= '<a style="display: block; position: absolute; bottom: 10px; right: 10px;" href="/traffa/profile.php?user_id=' . $userid . '">Besök profil &raquo;</a>';
 $o .= '</div>' . "\n";