示例#1
0
function list_avatars()
{
    global $hp_url;
    $result = mysql_query('SELECT login.id, login.username, userinfo.gender, userinfo.birthday FROM login, userinfo WHERE login.id = userinfo.userid && image = "1" LIMIT 40');
    if (mysql_num_rows($result) == 0) {
        echo '<br /><br />Hittade inga avatarer som inte validerats.';
    } else {
        echo '<a href="' . $_SERVER['PHP_SELF'] . '?selectall=">Kryssa "Ja" på alla.</a>';
        echo ' | <a onclick="alert(\'Nehejdu :P det går inte ;)\')" style="cursor: pointer;">Döda deras mammor.</a>';
        echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="avatarform">';
        $columns = 0;
        rounded_corners_top();
        echo '<table class="body"><tr>';
        while ($data = mysql_fetch_assoc($result)) {
            if ($data['gender'] == 'F') {
                $bgstyle = 'background: #F7F7F7 url(\'/images/klotterplankbgF.png\') repeat-x;';
            } elseif ($data['gender'] == 'P') {
                $bgstyle = 'background: #F7F7F7 url(\'/images/klotterplankbgP.png\') repeat-x;';
            } else {
                $bgstyle = 'background: #F7F7F7 url(\'/images/klotterplankbg.png\') repeat-x;';
            }
            echo '<td style="' . $bgstyle . ' vertical-align: top;">';
            echo '<a href="' . $hp_url . 'traffa/profile.php?id=' . $data['id'] . '"><b>' . $data['username'] . '</b></a>';
            if ($data['gender'] != NULL) {
                echo ' ' . $data['gender'];
            }
            if ($data['birthday'] != '0000-00-00') {
                $yrsold = floor((time() - strtotime($data['birthday'])) / 31536000);
                echo $yrsold . '';
            }
            echo '<br />';
            echo ui_avatar($data['id']);
            echo '<br />';
            echo '<table><tr>';
            $selected = '';
            if (isset($_GET['selectall'])) {
                $selected = 'checked ';
            }
            echo '<td><input ' . $selected . 'type="radio" name="user' . $data['id'] . '" value="2"></td>';
            echo '<td><input type="radio" name="user' . $data['id'] . '" value="3"></td>';
            echo '<td><input type="radio" name="user' . $data['id'] . '" value="4"></td>';
            echo '</tr><tr>';
            echo '<td style="text-align: center;"><a style="cursor:  pointer;" onclick="document.avatarform.user' . $data['id'] . '[0].checked = true;">Y</a></td>';
            echo '<td style="text-align: center;"><a style="cursor:  pointer;" onclick="document.avatarform.user' . $data['id'] . '[1].checked = true;">N</a></td>';
            echo '<td style="text-align: center;"><a style="cursor:  pointer;" onclick="document.avatarform.user' . $data['id'] . '[2].checked = true;">X</a></td>';
            echo '</tr></table>';
            $columns++;
            if ($columns == 6) {
                echo '</tr><tr>';
                $columns = 0;
            }
            echo '</td>';
        }
        echo '</tr>';
        echo '</table>';
        rounded_corners_bottom();
        echo '<input type="submit" value="Korsfäst!" class="button_80">';
        echo '</form>';
    }
}
示例#2
0
function online_ovs($level)
{
    $query = 'SELECT username, lastaction, id FROM login WHERE userlevel = ' . $level . '';
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        if ($row['lastaction'] > time() - 600) {
            $out .= '<div style="width: 150px; height: 150px; float: left; margin: 0px;">' . "\n";
            $out .= $row['username'] . '<br />';
            $out .= '<span class="online">online</span>' . "\n";
            $out .= ui_avatar($row['id']);
            $out .= '</div>';
        }
    }
}
示例#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 ui_avatar($data['userid']);
        } else {
            echo '<img src="' . IMAGE_URL . '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="/traffa/profile.php?id=' . $data['userid'] . '">' . "\n";
        echo '<b>' . $data['username'] . '</b></a> ' . "\n";
        echo ui_birthday_cake($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
}
示例#4
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;
}
示例#5
0
function echo_sysop_images($params)
{
    if ($params['return_options'] == true) {
        $query = 'SELECT `id`, `username` FROM login WHERE `userlevel` = \'5\' LIMIT 20';
        $result = mysql_query($query);
        while ($row = mysql_fetch_array($result)) {
            $sysop_id = $row["id"];
            $sysop_name = $row["username"];
            $out .= '<option value="' . $sysop_id . '">' . $sysop_name . '</option>';
        }
    } else {
        $out .= '<h1>Våra soeta Sysops</h1>';
        $out .= '<div id="sysops" class="sysops">';
        $out .= rounded_corners_top(array("color" => "blue_deluxe"));
        $out .= '<ul class="rita_img">';
        $query = 'SELECT `id`, `username` FROM login WHERE `userlevel` = \'5\' LIMIT 20';
        $result = mysql_query($query);
        while ($row = mysql_fetch_array($result)) {
            $sysop_id = $row["id"];
            $sysop_name = $row["username"];
            if (file_exists(IMAGE_PATH . 'images/users/thumb/' . $sysop_id . '.jpg')) {
                $out .= '<li class="imgli">';
                $out .= '';
                $out .= ui_avatar($sysop_id);
                $out .= '';
                $out .= '<a href="/traffa/profile.php?user_id=' . $sysop_id . '">' . $sysop_name . '</a>';
                $out .= '</li>';
            } else {
                $out .= '<li class="imgli">';
                $out .= '<a href="/traffa/profile.php?user_id=' . $sysop_id . '">';
                $out .= '<img src="http://images.hamsterpaj.net/tavling/gissa.png" class="user_avatar" />';
                $out .= '</a>';
                $out .= '<a href="/traffa/profile.php?user_id=' . $sysop_id . '">' . $sysop_name . '</a>';
                $out .= '</li>';
            }
        }
    }
    return $out;
}
示例#6
0
function sex_sense_render_posts($posts, $options = array())
{
    foreach ($posts as $post) {
        $out .= sex_sense_bright_container_top();
        $out .= sex_sense_dark_container_top();
        $out .= '<h3 class="sex_sense_post_header" id="header_' . $post['id'] . '">' . $post['title'] . '</h3>' . "\n";
        $out .= sex_sense_dark_container_bottom();
        $out .= '<div class="' . (isset($options['unhide_content']) && $options['unhide_content'] == true ? 'content' : 'hidden_content') . '" id="content_' . $post['id'] . '">';
        $out .= '<p>' . nl2br($post['question']) . '</p>' . "\n";
        foreach ($post['answers'] as $answer) {
            $out .= ui_avatar($answer['user_id']);
            $out .= sex_sense_bubble_top();
            $out .= '<h4>' . $answer['username'] . ' svarar:</h4>' . "\n";
            $out .= '<p>' . nl2br($answer['answer']);
            $out .= is_privilegied('sex_sense_admin') ? '<br /><a href="/sex_och_sinne/aendra_svar.php?id=' . $answer['id'] . '">Ändra svar.</a>' : '';
            $out .= '</p>' . "\n";
            $out .= sex_sense_bubble_bottom();
        }
        $direct_link = '/sex_och_sinne/';
        $categories = sex_sense_fetch_categories(array('category_id' => $post['category_id']));
        foreach ($categories as $category_tree) {
            $category = array_pop($category_tree);
            $direct_link .= $category['category_handle'] . '/';
        }
        $direct_link .= $post['handle'] . '.html';
        $out .= '<button class="button_80" onclick="window.location=\'' . $direct_link . '\';">Direktlänk</button>' . "\n";
        if ($post['forum_post_id'] != 0) {
            $thread_url = forum_get_url_by_post($post['forum_post_id']);
            $out .= '<button class="button_140" onclick="window.location=\'' . $thread_url . '\';">Diskutera i forumet</button>' . "\n";
        }
        $out .= is_privilegied('sex_sense_admin') ? '<br /><a href="/sex_och_sinne/admin.php?id=' . $post['id'] . '">Ändra fråga/lägg till svar &raquo;</a>' : '';
        $out .= '<div style="clear: both; height: 5px;"></div>' . "\n";
        $out .= '</div>';
        $out .= sex_sense_bright_container_bottom();
        $closed_content++;
    }
    return $out;
}
示例#7
0
function online_ovs2()
{
    $ul = $_SESSION['login']['userlevel'];
    //$ul = 1;
    //$userlevel_fetch = ($level == 3) ? "userlevel = 3 OR userlevel = 4" : "userlevel = 5";
    $userlevel_fetch = "userlevel >= 3";
    $query = query_cache(array('query' => 'SELECT userlevel, id, username, lastaction FROM login WHERE ' . $userlevel_fetch . ' ORDER BY lastaction DESC'));
    $out .= '<div class="ovlist">
		<ul>';
    foreach ($query as $row) {
        if ($row['lastaction'] > time() - 600) {
            $ov_ul = $row['userlevel'];
            switch ($ov_ul) {
                case 3:
                    $ov_ul_in_swedish = "Ordningsvakt";
                    break;
                case 4:
                    $ov_ul_in_swedish = "Administratör";
                    break;
                case 5:
                    $ov_ul_in_swedish = "Sysop";
                    break;
            }
            $out .= '<li>' . "\n";
            $out .= ui_avatar($row['id']);
            $out .= '<a href="/traffa/guestbook.php?view=' . $row['id'] . '">' . $row['username'] . '</a><br />';
            $out .= $ov_ul_in_swedish . '<br />';
            //$out .= '<span style="color: #008f00;">online</span>' . "\n";
            $out .= '</li>';
            $many[] = $row['id'];
        }
    }
    $out .= '</ul>
		<br style="clear: both;" />
		</div>';
    return $out;
}
示例#8
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;
}
示例#9
0
文件: index.php 项目: Rojk/hamsterpaj
     $out .= '</div>' . "\n";
 } else {
     $out .= '<div id="radio_sending_inactive">' . "\n";
     // Displays "Ingen sändning
     $out .= '</div>' . "\n";
 }
 $options['broadcasting'] = false;
 // It shouldn't be broadcasting right now
 $options['limit'] = 1;
 // We only want the coming one
 $options['order-direction'] = 'ASC';
 // We want the coming one
 $radio_next_program = radio_schedule_fetch($options);
 if (isset($radio_next_program[0])) {
     $out .= '<div id="radio_next_program">' . "\n";
     $out .= ui_avatar($radio_next_program[0]['user_id']) . "\n";
     $out .= '<div class="radio_about">' . "\n";
     $out .= '<h2>' . $radio_next_program[0]['name'] . '</h2>' . "\n";
     $out .= '<strong>DJ: ' . $radio_next_program[0]['username'] . '</strong><br />' . "\n";
     $out .= '<span>' . $radio_next_program[0]['sendtime'] . '</span>' . "\n";
     $out .= '</div>' . "\n";
     $out .= '</div>' . "\n";
 } else {
     $out .= '<div id="radio_next_program_inactive">' . "\n";
     // Displays a "Inget inplanerat" box
     $out .= '</div>' . "\n";
 }
 $out .= '<br style="clear: both;" />' . "\n";
 if ($radio_server_problems === true) {
     $out .= '<div class="form_notice_error">Något verkar vara fel med servern, vi jobbar på felet och skyller det på Heggan.</div>' . "\n";
 }
