} $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(); ?>
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; }
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&recipient_username='******'login']['username'] . '&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"; }