function messages_compose($user_id, $user_name, $title = null) { $user_name = htmlspecialchars($user_name); $user_id = htmlspecialchars($user_id); $title = str_replace('"', '\\"', stripslashes($title)); if ($user_id < 1 && strlen($user_name) > 0) { $query = 'SELECT id FROM login WHERE username LIKE "' . str_replace('_', '\\_', $user_name) . '" LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query)); $data = mysql_fetch_assoc($result); $user_id = $data['id']; } if (strlen($user_name) < 1 && $user_id > 0 && is_numeric($user_id)) { $query = 'SELECT username FROM login WHERE id = "' . $user_id . '" LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query)); $data = mysql_fetch_assoc($result); $user_name = $data['username']; } if ($user_id < 1 || strlen($user_name) < 1) { return false; } $fetch['login'] = array('id', 'username', 'regtimestamp', 'regip', 'lastlogon', 'lastip', 'lastaction', 'lastusernamechange', 'lastusername'); $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'forum_signature', 'forum_posts'); $fetch['traffa'] = array('firstname', 'profile_modules', 'guestbook_entries'); $userinfo = login_load_user_data($user_id, $fetch); traffa_draw_user_div($user_id, $userinfo); echo '<div class="grey_faded_div">'; echo '<h2>Skickar meddelande till ' . $user_name . '</h2>'; echo '<p>'; echo '<form name="compose" action="' . $_SERVER['PHP_SELF'] . '?action=send" method="post">'; echo '<div style="float: right; width: 65px;">'; echo '<strong>Infoga smilies</strong><br />'; echo listSmilies('document.compose.message'); echo '</div>'; $title = htmlspecialchars(stripslashes($title)); echo '<strong>Rubrik:</strong> <input type="text" name="title" class="textbox" style="width: 502px;" value="' . $title . '" maxlength="' . MESSAGES_MAX_TITLE_STRLEN . '"/><br />'; echo '<input type="hidden" name="recipient" value="' . $user_id . '" />'; echo '<textarea name="message" class="textbox" style="width: 550px; height: 200px;"></textarea><br />'; echo '</div>'; echo '<input type="submit" class="button" value="Skicka" />'; echo '</form>'; return true; }
<?php require '../include/core/common.php'; require PATHS_INCLUDE . 'traffa-functions.php'; $ui_options['current_menu'] = 'traffa'; ui_top($ui_options); if (login_checklogin() != 1) { header('location: /'); exit; } traffa_draw_user_div($_SESSION['login']['id'], $_SESSION); ?> <h1>Dina senaste besökare</h1> <?php $query = 'SELECT DISTINCT login.username, traffa_visits.userid, traffa_visits.tstamp, userinfo.image, '; $query .= 'userinfo.gender, userinfo.birthday, userinfo.geo_location, userinfo.contact1, userinfo.contact2 '; $query .= 'FROM login, traffa_visits, userinfo '; $query .= 'WHERE login.id = traffa_visits.userid AND userinfo.userid = traffa_visits.userid AND '; $query .= 'traffa_visits.profileid = ' . $_SESSION['login']['id'] . ' ORDER BY traffa_visits.tstamp DESC LIMIT 30'; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) == 0) { echo '<div class="grey_faded_div">'; echo '<b>Du har inte haft några besökare än :(</b>'; echo '</div>'; } $alreadyshowed = array(); while ($data = mysql_fetch_assoc($result)) { if (in_array($data['userid'], $alreadyshowed)) { continue; } array_push($alreadyshowed, $data['userid']);
/* Always show module #0 to admins */ if (!in_array($display_modules)) { $display_modules[] = 1; /* Always show module #1 (forum) to admins and above. */ } } if ($userid == $_SESSION['login']['id']) { $display_modules[] = 7; /* Show the "module chooser" to the presentations owner */ } $query = 'SELECT id FROM snyggve WHERE owner = "' . $userid . '" LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); if (mysql_num_rows($result) == 1) { $userinfo['snyggve'] = 1; } traffa_draw_user_div($userid, $userinfo); foreach ($display_modules as $current) { if (strlen($current) < 1) { continue; } echo '<div style="margin-top: 5px;">' . "\n"; if ($modules[$current]['disable_title_block'] != true) { echo '<div style="display: block; z-index: 2; border: 1px solid #3f657a; border-bottom: none; background: ' . $profile_colors['background'] . '; padding: 3px; position: absolute;">' . "\n"; echo $modules[$current]['title'] . "\n"; echo '</div>'; echo '<div style="height: 21px;"> </div>'; } if ($modules[$current]['active'] != true) { echo 'Denna modul har deaktiverats'; } elseif ($modules[$current]['userlevel_use'] > $userinfo['login']['userlevel']) { echo 'Denna användaren får inte lov att använda denna modulen, därför visas den inte.';