示例#10
0
function message_top($options)
{
    if (!isset($options['type'])) {
        $options['type'] = 'standard';
    }
    $content = '<li class="message">' . "\n";
    $content .= '<div class="' . $options['type'] . '">' . "\n";
    $content .= ui_avatar($options['user_id']) . "\n";
    $content .= '<div class="container">' . "\n";
    $content .= '<div class="top_bg">' . "\n";
    $content .= '<div class="bottom_bg">' . "\n";
    $content .= '<div>' . "\n";
    return $content;
}
function christmas_avatar_draw_result($options)
{
    $output = '';
    $poll_list = array();
    $total_votes = 0;
    $options['poll_id'] = isset($options['poll_id']) ? intval($options['poll_id']) : 0;
    $query_title = 'SELECT poll_title FROM christmas_avatars_polls WHERE poll_id = ' . $options['poll_id'] . ' AND is_removed = 0 LIMIT 1';
    $result_title = mysql_query($query_title) or report_sql_error($query_title, __FILE__, __LINE__);
    $data_title = mysql_fetch_assoc($result_title);
    //fetch contenders
    $query = 'SELECT c.id AS contender_id, c.contender AS contender_uid, l.username FROM christmas_avatars_contenders AS c, login AS l WHERE c.parent_poll = ' . $options['poll_id'] . ' AND l.id = c.contender AND c.is_removed = 0';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    $number_of_contenders = mysql_num_rows($result);
    if ($number_of_contenders > 0) {
        while ($data = mysql_fetch_assoc($result)) {
            $query_votes = 'SELECT NULL FROM christmas_avatars_votes AS v WHERE v.poll_id = ' . $options['poll_id'] . ' AND v.contender_id = ' . $data['contender_id'] . ' AND v.voter != 0 AND v.is_removed = 0';
            $result_votes = mysql_query($query_votes) or report_sql_error($query_votes, __FILE__, __LINE__);
            $contenders_votes = mysql_num_rows($result_votes);
            $poll_list[] = array('votes' => $contenders_votes, 'contender' => $data['contender_uid'], 'username' => $data['username']);
            $total_votes += $contenders_votes;
        }
        $output .= '<h2 id="poll_' . $options['poll_id'] . '">Resultat för ' . $data_title['poll_title'] . ' - ' . $total_votes . ' röst' . ($total_votes == 1 ? '' : 'er') . '</h2>' . "\n";
        if ($total_votes > 0) {
            foreach ($poll_list as $contender) {
                $per_cent = round($contender['votes'] / $total_votes * 100, 2);
                $output .= '<a href="/traffa/profile.php?user_id=' . $contender['contender'] . '">' . $contender['username'] . '</a>' . "\n";
                $output .= '<br />' . "\n";
                $output .= ui_avatar($contender['contender'], array('style' => 'height: 67;width: 50.25px')) . "\n";
                $output .= '<div class="box">' . "\n";
                $output .= '<div class="bar" title="' . $per_cent . '"></div>' . "\n";
                $output .= '</div>' . "\n";
                $output .= '<br />' . "\n";
            }
        } else {
            $output .= 'Inga har röstat!';
        }
    } else {
        $output .= 'Inga deltagare!';
    }
    return $output;
}
示例#12
0
    $query .= 'AND' . $agequery_start . ' AND ' . $agequery_end . 'AND userinfo.birthday <> 0000-00-00';
    $query .= ' AND userinfo.gender != "' . $_SESSION['userinfo']['gender'] . '"';
    $query .= ' AND userinfo.gender != "u"';
    $query .= ' AND userinfo.gender != ""';
    $query .= ' AND (userinfo.image = 1 OR userinfo.image = 2)';
    $query .= ' ORDER BY login.lastaction DESC LIMIT 0, 16';
    $result = mysql_query($query) or die(report_sql_error($query));
    // Let's show the result to the user
    $out .= '<h2>Resultat</h2>';
    if (mysql_num_rows($result) > 0) {
        $out .= 'Hittade en hel bunt med folk som passade in på din sökning! <br /><br />';
        while ($data = mysql_fetch_assoc($result)) {
            if ($data['gender'] == 'f') {
                $out .= '<div class="search_userbox girl">';
            } elseif ($data['gender'] == 'm') {
                $out .= '<div class="search_userbox boy">';
            } else {
                $out .= '<div class="search_userbox">';
            }
            $out .= ui_avatar($data['userid']);
            $out .= '<br />' . "\n";
            $out .= '<a href="/traffa/profile.php?user_id=' . $data['userid'] . '">' . $data['username'] . '  ' . $data['gender'] . date_get_age($data['birthday']) . '</a>' . "\n";
            $out .= '</div>' . "\n";
        }
    } else {
        $out .= 'Tyvärr hittades ingen som matchade din sökning :(';
    }
}
ui_top($ui_options);
echo $out;
ui_bottom();
<?php

global $photoblog_user;
$options['output'] .= ui_avatar($photoblog_user['id']);
$options['output'] .= '<h3><a href="/traffa/profile.php?user_id=' . $photoblog_user['id'] . '">' . $photoblog_user['username'] . '</a></h3>' . "\n";
$options['output'] .= '<br /><span><a href="/traffa/profile.php?user_id=' . $photoblog_user['id'] . '">Gå till presentation &raquo;</a></span>' . "\n";
示例#14
0
$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();
//	echo '</tr></table>';
ui_bottom();
示例#15
0
			alert(\'Men fy på dig, du måste läsa reglerna igen ordentligt!\');
			return false;
		}
	}
</script>
<input name="submit" type="submit" value="Ladda upp" onclick="return verify_checkboxes();" class="button_80" />';
    if (isset($_GET['registerproccess'])) {
        $out .= '<input type="hidden" name="registerproccess" value="1" />
	<br /><br />
	<input type="button" class="button" value="Nej tack, jag vill inte ladda upp en bild &raquo;"	onclick="location.href=\'/register.php?nextstep=3\'">';
    }
    $out .= '</form>';
    $avatar_full_filename = $avatar_path_full . $_SESSION['login']['id'] . '.jpg';
    if (is_file($avatar_full_filename)) {
        $out .= '<h2 style="margin: 0px; ">Din nuvarande bild:</h2>';
        $out .= ui_avatar($_SESSION['login']['id'], array('style' => 'border: 1px solid #333333'));
        $out .= '<br /><b><a href="' . $_SERVER['PHP_SELF'] . '?action=delete">» Ta bort bilden</a></b>';
    }
} elseif ($_GET['step'] == '2') {
    if (!is_file($avatar_tmp_orginal_filename)) {
        jscript_alert('Någonting blev fel vid uppladdningen av bilden, försök igen!');
        jscript_go_back();
        die;
    }
    $copy_data = read_copy_protection($avatar_tmp_orginal_filename);
    if ($copy_data['copyright'] == 1 && $_SESSION['login']['id'] != $copy_data['userid']) {
        jscript_alert('Den gubben gick inte');
        jscript_go_back();
        die;
    }
    $avatar_height = intval(exec('identify ' . $avatar_tmp_orginal_filename . ' | cut -f3 -d" " | cut -f2 -d"x" | cut -f1 -d"+"'));
示例#16
0
function group_list_messages($options)
{
    $groupid = $options['group_id'];
    /* Fetch the total messages in group */
    $selectquery = 'SELECT message_count AS total, owner FROM groups_list WHERE groupid = ' . $groupid;
    $result = mysql_query($selectquery) or die(report_sql_error($selectquery));
    $data = mysql_fetch_assoc($result);
    $total_msg = $data['total'];
    $new_messages = $data['total'];
    /* Get the group owner */
    $owner = $data['owner'];
    /* Fetch read_msg for this user */
    $selectquery = 'SELECT read_msg AS total_read FROM groups_members WHERE groupid = ' . $groupid . ' AND userid = ' . $_SESSION['login']['id'];
    $result = mysql_query($selectquery) or die(report_sql_error($selectquery));
    $data = mysql_fetch_assoc($result);
    $query = 'UPDATE groups_members SET read_msg = ' . $total_msg . ' WHERE userid = ' . $_SESSION['login']['id'] . ' AND groupid = ' . $groupid;
    mysql_query($query) or die(report_sql_error($query));
    $_SESSION['cache']['groups_notices'][$groupid]['unread_messages'] = 0;
    $new_messages = $new_messages - $data['total_read'];
    /* Update the read_msg */
    $query = 'SELECT login.username, groups_scribble.userid, groups_scribble.timestamp, groups_scribble.text, groups_scribble.id, userinfo.image, userinfo.birthday FROM login, groups_scribble, userinfo WHERE login.id = groups_scribble.userid AND groups_scribble.groupid = ' . $groupid . ' AND userinfo.userid = groups_scribble.userid AND groups_scribble.deleted = 0 ORDER BY groups_scribble.id DESC LIMIT ' . ($options['page'] - 1) * 100 . ', 100';
    //Lef hackar via råd från heggan. Maskroskisseporr ska inte synas för hennes söta ögon.
    if ($_SESSION['login']['id'] == '148153') {
        /* Fetch the total messages in group */
        $query = 'SELECT login.username, groups_scribble.userid, groups_scribble.timestamp, groups_scribble.text, groups_scribble.id, userinfo.image, userinfo.birthday FROM login, groups_scribble, userinfo WHERE groups_scribble.text NOT LIKE "%maskrosp0rn%" AND login.id = groups_scribble.userid AND groups_scribble.groupid = ' . $groupid . ' AND userinfo.userid = groups_scribble.userid AND groups_scribble.deleted = 0 ORDER BY groups_scribble.id DESC LIMIT ' . ($options['page'] - 1) * 100 . ', 100';
    }
    //Död åt lef
    $result = mysql_query($query) or die(report_sql_error($query));
    /* $count_read - Hur många msg har gruppen 	*/
    $count_read = 0;
    while ($data = mysql_fetch_assoc($result)) {
        for ($i = 0; $i < count($surveys); $i++) {
            if ($surveys[$i]['start_time'] >= $data['timestamp']) {
                echo survey_draw_frame($surveys[$i]);
                unset($surveys[$i]);
            }
        }
        $div_code = $count_read < $new_messages ? 'orange' : 'blue';
        if (preg_match("/(" . $_SESSION['login']['username'] . "|Magic word: igotgodmodeigotgubbmode)/i", $data['text'])) {
            $div_code = 'orange_deluxe';
        }
        echo rounded_corners_top(array('color' => $div_code));
        echo '<table class="body" style="width: 95%;"><tr><td style="vertical-align: top; width: 75px;">';
        if ($data['image'] == 1 || $data['image'] == 2) {
            echo ui_avatar($data['userid']);
        } else {
            echo '<img src="' . IMAGE_URL . 'user_no_image.png" alt="Ingen visningsbild"/>';
        }
        echo '</td><td style="vertical-align: top;">';
        echo fix_time($data['timestamp']) . ' <a href="javascript:void(0);" onclick="javascript:document.postform.group_message.value=document.postform.group_message.value + \'' . $data['username'] . ': \';document.postform.group_message.focus();">[^]</a><br/>';
        echo '<a href="/traffa/profile.php?id=' . $data['userid'] . '">';
        echo '<b>' . ($data['userid'] == 43273 ? '<span style="color: #FF60B6">GheyAtrapp</span>' : $data['username']) . '</b></a> ';
        if ($owner == $_SESSION['login']['id'] || is_privilegied('groups_superadmin')) {
            echo '<a href="' . $_SERVER['PHP_SELF'] . '?action=remove_post&amp;groupid=' . $groupid . '&amp;postid=' . $data['id'] . '" onclick="return confirm(\'Vill du verkligen ta bort posten?\')">[Ta bort]</a>';
        }
        echo ui_birthday_cake($data['birthday']) . ' ';
        echo '<br/>';
        echo setSmilies(discussion_forum_parse_output($data['text']));
        echo '</td></tr></table>';
        echo rounded_corners_bottom(array('color' => $div_code));
        $count_read++;
    }
}
示例#17
0
文件: index.php 项目: Rojk/hamsterpaj
function tests_get_last_test_completers($options)
{
    if (!isset($options['test_id'], $options['limit'])) {
        return 'tests_get_last_test_completers - Not enough parameters...';
    }
    if (!is_numeric($options['test_id']) || !is_numeric($options['limit'])) {
        return 'Wrong parameter format for tests_get_last_test_completers.';
    }
    $query = 'SELECT tus.score AS score, l.id AS userid, l.username AS username, u.image AS image';
    $query .= ' FROM tests_user_score AS tus, login AS l, userinfo AS u';
    $query .= ' WHERE tus.test_id = ' . $options['test_id'] . ' AND tus.user_id = l.id AND u.userid = l.id';
    $query .= ' ORDER BY tus.timestamp DESC';
    $query .= ' LIMIT ' . $options['limit'];
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    $return = mysql_num_rows($result) > 0 ? '' : 'Ingen inloggad användare har gjort testet ännu!';
    while ($data = mysql_fetch_assoc($result)) {
        $return .= '<div class="tests_completer">';
        $return .= '<h3>' . $data['score'] . ' poäng</h3>' . "\n";
        $return .= '<a href="/traffa/profile.php?id=' . $data['userid'] . '">' . ucfirst($data['username']) . '</a><br />' . "\n";
        $return .= ui_avatar($data['userid'], array('style' => 'border: 1px solid #cccccc')) . '<br />' . "\n";
        $return .= '</div>';
    }
    return $return;
}
示例#18
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;
}
示例#19
0
function photoblog_comments_form($options)
{
    $out .= '<div id="photoblog_comments_form">' . "\n";
    $out .= '<ul>' . "\n";
    $out .= '<li class="photoblog_comment">' . "\n";
    $out .= '<div class="photoblog_comment_userinfo">' . "\n";
    $avatar_options['show_nothing'] = true;
    $out .= ui_avatar($_SESSION['login']['id'], $avatar_options);
    $out .= '</div>' . "\n";
    $out .= '<div class="photoblog_comment_bubble_pointer">' . "\n";
    $out .= '<div class="photoblog_comment_text">' . "\n";
    $out .= '<form action="#" method="post">' . "\n";
    $out .= '<p>' . "\n";
    $out .= '<textarea name="comment">Skriv en kommentar... (Ska försvinna automagiskt *skrika på iPhone*) Och om man inte är inloggad ska man få upp en såndär söt tiny register ruta.</textarea>' . "\n";
    $out .= '<br />' . "\n";
    $out .= '<input class="submit" type="submit" value="Skicka" />' . "\n";
    $out .= '</p>' . "\n";
    $out .= '</form>' . "\n";
    $out .= '</div' . "\n";
    $out .= '</div>' . "\n";
    $out .= '<br style="clear: both;" />' . "\n";
    $out .= '</li>' . "\n";
    $out .= '</ul>';
    $out .= '</div>' . "\n";
    return $out;
}
示例#20
0
function traffa_draw_user_div($userid, $info = null)
{
    /* If you already have information from the database, please pass it on in the $info
    	   parameter. The information should be formatted like this:
    	   $info['login']['username'] = '******';
    	   $info['userinfo']['birthday'] = '1970-01-01';
    	   Note that it isn't necessary to have complete info, the script will fetch all info
    	   not sent.
    	   Please note that this function returns all the data used, you may use it further in your script.
    	   Return will look like this:
    	   $return['status'] = 'success'/'fail';
    	   $return['reason'] = null or error explanation.
    	   $return['login']['lastaction'] = 118371272;
    	*/
    /* $info is unset further down and the snyggve-info isn't fetched in this function. */
    if ($info['snyggve'] == 1) {
        $snyggve = 1;
    }
    if ($userid < 1) {
        to_logfile('error', __FILE__, __LINE__, 'traffa_draw_user_div() was called without userid', print_r(debug_backtrace(), true));
    }
    $fetch['login'] = array('username', 'lastaction', 'lastrealaction', 'lastlogon', 'regtimestamp', 'userlevel');
    $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'zip_code', 'image', 'current_action', 'cell_phone', 'user_status');
    $fetch['traffa'] = array('firstname', 'color_theme');
    $fetch['preferences'] = array('activate_current_action');
    /* Remove already known fields from the fetch array */
    foreach ($info as $table) {
        foreach ($table as $row) {
            unset($fetch[$table][$row]);
        }
    }
    $userinfo = login_load_user_data($userid, $fetch);
    if (!is_array($userinfo)) {
        to_logfile('error', 'userinfo was not an array, as expected.', __FILE__, __LINE__);
        die('<p class="error">Ett internt fel orsakades. Visningen av sidan har stoppats och hamsterpajs utvecklingsavdelning har underrättats.</p>');
    }
    /* Inject already known fields to the userinfo array */
    foreach ($info as $table) {
        foreach ($table as $row) {
            $userinfo[$table][$row] = $info[$table][$row];
        }
    }
    unset($info);
    switch ($userinfo['traffa']['color_theme']) {
        case '1':
            $profile_colors['light'] = '#edf4fd';
            $profile_colors['background'] = '#c9ddf9';
            $profile_colors['dark'] = '#7ba0cf';
            $profile_colors['border'] = '#3f5879';
            break;
        case '2':
            $profile_colors['light'] = '#f1edfd';
            $profile_colors['background'] = '#d1c9f9';
            $profile_colors['dark'] = '#897bcf';
            $profile_colors['border'] = '#493f79';
            break;
        case '3':
            $profile_colors['light'] = '#faedfd';
            $profile_colors['background'] = '#efc9f9';
            $profile_colors['dark'] = '#bb7bcf';
            $profile_colors['border'] = '#6b3f79';
            break;
        case '4':
            $profile_colors['light'] = '#fdedf7';
            $profile_colors['background'] = '#f9c9e7';
            $profile_colors['dark'] = '#cf7bb0';
            $profile_colors['border'] = '#793f64';
            break;
        case '5':
            $profile_colors['light'] = '#fdeeed';
            $profile_colors['background'] = '#f9c9c9';
            $profile_colors['dark'] = '#cf7b7d';
            $profile_colors['border'] = '#793f40';
            break;
        case '6':
            $profile_colors['light'] = '#fdf7ed';
            $profile_colors['background'] = '#f9e6c9';
            $profile_colors['dark'] = '#cfaa7b';
            $profile_colors['border'] = '#79603f';
            break;
        case '7':
            $profile_colors['light'] = '#fafded';
            $profile_colors['background'] = '#f0f9c9';
            $profile_colors['dark'] = '#c1cf7b';
            $profile_colors['border'] = '#6f793f';
            break;
        case '8':
            $profile_colors['light'] = '#f0fded';
            $profile_colors['background'] = '#d4f9c9';
            $profile_colors['dark'] = '#8dcf7b';
            $profile_colors['border'] = '#4b793f';
            break;
        case '9':
            $profile_colors['light'] = '#edfdf4';
            $profile_colors['background'] = '#c9f9dc';
            $profile_colors['dark'] = '#7bcf9a';
            $profile_colors['border'] = '#3f7954';
            break;
        case '10':
            $profile_colors['light'] = '#edfdfd';
            $profile_colors['background'] = '#c9f9f8';
            $profile_colors['dark'] = '#7bcfcd';
            $profile_colors['border'] = '#3f7978';
            break;
        default:
            $profile_colors['light'] = '#edf4fd';
            $profile_colors['background'] = '#c9ddf9';
            $profile_colors['dark'] = '#7ba0cf';
            $profile_colors['border'] = '#3f5879';
            break;
    }
    if ($userinfo['userinfo']['image'] == 1 || $userinfo['userinfo']['image'] == 2) {
        $image_code = ui_avatar($userid, array('style' => 'float: left; margin: 5px; border: 1px solid #3f657a;'));
    } elseif ($userid == $_SESSION['login']['id']) {
        $image_code = '<div class="avatar" style="float: left;"><img src="http://images.hamsterpaj.net/images/noimage.png" /><input type="button" class="button" value="Fixa bild" onclick="window.location=\'/avatar-settings.php\';" /></div>' . "\n";
    } else {
        $image_code = '<img src="http://images.hamsterpaj.net/images/noimage.png" class="avatar" style="float: left; margin: 5px;" />';
    }
    $gender = '';
    if ($userinfo['userinfo']['gender'] == 'm') {
        $gender = 'pojke ';
    } elseif ($userinfo['userinfo']['gender'] == 'f') {
        $gender = 'flicka ';
    }
    $location = strlen($userinfo['userinfo']['geo_location']) > 0 ? 'från ' . $userinfo['userinfo']['geo_location'] : '';
    if ($_SESSION['userinfo']['x_rt90'] > 0 && $userinfo['userinfo']['x_rt90'] > 0 && $userinfo['userinfo']['zip_code'] != $_SESSION['userinfo']['zip_code']) {
        $location .= ', ' . rt90_readable(rt90_distance($_SESSION['userinfo']['x_rt90'], $_SESSION['userinfo']['y_rt90'], $userinfo['userinfo']['x_rt90'], $userinfo['userinfo']['y_rt90']));
    }
    if ($userinfo['userinfo']['x_rt90'] > 0) {
        /* Note RT90 Y and X values are flipped, due to a "bug" at hitta.se */
        /* Reference: daniel.eklund@hitta.se */
        $hittapunktse_url = 'http://www.hitta.se/LargeMap.aspx?ShowSatellite=false&pointX=' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url .= '&pointY=' . $userinfo['userinfo']['x_rt90'] . '&z=4&name=' . $userinfo['login']['username'];
        $hittapunktse_url .= '&cy=' . $userinfo['userinfo']['x_rt90'] . '&cx' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url = 'http://www.hitta.se/LargeMap.aspx?ShowSatellite=false&pointX=' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url .= '&pointY=' . $userinfo['userinfo']['x_rt90'] . '&cx=' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url .= '&cy=' . $userinfo['userinfo']['x_rt90'] . '&z=6&name=' . $userinfo['login']['username'];
        $location_button = '<input type="button" value="Visa på karta" class="button_90" onclick="';
        $location_button .= "window.open('{$hittapunktse_url}', 'user_map_{$userid}', 'location=false, width=750, height=500');";
        $location_button .= '" style="float: right;"/>' . "\n";
    }
    if ($userid == 20702) {
        $location = 'från Internet ';
    }
    $age = '';
    if ($userinfo['userinfo']['birthday'] != '0000-00-00') {
        $age = date_get_age($userinfo['userinfo']['birthday']) . ' år ';
    }
    $status = login_onlinestatus($userinfo['login']['lastaction'], $userinfo['login']['lastrealaction']);
    //	$onlinestatus = '<span style="color: grey;">Offline</span>';
    //	$onlinestatus = '<span style="font-size: 14px;">Loggade senast in ' . fix_time($userinfo['login']['lastlogon']) . '</span>' . "\n";
    switch ($status['handle']) {
        case 'offline':
            if ($userinfo['login']['lastrealaction'] == 0) {
                $onlinestatus = '<span style="font-size: 14px;">Sågs senast ' . fix_time($userinfo['login']['lastlogon']) . '</span>' . "\n";
            } else {
                $onlinestatus = '<span style="font-size: 14px;">Sågs senast ' . fix_time($userinfo['login']['lastrealaction']) . '</span>' . "\n";
            }
            break;
        case 'online':
            $hours = floor(($userinfo['login']['lastaction'] - $userinfo['login']['lastlogon']) / 3600);
            $minutes = floor(($userinfo['login']['lastaction'] - $userinfo['login']['lastlogon'] - $hours * 3600) / 60);
            $onlinestatus = '<span style="color: green; font-size: 14px;">Online </span><span style="font-size: 14px;"> sedan ';
            $onlinestatus .= $hours > 0 ? $hours . ' timmar och ' : null;
            $onlinestatus .= $minutes . ' minuter</span>';
            break;
        case 'idle':
            $onlinestatus = $status['label'] . ' sedan ' . date('H:i', $userinfo['login']['lastrealaction']);
            break;
    }
    $contact1 = strlen($userinfo['userinfo']['contact1']) > 0 ? parseContact($userinfo['userinfo']['contact1']) : array('label' => 'Kontaktsätt', 'link' => '-');
    $contact2 = strlen($userinfo['userinfo']['contact2']) > 0 ? parseContact($userinfo['userinfo']['contact2']) : array('label' => 'Kontaktsätt', 'link' => '-');
    $firstname = strlen($userinfo['traffa']['firstname']) > 0 ? $userinfo['traffa']['firstname'] : '-';
    $right_now = strlen($userinfo['userinfo']['current_action']) > 0 ? $userinfo['userinfo']['current_action'] : 'Okänt';
    if ($userinfo['login']['lastlogon'] > strtotime(date('Y-m-d'))) {
        $lastlogon = 'Idag ' . date('H:i', $userinfo['login']['lastlogon']);
    } elseif ($userinfo['login']['lastlogon'] > strtotime(date('Y-m-d')) - 86400) {
        $lastlogon = 'Igår ' . date('H:i', $userinfo['login']['lastlogon']);
    } elseif ($userinfo['login']['lastlogon'] > strtotime(date('Y-m-d')) - 518400) {
        $weekdays = array('Söndags', 'Måndags', 'Tisdags', 'Onsdags', 'Torsdags', 'Fredags', 'Lördags');
        $lastlogon = 'I ' . $weekdays[date('w', $userinfo['login']['lastlogon'])] . ' klockan ' . date('H:i', $userinfo['login']['lastlogon']);
    } else {
        $lastlogon = date('Y-m-d H:i', $userinfo['login']['lastlogon']);
    }
    echo '<div style="height: 120px; margin: -3px; margin-bottom: 3px; background: ' . $profile_colors['background'] . '; border-bottom: 1px solid ' . $profile_colors['border'] . '; padding: 3px;">' . "\n";
    if (strlen($userinfo['userinfo']['user_status']) > 0) {
        echo '<h3>' . $userinfo['userinfo']['user_status'] . '</h3>' . "\n";
    }
    echo $image_code . "\n";
    echo '<div style="width: 545px; float: left;">' . "\n";
    echo '<div style="background: white;">' . "\n";
    echo '<h2 style="margin: 0px; font-size: 19px;">' . $userinfo['login']['username'] . ' - ' . $gender . $age . $location . $location_button . '</h2>' . "\n";
    echo '<h3>' . $onlinestatus . '</h3>' . "\n";
    echo '</div>' . "\n";
    echo '<div style="width: 400px;">' . "\n";
    echo '<div style="float: left; clear: right; width: 50%;"><span style="font-weight: bold;">Förnamn</span><br />' . $firstname . '</div>';
    echo '<div style="float: left; clear: right; width: 50%;"><span style="font-weight: bold;">Blev medlem: </span><br/> ' . date('Y-m-d', $userinfo['login']['regtimestamp']) . '</div><br />' . "\n";
    echo '<div style="float: left; clear: both; width: 50%;"><span style="font-weight: bold;">' . $contact1['label'] . '</span><br />' . $contact1['link'] . '</div>' . "\n";
    echo '<div style="float: left; clear: right; width: 50%;"><span style="font-weight: bold;">' . $contact2['label'] . '</span><br />' . $contact2['link'] . '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '<div style="margin: -3px; border-bottom: 1px solid ' . $profile_colors['border'] . '; background: ' . $profile_colors['dark'] . '; height: 25px; font-weight: bold; color: white;">' . "\n";
    $links[] = array('width' => 95, 'label' => 'Presentation', 'uri' => '/traffa/profile.php?id=' . $userid);
    $links[] = array('width' => 85, 'label' => 'Gästbok', 'uri' => '/traffa/guestbook.php?view=' . $userid);
    if ($_SESSION['login']['id'] == $userid) {
        $links[] = array('width' => 150, 'label' => 'Mina meddelanden', 'uri' => '/traffa/messages.php');
        $links[] = array('width' => 100, 'label' => 'Mina besök', 'uri' => '/traffa/my_visitors_joel.php');
    } else {
        $links[] = array('width' => 185, 'label' => 'Skicka privatmeddelande', 'uri' => '/traffa/messages.php?action=compose&amp;recipient_username='******'login']['username'] . '&amp;recipient_id=' . $userid);
    }
    foreach ($links as $current) {
        echo '<div style="float: left; width: ' . $current['width'] . 'px; line-height: 25px; border-right: 1px solid #3f657a; height: 25px; text-align: center;"><a href="' . $current['uri'] . '" style="color: white;">' . $current['label'] . '</a></div>' . "\n";
    }
    if ($userid != $_SESSION['login']['id'] && login_checklogin()) {
        echo '<input type="button" class="button_80" style="float: right; margin-right: 5px; margin-top: 3px;" value="Kompis" onclick="window.open(\'/traffa/friends_popup.php?user_id=' . $userid . '\', \'cpinternetexplorer\', \'location=no, width=200, height=100\');" />' . "\n";
        echo '<input type="button" class="button_100" style="float: right; margin-right: 5px; margin-top: 3px;" value="Rapportera" onclick="abuse_report(\'user\', ' . $userid . ');" />' . "\n";
    }
    if ($_SERVER['REQUEST_URI'] == '/traffa/my_visitors.php') {
        treasure_item(9);
    }
    echo '</div>' . "\n";
}
示例#21
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__));
    }
}
示例#22
0
function photoblog_comments_form($options)
{
    $out .= '<div id="photoblog_comments_form">' . "\n";
    $out .= '<ul>' . "\n";
    $out .= '<li class="photoblog_comment">' . "\n";
    $out .= '<div class="photoblog_comment_userinfo">' . "\n";
    $avatar_options['show_nothing'] = true;
    $out .= ui_avatar($_SESSION['login']['id'], $avatar_options);
    $out .= '</div>' . "\n";
    $out .= '<div class="photoblog_comment_bubble_pointer">' . "\n";
    $out .= '<div class="photoblog_comment_text">' . "\n";
    $out .= '<form action="#" method="post">' . "\n";
    $out .= '<p>' . "\n";
    $out .= '<textarea name="comment">Kommentar</textarea>' . "\n";
    $out .= '<br />' . "\n";
    $out .= '<input class="submit" type="submit" value="Skicka" />' . "\n";
    $out .= '</p>' . "\n";
    $out .= '</form>' . "\n";
    $out .= '</div>' . "\n";
    $out .= '</div>' . "\n";
    $out .= '<br style="clear: both;" />' . "\n";
    $out .= '</li>' . "\n";
    $out .= '</ul>';
    $out .= '</div>' . "\n";
    return $out;
}
示例#23
0
     $categories = array_pop(sex_sense_fetch_categories(array('parent_category' => 0)));
     foreach ($categories as $category) {
         $out .= '<optgroup label="' . $category['category_title'] . '">' . "\n";
         $child_categories = array_pop(sex_sense_fetch_categories(array('parent_category' => $category['category_id'])));
         foreach ($child_categories as $child_category) {
             $selected = $question['category'] == $child_category['category_id'] ? ' selected="selected"' : '';
             $out .= "\t" . '<option value="' . $child_category['category_id'] . '"' . $selected . '>' . $child_category['category_title'] . '</option>' . "\n";
         }
         $out .= '</optgroup>' . "\n";
     }
     $out .= '</select>';
     $out .= '</h3>' . "\n";
     $out .= sex_sense_dark_container_bottom();
     $out .= '<textarea name="question" style="width: 550px; height: 200px;">' . $question['question'] . '</textarea><br style="clear: both;" />' . "\n";
     foreach ($question['answers'] as $answer) {
         $out .= ui_avatar($answer['user_id']);
         $out .= sex_sense_bubble_top();
         $out .= '<h4>' . $answer['username'] . ' svarar:</h4>' . "\n";
         $out .= '<p>' . nl2br($answer['answer']) . '</p>' . "\n";
         $out .= sex_sense_bubble_bottom();
     }
     $out .= '<input type="hidden" name="answer_to" value="' . $question['id'] . '" />' . "\n";
     $out .= '<label for="answer">Svara på frågan: <strong>Detta fält måste fyllas i, annars går saker sönder.</strong></label>' . "\n";
     $out .= '<textarea name="answer" style="width: 550px; height: 200px;">' . "\n";
     $out .= '</textarea>' . "\n";
     $out .= '<br /><input type="submit" value="Skicka" onclick="return checkChosenCategory()" class="button_60" />' . "\n";
     $out .= '<a onclick="checkChosenCategory()">LOOOL</a>' . "\n";
     $out .= '</form>' . "\n";
     $out .= '<div style="clear: both; height: 5px;"></div>' . "\n";
     $out .= sex_sense_bright_container_bottom();
 }
示例#24
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;
}
示例#25
0
 echo '<h1>Ordningsvakter och deras adresser mm</h1>' . "\n";
 echo '<table>' . "\n";
 echo '<tr>' . "\n";
 foreach ($keys_1 as $key => $label) {
     echo '<td>' . $label . '</td>' . "\n";
 }
 echo '</tr>' . "\n";
 foreach ($ovs as $ov) {
     $zebra = $zebra == true ? false : true;
     if ($ov['visible_level'] == 0) {
         $ov['visible_level'] = 5;
     }
     if ($ov['visible_level'] <= $_SESSION['login']['userlevel']) {
         $out = $zebra ? '<tr style="background: #EEF">' : '<tr>';
         echo $out;
         echo '<td rowspan="2">' . ui_avatar($ov['user_id']) . '</td>';
         foreach ($keys_1 as $key => $label) {
             if ($key == 'firstname') {
                 echo '<td>' . $ov[$key] . ' (<a href="/traffa/quicksearch.php?username='******'username'] . '">' . $ov['username'] . '</a>)</td>' . "\n";
             } else {
                 echo '<td>' . $ov[$key] . '</td>' . "\n";
             }
         }
         echo '</tr>' . "\n";
         $out = $zebra ? '<tr style="background: #EEF">' : '<tr>';
         echo $out;
         foreach ($keys_2 as $key) {
             echo '<td>' . $ov[$key] . '</td>' . "\n";
         }
         echo '</tr>' . "\n";
         echo '<tr><td></td></tr>';
示例#26
0
<?php

require '../include/core/common.php';
$ui_options = array();
$ui_options['title'] = 'Vi som gör Hamsterpaj';
$ui_options['menu_path'] = array('hamsterpaj', 'crew');
ui_top($ui_options);
$query = 'SELECT l.id AS userid, u.image AS image, u.birthday AS birthday, c.real_name AS real_name, c.task AS task, c.info_text AS info_text';
$query .= ' FROM login AS l, userinfo AS u, crew_members AS c';
$query .= ' WHERE c.userid = l.id AND u.userid = l.id';
$result = mysql_query($query) or report_sql_error($query);
echo '<h1 style="font-size: 24px; font-family: georgia, serif;">Vi som gör Hamsterpaj</h1>' . "\n";
echo '<p>';
echo 'Vi är ju några stycken som sliter för att siten skall vara en trevlig plats att vistas på och har ni någon gång funderat på vilka som gömmer sig bakom skärmarna kan ni sluta fundera, här är en presentation av de inblandade.';
echo ' <strong>Buggrapporter och förslag tas i <a href="/hamsterpaj/suggestions.php">förslagslådan</a></strong>!';
echo '</p>' . "\n";
while ($data = mysql_fetch_assoc($result)) {
    echo rounded_corners_top();
    echo in_array($data['image'], array(1, 2)) ? ui_avatar($data['userid'], array('style' => 'float: left; margin: 10px')) : '<img src="' . IMAGE_URL . 'images/noimage.png" alt="Ingen visninsbild" style="float: left;clear: left; margin: 10px" />';
    echo '<div style="float: left; width: 500px;margin-left: 10px">';
    echo '<h2 style="font-size: 20px; font-family: georgia, serif;"><a href="/traffa/profile.php?id=' . $data['userid'] . '">' . $data['real_name'] . '</a> ' . ($data['birthday'] != '0000-00-00' ? date_get_age($data['birthday']) : '') . ' - ' . htmlspecialchars($data['task']) . '</h2>' . "\n";
    echo htmlspecialchars($data['info_text']);
    echo '</div>';
    echo '<br style="clear: both" />';
    echo rounded_corners_bottom();
}
ui_bottom();
示例#27
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;
}
示例#28
0
    $output .= '<div id="news">' . "\n";
    $output .= '<h2>' . $data['title'] . '</h2>' . "\n";
    $output .= '<p>';
    $output .= strlen($data['body']) > 1000 ? substr($data['body'], 0, 1000) . '...' : $data['body'];
    $output .= '</p>' . "\n";
    $output .= '<p>Skrevs ' . fix_time($data['tstamp']) . ' <a href="' . $data['thread_url'] . '">Diskutera nyheten »</a></p>' . "\n";
    $output .= '</div>' . "\n";
}
/* Spotlight */
$output .= '<div id="fp_spotlight_area">' . "\n";
$users = cache_load('hetluften');
$output .= '<div id="fp_spotlight">' . "\n";
$output .= '<div id="fp_spotlight_scroller">' . "\n";
foreach ($users as $user) {
    $output .= '<div class="fp_spotlight_profile">' . "\n";
    $output .= ui_avatar($user['id'], array('style' => 'float: left; margin-right: 15px; border: 1px solid white;'));
    $output .= '<h2><a href="/traffa/profile.php?id=' . $user['id'] . '">' . $user['username'] . '</a></h2>' . "\n";
    $output .= $user['gender'] == 'f' ? '<p>Tjej' : '<p>Kille';
    $output .= $user['birthday'] != '0000-00-00' ? ' ' . date_get_age($user['birthday']) . ' år' : '';
    $output .= strlen($user['spot']) > 0 ? ' från ' . $user['spot'] . '</p>' : '</p>';
    if (count($user['flags']) > 0) {
        $output .= '<ul class="user_flags">' . "\n";
        $flag_count = 0;
        foreach ($user['flags'] as $flag) {
            if (strlen($flags_by_id[$flag]) > 0) {
                $output .= '<li><img src="' . IMAGE_URL . '/user_flags/' . $flags_by_id[$flag] . '" /></li>' . "\n";
                $flag_count++;
                if ($flag_count == 5) {
                    break;
                }
            }