function open_search_boxes_list() { $boxes = open_search_fetch(); $out = ''; if ($boxes['num_rows'] > 0) { $out = '<ul class="open_search_edit">' . "\n"; for ($i = 0; $i < count($boxes) - 1; $i++) { $out .= "\t" . '<li>'; $out .= rounded_corners_top(array('color' => 'blue_deluxe'), true); $out .= '<br style="clear:both" />'; $out .= '<h3><span class="box_link" id="link_' . $boxes[$i]['id'] . '"><img src="' . IMAGE_URL . 'plus.gif" alt="Expandera/Kollapsa" id="image_' . $boxes[$i]['id'] . '" /></span> <a href="javascript:window.external.AddSearchProvider(\'http://www.hamsterpaj.net/open_search/?type=' . $boxes[$i]['id'] . '\');">' . $boxes[$i]['name'] . '</a></h3>'; $out .= '<div class="open_search_box_info" id="box_' . $boxes[$i]['id'] . '">' . "\n"; $out .= '<p>' . $boxes[$i]['Description'] . '</p>' . "\n"; $out .= 'Tillagd: ' . fix_time($boxes[$i]['timestamp']) . ' <a href="javascript:window.external.AddSearchProvider(\'http://www.hamsterpaj.net/open_search/?type=' . $boxes[$i]['id'] . '\');">Lägg till bland dina sökmotorer</a>'; $out .= '</div>'; $out .= '<br style="clear:both" />'; $out .= rounded_corners_bottom(array('color' => 'blue_deluxe'), true); $out .= '</li>' . "\n"; } $out .= '</ul>' . "\n"; } else { $out .= 'Det finns inga söklådor!' . "\n"; } return $out; }
function render_entries($entries, $options) { $content .= '<ul class="group_entries">' . "\n"; foreach ($entries as $entry) { $options['user_id'] = $entry['user_id']; $content .= message_top($options); $content .= '<div style="border-bottom: 1px solid #ababab;">' . "\n"; $content .= '<span class="timestamp">' . fix_time($entry['timestamp']) . '</span>' . "\n"; $content .= '<h2 style="display: inline;">' . $entry['header'] . '</h2> - <a href="/traffa/profile.php?id=' . $entry['user_id'] . '">' . $entry['username'] . '</a> ' . "\n"; $content .= $entry['gender']; $content .= date_get_age($entry['birthday']); $content .= '<p>' . "\n"; $content .= nl2br(html_entity_decode($entry['content'])) . "\n"; $content .= '</p>' . "\n"; $content .= '</div>' . "\n"; // ----START---- $content .= $_GET['action'] != 'show' ? '<a href="/hamsterpaj/hamsterblogg.php?action=show&id=' . $entry['id'] . '">Kommentera »</a>' : '<a href="/hamsterpaj/hamsterblogg.php">« Tillbaka</a>'; // ----END------ $content .= message_bottom(); if ($options['enable_comments'] == true) { $content .= rounded_corners_top(); $content .= '<label>Kommentera:</label>' . "\n"; $content .= comments_input_draw($entry['id'], 'hamsterblog'); $content .= rounded_corners_bottom(); $content .= '<div style="clear: both;"></div>' . "\n"; $content .= comments_list($entry['id'], 'hamsterblog'); } } $content .= '</ul>' . "\n"; return $content; }
function warnings_render_table($result, $highlight_time) { if (!isset($time) || !is_numeric($time)) { $highlight_time = time() - 604800; } $out .= '<table style="border: 0px;"><tbody>'; $out .= '<tr><td><strong>Varnad</strong></td><td><strong>Av</strong></td><td><strong>Tidpunkt</strong></td><td><strong>Anledning</strong></td></tr>' . "\n"; while ($data = mysql_fetch_assoc($result)) { $found_something = true; $out_later .= $data['timestamp'] > $highlight_time ? '<tr class="_warning_row_active" background: ' . $within_a_week_color . ';">' : '<tr class="_warning_row">' . "\n"; $out_later .= '<td class="_warning" valign="top" style="text-align: left"><strong> <a href="/traffa/user_facts.php?user_id=' . $data['user_user_id'] . '">' . $data['user_username'] . '</a></strong>' . "\n"; $out_later .= '<td class="_warning" valign="top"><strong> <a href="/traffa/user_facts.php?user_id=' . $data['admin_user_id'] . '">' . $data['admin_username'] . '</a></strong>' . "\n"; $out_later .= '<td class="_warning" valign="top"> ' . fix_time($data['timestamp']) . '</td>' . "\n"; $out_later .= '<td class="_warning" valign="top"> ' . nl2br($data['reason']) . '</td>' . "\n"; $out_later .= '</tr>' . "\n"; } $out .= $out_later; $out .= '</tbody></table>'; if ($found_something) { return $out; } elseif (!$found_something) { return "<h2>Hittade inget i databasen :(</h2>"; } }
function gather_hours($dates, $start_times, $end_times, $venues, $hours_worked) { for ($i = 0; $i < count($dates); $i++) { $start_times[$i] = fix_time($start_times[$i]); $end_times[$i] = fix_time($end_times[$i]); if (valid_entry($dates[$i], $start_times[$i], $end_times[$i], $hours_worked[$i])) { $hours .= "," . $dates[$i] . ":" . $start_times[$i] . "-" . $end_times[$i] . ":" . $hours_worked[$i]; } } return substr($hours, 1); }
function viewPosts($mode = 'normal', $criteria = NULL) { //Visar alla inlägg $query = makeQuery($mode, $criteria); $result = mysql_query($query) or die('Ett fel har upstått:<br/>' . mysql_error()); $genderlabels['P'] = 'Pojke'; $genderlabels['F'] = 'Flicka'; while ($data = mysql_fetch_assoc($result)) { $userage = date_get_age($data['birthday']); if ($data['gender'] == 'P') { $divbg = 'blue_faded_div'; } elseif ($data['gender'] == 'F') { $divbg = 'pink_faded_div'; } else { $divbg = 'grey_faded_div'; } if (isset($_SESSION['login']['username'])) { if (preg_match("/" . $_SESSION['login']['username'] . "/i", $data['text'])) { $divbg = 'orange_faded_div'; } elseif ($_SESSION['login']['username'] == $data['username']) { $divbg = 'green_faded_div'; } } echo '<div class="' . $divbg . '" style="repeat-x; margin-top: 10px; border: 1px solid #CCCCCC;">' . "\n"; echo '<table class="body" style="width: 100%;"><tr><td style="vertical-align: top; width: 75px;">' . "\n"; if ($data['image'] == 1 || $data['image'] == 2) { echo insert_avatar($data['userid']); } else { echo '<img src="/images/noimage.png" style="width: 75px; height: 75px; border: 1px solid #cccccc;" alt="Ingen visningsbild"/>' . "\n"; } echo '</td><td style="vertical-align: top;">'; echo fix_time($data['timestamp']) . ' (inlägg #' . $data['id'] . ') <a style="text-decoration:none;" href="javascript:#;" onclick="javascript:document.gbform.message.value=document.gbform.message.value+\'' . $data['username'] . ' : \';document.gbform.message.focus();">[^]</a><br/>' . "\n"; echo '<a href="' . $hp_url . '/traffa/profile.php?id=' . $data['userid'] . '">' . "\n"; echo '<b>' . $data['username'] . '</b></a> ' . "\n"; echo birthdaycake($data['birthday']) . ' ' . "\n"; echo $genderlabels[$data['gender']]; if ($userage > 1) { echo ' ' . $userage . 'år' . "\n"; } if (strlen($data['geo_location']) > 1) { echo ' från ' . htmlentities($data['geo_location']) . "\n"; } echo '<br/>' . "\n"; echo setsmilies($data['text']) . "\n"; echo '</td></tr></table>' . "\n"; echo '</div>' . "\n"; } //while-satsen för att skriva ut inlägg }
public function edit() { $this->assign("time_list", $time_list); $this->assign('type_data', $this->type_data); $this->assign('warn_data', $this->warn_data); $id = $_REQUEST['id']; $model = M('Todo'); $where['user_id'] = get_user_id(); $where['id'] = $id; $vo = $model->where($where)->find(); $vo['start_time'] = fix_time($vo['start_time']); $vo['end_time'] = fix_time($vo['end_time']); $this->assign('vo', $vo); $this->display(); }
$result = mysql_query($query) or die(report_sql_error($query)); // echo '<p>sql-frågan: ' . $query . '</p>'; echo '<table class="admin_log">'; echo ' <tr>'; echo ' <td class="event" >Händelse</td>'; echo ' <td class="comment" >Info</td>'; echo ' <td class="time" >Tidpunkt</td>'; echo ' <td class="admin" >Admin</td>'; echo ' <td class="user" >Användare</td>'; echo ' <td class="item" >Item id</td>'; echo ' </tr>'; while ($data = mysql_fetch_assoc($result)) { echo '<tr>'; echo ' <td class="event" >' . $data['event'] . '</td>'; echo ' <td class="comment" >' . $data['value'] . '</td>'; echo ' <td>' . fix_time($data['timestamp']) . '</td>'; echo ' <td>' . ($numeric ? $data['admin_id'] : get_username_by_id($data['admin_id'])) . '</td>'; echo ' <td>' . ($numeric ? $data['user_id'] : get_username_by_id($data['user_id'])) . '</td>'; echo ' <td>' . $data['item_id'] . '</td>'; echo '</tr>'; } echo '</table>'; echo rounded_corners_bottom(); ui_bottom(); //functions used in this script function get_userid_by_name($username) { //hämta användarid $query = 'SELECT id FROM login WHERE username = "******"'; $result = mysql_query($query) or die(report_sql_error($query)); if ($data = mysql_fetch_assoc($result)) {
public function edit() { $widget['jquery-ui'] = true; $widget['date'] = true; $widget['uploader'] = true; $widget['editor'] = true; $this->assign("widget", $widget); $id = $_REQUEST['id']; $model = M('Schedule'); $where['user_id'] = get_user_id(); $where['id'] = $id; $vo = $model->where($where)->find(); $vo['start_time'] = fix_time($vo['start_time']); $vo['end_time'] = fix_time($vo['end_time']); $this->assign('vo', $vo); $this->display(); }
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__)); } }
echo '<td><b>' . $contactlabel1 . '</b></td>'; echo '<td><b>' . $contactlabel2 . '</b></td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . strip_tags($userdata['traffa']['firstname']) . '</td>'; echo '<td>' . $contactalias1 . '</td>'; echo '<td>' . $contactalias2 . '</td>'; echo '</tr>'; echo '<tr>'; echo '<td><b>Blev medlem:</b></td>'; echo '<td><b>Loggade senast in:</b></td>'; echo '<td><b>Längd:</b></td>'; echo '</tr>'; echo '<tr>'; echo '<td>' . date('Y-m-d', $userdata['login']['regtimestamp']) . '</td>'; echo '<td>' . fix_time($userdata['login']['lastlogon']) . '</td>'; echo '<td>' . $userdata['traffa']['height'] . 'cm</td>'; echo '</tr>'; echo '</table>'; echo '</div>'; if ($userdata['userinfo']['irl'][0] == 1) { echo '<img src="/images/irlsthlm05.png" style="width: 100px; height: 20px; border: 1px solid #cccccc; margin: 2px;" />'; } if ($userdata['userinfo']['irl'][1] == 1) { echo '<img src="/images/miniirlgbg05.png" style="width: 100px; height: 20px; border: 1px solid #cccccc; margin: 2px;" />'; } if ($userdata['userinfo']['irl'][2] == 1) { echo '<img src="/images/regnirl.png" style="width: 100px; height: 20px; border: 1px solid #cccccc; margin: 2px;" />'; } $query = 'SELECT m.groupid, l.name FROM groups_list AS l, groups_members AS m WHERE '; $query .= 'l.groupid = m.groupid AND m.userid = "' . $_GET['id'] . '" AND m.approved = "1" LIMIT 10;';
function discussion_forum_tillagg_callback($matches) { $output .= '<div class="post_addition">Tillägg av <a href="/traffa/quicksearch.php?username='******'">' . $matches[1] . '</a>'; $output .= ' ' . strtolower(fix_time($matches[2])) . '<br />' . $matches[3] . '</div>' . "\n"; return $output; }
<?php include '../../include/core/common.php'; $query = 'SELECT * FROM music_guess_songs ORDER BY id DESC LIMIT 1, 15'; $songs = query_cache(array('query' => $query)); header('Content-type: application/xml; charset=utf-8'); //header('Content-type: text/plain'); echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<playlist version="0" xmlns="http://xspf.org/ns/0/">' . "\n"; echo '<trackList>' . "\n"; foreach ($songs as $song) { $song['song'] = strtolower($song['song']); $song['artist'] = strtolower($song['artist']); $song['timestamp'] = strtolower(fix_time($song['timestamp'])); $search = array('å', 'ä', 'ö', '\'', '"'); $replace = array('a', 'a', 'o', '', ''); $song['song'] = str_replace($search, $replace, $song['song']); $song['artist'] = str_replace($search, $replace, $song['artist']); $song['timestamp'] = str_replace($search, $replace, $song['timestamp']); /* $song['song'] = htmlentities($song['song']); $song['artist'] = htmlentities($song['artist']); $song['timestamp'] = htmlentities($song['timestamp']); */ echo '<track>' . "\n"; echo '<location>http://images.hamsterpaj.net/music_guess_mp3/' . $song['secret_id'] . '.mp3</location>' . "\n"; echo '<image>http://images.hamsterpaj.net/mattan/album_pic.jpg</image>' . "\n"; echo '<annotation>' . $song['timestamp'] . ', ' . $song['artist'] . ' - ' . $song['song'] . '</annotation>' . "\n"; echo '</track>' . "\n"; } echo '</trackList>' . "\n";
$output .= ' <td class="admin" >Admin</td>'; $output .= ' <td class="user" >Användare</td>'; $output .= ' <td class="item" >Item id</td>'; $output .= ' </tr>'; break; case 'csv': $output .= implode("\t", array('Handelse', 'Info', 'Tidpunkt', 'Admin', 'Anvandare', 'Itemid')) . "\n"; break; } while ($data = mysql_fetch_assoc($result)) { switch ($format) { case 'styled': $output .= '<tr>'; $output .= ' <td class="event" >' . $data['event'] . '</td>'; $output .= ' <td class="comment" >' . $data['value'] . '</td>'; $output .= ' <td>' . fix_time($data['timestamp']) . '</td>'; $output .= ' <td>' . ($numeric ? $data['admin_id'] : get_username_by_id($data['admin_id'])) . '</td>'; $output .= ' <td>' . ($numeric ? $data['user_id'] : get_username_by_id($data['user_id'])) . '</td>'; $output .= ' <td>' . $data['item_id'] . '</td>'; $output .= '</tr>'; break; case 'csv': $row = array('event' => $data['event'], 'comment' => $data['value'], 'timestamp' => date('Y-m-d H:i', $data['timestamp']), 'admin' => $numeric ? $data['admin_id'] : get_username_by_id($data['admin_id']), 'user' => $numeric ? $data['user_id'] : get_username_by_id($data['user_id']), 'item_id' => $data['item_id']); //$row = array_map('md5', $row); $output .= '' . implode("\t", $row) . '' . "\n"; break; } } if ($format == 'styled') { $output .= '</table>'; $output .= rounded_corners_bottom();
echo '<a href="/avatar.php?id=' . $userinfo['login']['id'] . '&refuse&admin" '; echo 'onclick="return confirm(\'Är du säker på att du vill ta bort denna bild?\');" '; echo '/><strong>Ta bort avatar</strong></a>'; } if ($_SESSION['login']['userlevel'] >= USERLEVELS_EDIT_PRESENTATION) { echo ' <strong><a href="/admin/edit_presentation.php?id=' . $userinfo['login']['id'] . '">Ändra presentation</a></strong> '; } if ($_SESSION['login']['userlevel'] >= 3) { echo '<input type="button" value="Ta bort" onclick="if(confirm(\'Vill du ta bort den här knäppgöken?\')){window.location=\'/remove_user.php?userid=' . $userinfo['login']['id'] . '\';}" />' . "\n"; } if ($_SESSION['login']['userlevel'] >= 3) { echo '<h1>Aiight, snabbkoll vad för shit användaren hittat på på sajten</h1>' . "\n"; echo '<h2>Senast skickade gästboksinlägg</h2>' . "\n"; $query = 'SELECT * FROM traffa_guestbooks WHERE sender = "' . $userinfo['login']['id'] . '" AND is_private != 1 ORDER BY id DESC LIMIT 5'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); while ($data = mysql_fetch_assoc($result)) { echo '<strong>' . fix_time($data['timestamp']) . '</strong>' . "\n"; echo '<p>' . htmlspecialchars($data['message']) . '</p>' . "\n"; } echo '<h2>Senaste inläggen i forumet</h2>' . "\n"; $query = 'SELECT * FROM posts WHERE author = "' . $userinfo['login']['id'] . '" ORDER BY id DESC LIMIT 5'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); while ($data = mysql_fetch_assoc($result)) { echo '<strong>' . fix_time($data['timestamp']) . '</strong>' . "\n"; echo '<p><a href="' . posts_url_get($data['id']) . '">' . htmlspecialchars($data['content']) . '</a></p>' . "\n"; } } ?> <div style="clear: both;"></div> </div>
$out .= message_top($options); $out .= '<span class="timestamp">' . fix_time($event['timestamp']) . '</span>' . "\n"; $out .= '<a href="/traffa/profile.php?id=' . $event['friend_id'] . '">' . $event['username'] . '</a> ' . "\n"; $genders = array('f' => 'F', 'm' => 'P'); $out .= $genders[$event['gender']]; $out .= date_get_age($event['birthday']) > 0 ? date_get_age($event['birthday']) : ''; $out .= '<p>Tjoho, läs min senaste bloggning: <a href="' . $event['url'] . '">' . $event['label'] . '</a><br />Och glöm för sablen inte att kommentera!</p>' . "\n"; $out .= message_bottom(); break; case 'photos': $photos = photos_fetch(array('id' => substr($event['url'], 22), 'limit' => 1)); if (!isset($photos)) { } else { $options['user_id'] = $event['friend_id']; $out .= message_top($options); $out .= '<span class="timestamp">' . fix_time($event['timestamp']) . '</span>' . "\n"; $out .= '<a href="/traffa/profile.php?id=' . $event['friend_id'] . '">' . $event['username'] . '</a> ' . "\n"; $genders = array('f' => 'F', 'm' => 'P'); $out .= $genders[$event['gender']]; $out .= date_get_age($event['birthday']) > 0 ? date_get_age($event['birthday']) : ''; $out .= photos_list_mini($photos); $out .= '<p>Jag är en cool kis, så jag ladda precis upp ett foto. Titta på det och kommentera vetja :) <a href="' . $event['url'] . '">' . $event['label'] . '</a></p>' . "\n"; $out .= message_bottom(); } break; } } $out .= '</ul>' . "\n"; } ui_top($ui_options); echo $out;
case 'guestbook_entry': $entry_query = 'SELECT message, sender FROM traffa_guestbooks WHERE id = "' . $data['reference_id'] . '" LIMIT 1'; $entry_result = mysql_query($entry_query) or report_sql_error($entry_query, __FILE__, __LINE__); $entry = mysql_fetch_assoc($entry_result); $entry_poster_query = 'SELECT username, id FROM login WHERE id = ' . $entry['sender'] . ' LIMIT 1'; $entry_poster_result = mysql_query($entry_poster_query) or report_sql_error($entry_poster_query, __FILE__, __LINE__); $entry_poster = mysql_fetch_assoc($entry_poster_result); $out .= '<strong>Gästboksinlägg av <a href="/traffa/user_facts.php?user_id=' . $entry['sender'] . '">' . $entry_poster['username'] . '</a> - Rapporterat av <a href="/traffa/guestbook.php?view=' . $data['reporter'] . '">' . $data['report_username'] . '</a> <a href="/admin/user_management.php?username='******'report_username'] . '">[UA]</a> ' . fix_time($data['timestamp']) . '</strong>: ' . $abuse_types[$data['abuse_type']]['label'] . '<br />' . "\n"; $out .= '<p style="font-style: italic">' . $data['freetext'] . '</p>' . "\n"; $out .= '<p>' . (strlen($entry['message']) > 1000 ? substr($entry['message'], 0, 1000) . ' [INLÄGGET HAR KAPATS AV]' : $entry['message']) . '</p>' . "\n"; break; case 'photo': $photo_query = 'SELECT user FROM user_photos WHERE id = ' . $data['reference_id'] . ' LIMIT 1'; $photo_result = mysql_query($photo_query) or report_sql_error($entry_query, __FILE__, __LINE__); $photo = mysql_fetch_assoc($photo_result); $photo_poster_query = 'SELECT username FROM login WHERE id = ' . $photo['user'] . ' LIMIT 1'; $photo_poster_result = mysql_query($photo_poster_query) or report_sql_error($photo_poster_query, __FILE__, __LINE__); $photo_poster = mysql_fetch_assoc($photo_poster_result); $out .= '<strong>Bild uppladdad av <a href="/traffa/user_facts.php?user_id=' . $photo['user'] . '">' . $photo_poster['username'] . '</a> - Rapporterat av <a href="/traffa/guestbook.php?view=' . $data['reporter'] . '">' . $data['report_username'] . '</a> <a href="/admin/user_management.php?username='******'report_username'] . '">[UA]</a> ' . fix_time($data['timestamp']) . '</strong>: ' . $abuse_types[$data['abuse_type']]['label'] . '<br />' . "\n"; $out .= '<p style="font-style: italic">' . $data['freetext'] . '</p>' . "\n"; $out .= '<a href="http://www.hamsterpaj.net/traffa/photos.php?ajax&user_id=' . $photo['user'] . '&image_id=' . $data['reference_id'] . '#photo"><img src="http://images.hamsterpaj.net/photos/thumb/' . floor($data['reference_id'] / 5000) . '/' . $data['reference_id'] . '.jpg" />'; break; } $out .= '<p style="margin-bottom: 0px;"><a style="cursor:pointer" onclick="handleReport(' . $data['id'] . ')">Hantera denna rapport</a></p>' . "\n"; $out .= rounded_corners_bottom(); $out .= '</div>'; } $out .= '</div>' . "\n"; ui_top($ui_options); echo $out; ui_bottom();
function guestbook_list($entries) { $out .= '<ul class="guestbook_entries">' . "\n"; foreach ($entries as $entry) { $out .= "\n\n"; $out .= '<!-- Post #' . cute_number($entry['id']) . ' by ' . $entry['username'] . ' at ' . date('Y-m-d H:i:s', $entry['timestamp']) . '-->' . "\n"; /* $class = ($entry['read'] == 0) ? ' class="unread"': ''; $out .= '<li' . $class . '>' . "\n"; if($entry['image'] == 1 || $entry['image'] == 2) { $out .= '<img src="http://images.hamsterpaj.net/images/users/thumb/' . $entry['sender'] . '.jpg" class="user_avatar" id="entry_' . $entry['id'] . '_photo" />' . "\n"; } else { $out .= '<img src="http://images.hamsterpaj.net/images/users/no_image_mini.png" class="user_avatar" id="entry_' . $entry['id'] . '_photo" />' . "\n"; } $out .= '<div class="container">' . "\n"; $out .= '<div class="top_bg">' . "\n"; $out .= '<div class="bottom_bg">' . "\n"; */ $options['user_id'] = $entry['sender']; $options['type'] = $entry['read'] == 0 ? 'unread' : 'standard'; $out .= message_top($options); $out .= '<div id="guestbook_entry_' . $entry['id'] . '">' . "\n"; $out .= '<span class="timestamp">' . fix_time($entry['timestamp']) . '</span>' . "\n"; $out .= '<a href="/traffa/profile.php?id=' . $entry['sender'] . '">' . $entry['username'] . '</a> ' . "\n"; $genders = array('f' => 'F', 'm' => 'P'); $out .= $genders[$entry['gender']]; $out .= date_get_age($entry['birthday']) > 0 ? date_get_age($entry['birthday']) : ''; $out .= '<span class="unanswered" id="unanswered_label_' . $entry['id'] . '"' . $style . '>' . "\n"; $out .= $entry['answered'] != 'Y' ? '(Obesvarat)' : ''; $out .= '</span>' . "\n"; $style = $entry['is_private'] == 0 ? ' style="display: none;"' : ''; $out .= '<span class="private" id="private_label_' . $entry['id'] . '"' . $style . '>(Privat)</span>' . "\n"; $out .= '<p>' . setSmilies(nl2br($entry['message'])) . '</p>' . "\n"; $out .= '<p class="gb_entry_controls">' . "\n"; $out .= login_checklogin() && $entry['recipient'] == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id'] ? '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_reply_control" id="reply_control_' . $entry['id'] . '">Svara</a>' . "\n" : ''; $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '&history=' . $entry['recipient'] . '">Historik</a>' . "\n"; $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '">Gå till</a>' . "\n"; $out .= $entry['recipient'] == $_SESSION['login']['id'] ? '<a href="/installningar/userblock.php?action=block&username='******'username'] . '" class="gb_block_control">Blockera</a>' . "\n" : ''; if (login_checklogin() && $entry['recipient'] == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id']) { $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_delete_control" id="delete_control_' . $entry['id'] . '">Ta bort</a>' . "\n"; } if (login_checklogin() && $entry['recipient'] == $_SESSION['login']['id'] && $entry['sender'] != $_SESSION['login']['id']) { $private_style = $entry['is_private'] == 1 ? ' style="display: none;"' : ''; $unprivate_style = $entry['is_private'] == 0 ? ' style="display: none;"' : ''; $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_private_control" id="private_control_' . $entry['id'] . '"' . $private_style . '>'; $out .= 'Gör privat</a>' . "\n"; $out .= '<a href="/traffa/guestbook.php?view=' . $entry['sender'] . '" class="gb_unprivate_control" id="unprivate_control_' . $entry['id'] . '"' . $unprivate_style . '>'; $out .= 'Gör offentligt</a>' . "\n"; $out .= '<a href="/hamsterpaj/abuse.php?report_type=guestbook_entry&reference_id=' . $entry['id'] . '" class="abuse_button"><img src="http://images.hamsterpaj.net/abuse.png" /></a>' . "\n"; } $out .= '</p>' . "\n"; $out .= guestbook_form(array('recipient' => $entry['sender'], 'reply-to' => $entry['id'], 'form_id' => 'gb_reply_form_' . $entry['id'])); $out .= '</div>' . "\n"; $out .= message_bottom(); /* $out .= '</div>' . "\n"; $out .= '</div>' . "\n"; $out .= '</div>' . "\n"; $out .= '</li>' . "\n"; */ } $out .= '</ul>' . "\n"; return $out; }
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; }
<?php $options['output'] .= '<ul>' . "\n"; foreach ($_SESSION['visitors_with_image'] as $visitor) { $options['output'] .= '<li>' . "\n"; $options['output'] .= '<a href="/traffa/profile.php?id=' . $visitor['id'] . '" title="' . $visitor['username'] . ' besökte dig ' . strtolower(fix_time($visitor['timestamp'])) . '">'; $options['output'] .= '<img src="http://images.hamsterpaj.net/images/users/thumb/' . $visitor['id'] . '.jpg" />'; $options['output'] .= '</a>' . "\n"; $options['output'] .= '</li>' . "\n"; } $options['output'] .= '</ul>' . "\n"; $options['output'] .= '<a href="/traffa/my_visitors.php" class="show_more_link">Visa fler »</a>' . "\n";
$query .= 'FROM user_event_log AS uel, login AS l, userinfo AS u, zip_codes AS z '; $query .= 'WHERE uel.user = "******" AND l.id = uel.remote_user_id AND u.userid = uel.remote_user_id '; $query .= 'AND uel.action = "profile_visit" AND z.zip_code = u.zip_code '; $query .= 'ORDER BY uel.timestamp DESC LIMIT 80'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); while ($data = mysql_fetch_assoc($result)) { /* Only display each user one time, should be done with DISTINCT in query, but I can't ger it to work */ if (in_array($data['user_id'], $duplicates)) { continue; } $duplicates[] = $data['user_id']; $entry = '<div class="visitor">' . "\n"; if (in_array($data['image'], array(1, 2))) { $entry .= insert_avatar($data['user_id']); } $entry .= fix_time($data['timestamp']); $entry .= '<div>' . "\n"; $entry .= '<h3><a href="/traffa/profile.php?id=' . $data['user_id'] . '">' . $data['username'] . '</a></h3>' . "\n"; $entry .= '<h4>'; $entry .= $data['birthday'] != '0000-00-00' ? date_get_age($data['birthday']) . 'år ' : ''; $entry .= strlen($data['spot']) > 0 ? 'från ' . $data['spot'] : ''; $entry .= '</h4>' . "\n"; $entry .= $data['lastaction'] > time() - 600 ? 'Online nu!' : 'Loggade senast in ' . date('Y-m-d', $data['lastlogon']) . "\n"; $entry .= '</div>'; $entry .= '</div>' . "\n"; switch ($data['gender']) { case 'm': $output_boys .= $entry; break; case 'f': $output_girls .= $entry;
$extra2 = '<td>' . $data['user_birthday'] . '</td>'; } $output .= rounded_corners_tabs_top(); $out .= '<table>' . "\n"; $out .= '<tr><th>Medlem sedan</th><th>Specialstatus</th>' . $extra1 . '</tr>' . "\n"; $out .= '<tr><td>' . date('Y-m-d', $data['regtimestamp']) . '</td><td>' . $specialstatus . '</td>' . $extra2 . '</tr>' . "\n"; $out .= '<tr><th>Inlägg i forumet</th><th>Spam i forumet</th><th>Gästboksinlägg</th></tr>' . "\n"; $out .= '<tr><td>' . cute_number($data['forum_posts']) . '</td><td>' . cute_number($data['forum_spam']) . '</td><td>' . cute_number($data['guestbook_entries']) . '</td></tr>' . "\n"; $out .= '</table>' . "\n"; echo $out; $output .= rounded_corners_tabs_bottom(); if (is_privilegied('ip_ban_admin') || is_privilegied('remove_user')) { $query = 'SELECT lastlogon, lastip, regip, lastusername FROM login WHERE id LIKE "' . $params['user_id'] . '" LIMIT 1'; $result = mysql_query($query) or report_sql_error($query); $user_ips = mysql_fetch_assoc($result); $out_ip = 'Senaste inloggning <strong>' . fix_time($user_ips['lastlogon']) . '</strong>'; $out_ip .= ' Från IP <strong>' . $user_ips['lastip'] . '</strong>' . "\n"; // Fetch all user with that IP $query = 'SELECT DISTINCT login_log.ip, login_log.user_id, login.id, login.username FROM login_log, login WHERE login_log.ip = "' . ip2long($user_ips['lastip']) . '" AND login_log.user_id = login.id AND login_log.user_id != "' . $params['user_id'] . '" AND login.is_removed = 0'; $ip_users = mysql_query($query) or report_sql_error($query); $out_ip .= '| Andra med IPt:' . "\n"; while ($ip_user = mysql_fetch_assoc($ip_users)) { $out_ip .= '<a href="http://www.hamsterpaj.net/traffa/profile.php?user_id=' . $ip_user['id'] . '">' . $ip_user['username'] . '</a>' . "\n"; } $out_ip .= '<br />' . "\n"; $out_ip .= 'Registrerad från IP'; $out_ip .= ' <strong>' . $user_ips['regip'] . '</strong>' . "\n"; // Fetch all user with that IP $query = 'SELECT DISTINCT login_log.user_id, login.id, login.username FROM login_log, login WHERE login_log.ip = "' . ip2long($user_ips['regip']) . '" AND login_log.user_id != "' . $params['user_id'] . '" AND login_log.user_id = login.id'; // AND login.is_removed = 0'; $ip_users = mysql_query($query) or report_sql_error($query);
/** * 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; }
function suggestion_list($suggestions) { foreach ($suggestions as $id => $suggestion) { if (!isset($updates_today) && $suggestion['last_update'] > strtotime(date('Y-m-d'))) { echo '<h2>Uppdaterat eller skapat idag</h2>' . "\n"; $updates_today = true; } if ($suggestion['last_update'] < strtotime(date('Y-m-d')) && isset($updates_today)) { echo '<h2>Äldre förslag</h2>' . "\n"; unset($updates_today); } echo '<div class="suggestion" id="suggestion_' . $id . '">' . "\n"; echo '<h5 class="author_header">Inskickat av</h5>' . "\n"; echo ' <a href="/traffa/profile.php?id=' . $suggestion['author'] . '">' . $suggestion['author_username'] . '</a>' . "\n"; echo ' ' . fix_time($suggestion['timestamp']) . ($suggestion['timestamp'] == $suggestion['last_update'] ? '' : ' - senast ändrat ' . fix_time($suggestion['last_update'])) . "\n"; if (is_privilegied('suggestion_admin')) { echo '<button class="button_80" onclick="xmlhttp_ping(\'http://www.hamsterpaj.net/hamsterpaj/suggestions.php?action=delete&id=' . $id . '\' + this.href);$(this).parent().hide(\'slow\');return false;" style="cursor: pointer;">Ta bort</button>' . "\n"; } echo '<h5>Förslag:</h5>' . "\n"; echo '<p>' . nl2br($suggestion['text']) . '</p>' . "\n"; if (strlen($suggestion['reply']) > 0) { echo '<h5>Svar:</h5>' . "\n"; echo '<p>' . nl2br($suggestion['reply']) . '</p>' . "\n"; } if (strlen($suggestion['responsible_username']) > 0) { echo '<h5 class="responsible_username_header">Ansvarig:</h5> <a href="/traffa/profile.php?id=' . $suggestion['responsible'] . '">' . $suggestion['responsible_username'] . '</a>'; } if (is_privilegied('suggestion_admin')) { echo '<form action="?action=update" method="post" id="suggestions_admin_form">' . "\n"; echo '<h5>Svar</h5>' . "\n"; echo '<textarea cols="75" name="reply">' . htmlspecialchars($suggestion['reply']) . '</textarea>' . "\n"; echo '<input type="hidden" name="id" value="' . $suggestion['id'] . '" />' . "\n"; echo '<input type="text" style="display: none;" name="responsible_username" value="' . $_SESSION['login']['username'] . '" />' . "\n"; echo '<input type="submit" value="Spara" class="button_60" />' . "\n"; echo '</form>'; } echo '</div>' . "\n"; } }
if ($data['gender'] == 'P') { $divbg = 'blue_faded_div'; } elseif ($data['gender'] == 'F') { $divbg = 'pink_faded_div'; } else { $divbg = 'grey_faded_div'; } echo '<div class="' . $divbg . '" style="repeat-x; margin-top: 10px; border: 1px solid #CCCCCC;">'; echo '<table class="body" style="width: 100%;"><tr><td style="vertical-align: top; width: 75px;">'; if ($data['image'] == 1 || $data['image'] == 2) { echo insert_avatar($data['userid']); } else { echo '<img src="' . IMAGE_URL . 'images/noimage.png" style="width: 75px; height: 75px; border: 1px solid #cccccc;" alt="Ingen visningsbild"/>'; } echo '</td><td style="vertical-align: top;">'; echo fix_time($data['tstamp']) . '<br/>'; echo '<a href="/traffa/profile.php?id=' . $data['userid'] . '">'; echo '<strong>' . $data['username'] . '</strong></a> '; echo birthdaycake($data['birthday']) . ' '; if ($data['gender'] == 'P') { echo ' Kille, '; } elseif ($data['gender'] == 'F') { echo ' Tjej, '; } if ($data['birthday'] > '0000-00-00') { $age = date_get_age($data['birthday']); echo $age . ' år '; } if (strlen($data['geo_location']) > 0) { echo 'från ' . $data['geo_location']; }
' . "\n"; while ($data = mysql_fetch_assoc($result)) { $out .= '<tr style="background: #FAFAFA;">' . "\n"; $out .= '<td>' . date("Y.m.d H:i", $data['regtimestamp']) . '</td>' . "\n"; $out .= '<td><a class="user_info" id="' . $data['id'] . '" href="/traffa/user_facts.php?user_id=' . $data['id'] . '">' . $data['username'] . '</a></td>' . "\n"; $out .= '<span id="user_info_' . $data['id'] . '" style="display: none;">Foruminlägg: ' . $data['forum_posts'] . '<br />Gästboksinlägg: ' . $data['guestbook_entries'] . '</span>' . "\n"; $out .= '<td>'; if ($data['last_warning'] > 0) { $out .= '<a class="user_warning" id ="' . $data['id'] . '" style="color: red;" href="/admin/warnings.php?action=viewhistory&user_id=' . $data['id'] . '">Varnad</a>'; $out .= '<span id="user_warning_' . $data['id'] . '" style="display: none;">' . fix_time($data['last_warning']) . '</span>'; } else { $out .= '<span style="color: #999;">Neup.</span>'; } $out .= '<td>'; if ($data['quality_level_expire'] > time()) { $out .= '<a style="color: red;" class="user_read_only" id="' . $data['id'] . '" href="/admin/user_management.php?username='******'username'] . '">Jao</a>'; $out .= '<span id="user_read_only_' . $data['id'] . '" style="display: none;">'; $out .= 'Level ' . $data['quality_level'] . ', går ut ' . fix_time($data['quality_level_expire']); $out .= '</span>'; } else { $out .= '<span style="color: #999;">Nepp! :D</span>'; } $out .= '</td>' . "\n"; $out .= '</td>' . "\n"; $out .= '</tr>' . "\n"; } $out .= '</table>' . "\n"; $out .= '</div>' . "\n"; ui_top($ui_options); echo $out; ui_bottom();
} $data = mysql_fetch_assoc($result); $output = array(); $output['age'] = $data['birthday'] == '0000-00-00' ? 0 : date_get_age($data['birthday']); /* Some strange conditions... */ if ($output['age'] == '') { $output['age'] = 0; } $output['username'] = htmlentities($data['username']); // Never trust the user (eg. Ekonomi-pär and such). $output['have_visited'] = htmlentities($fetch_for_username); $output['gender'] = $data['gender']; $output['location'] = htmlentities(trim($data['spot']), ENT_QUOTES, 'UTF-8'); // Hmm, I like to escape data... $output['total_visits'] = $data['total_visits']; $output['last_visit'] = htmlentities(strtolower(fix_time($data['last_visit'])), ENT_QUOTES, 'UTF-8'); $output['x_rt90'] = $data['x_rt90']; $output['y_rt90'] = $data['y_rt90']; $output['user_status'] = addslashes(htmlentities($data['user_status'], ENT_QUOTES, 'UTF-8')); if ($data['flags'] != '') { $output['flag_array'] = array(); $flags = explode(',', $data['flags']); $flag_count = 0; foreach ($flags as $flag) { if (!is_numeric($flag)) { die('Nähedu, det gick inte!'); } if ((int) $flag > 0 && $flag_count++ < 6) { /* Do not change $flag_query unnecessarily, we're using query_cache()! */ $flag_query = 'SELECT handle'; $flag_query .= ' FROM user_flags_list';
function discussions_list_splits($discussions) { echo '<!-- Discussion split list with ' . count($discussions) . ' items -->' . "\n"; echo '<div class="discussion_split_list">' . "\n"; echo '<h2>Här startar ' . count($discussions) . ' diskussioner</h2>' . "\n"; echo '<ul>' . "\n"; foreach ($discussions as $discussion) { echo '<li>' . "\n"; echo '<a href="/forum/' . forum_get_parent_category($discussion['category_handle']) . '/' . $discussion['category_handle'] . '/' . $discussion['handle'] . '/">' . $discussion['title'] . '</a>' . "\n"; echo ', ' . fix_time($discussion['timestamp']) . ' (' . $discussion['posts'] . ' inlägg)' . "\n"; echo '</li>' . "\n\n"; } echo '</ul>' . "\n"; echo '</div>' . "\n\n\n"; }
// @Build Query $safeQuery = "SELECT * FROM `administrators` WHERE `emailaddress`='{$cleanData['emailaddress']}' AND `password`='{$cleanData['password']}';"; // @Insert New User try { $result = MakeDatabaseQuery($safeQuery, $socket) or return_failed(); $isRows = $result->num_rows; if ($isRows == 0) { // Nothing came back in the query. return_failed(); } else { // There was a result... $returnKeys = MakeDatabaseFetch($result, $socket); if ($returnKeys[emailaddress] == $cleanData[emailaddress]) { if ($returnKeys[password] == $cleanData[password]) { // Vaid user. $time = fix_time(time() + 9000); echo '<script type="text/javascript"> document.cookie="emailAddress=' . $returnKeys[emailaddress] . '; expires=' . $time . ';"; document.cookie="firstName=' . $returnKeys[firstname] . '; expires=' . $time . ';"; document.cookie="loginStamped=until; expires=' . $time . ';"; window.location="./dashboard.php"; </script>'; } else { return_failed(); } } else { return_failed(); } } if (!result) { return_failed();
$query = 'INSERT INTO recent_updates (type, timestamp, url, label) VALUES ("text_news", "' . time() . '", "' . $thread_url . '", "' . $_POST['title'] . '")'; mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); msnbot_queue_add_everyone(array('message' => 'Nyhet på www.hamsterpaj.net!' . "\r\n\r\n" . $_POST['body'] . "\r\n\r\n" . 'Klicka på den här länken för att kommentera nyheten:' . "\r\n" . 'http://www.hamsterpaj.net/' . $thread_url)); } else { if (is_privilegied('news_admin')) { echo '<div id="contentPostbox">'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?add" method="post">'; echo 'Titel:<input type="text" name="title" length="40" cols="40" class="textbox"><br />'; echo 'Text:<br /><textarea name="body" rows="5" cols="70 class="textbox" class="textbox"></textarea><br />'; echo '<input type="submit" value="OK" class="button">'; echo '</form></div><br />'; } $result = mysql_query('SELECT * FROM nyheter ORDER BY id DESC LIMIT 30'); while ($data = mysql_fetch_assoc($result)) { echo '<div style="background: #f7f7f7">'; echo '<a name="newsitem' . $data['id'] . '"></a>'; echo '<strong>' . $data['title'] . '</strong> (' . fix_time($data['tstamp'], false) . ')<br />'; echo $data['body']; echo '<br /><i>Skriven av: <strong>' . $data['who'] . '</strong></i>'; if (is_privilegied('news_admin')) { echo '<br />'; echo '[<a href="' . $_SERVER['PHP_SELF'] . '?delete=' . $data['id'] . '">Radera</a>]'; echo '[<a href="' . $_SERVER['PHP_SELF'] . '?edit=' . $data['id'] . '">Redigera</a>]'; } echo '</div><br />'; } } } } } ui_bottom();
function posts_list_old($posts, $discussions = null, $options) { $options['enable_quality_rank'] = $options['enable_quality_rank'] === false ? false : true; $options['quality_level'] = isset($options['quality_level']) ? $options['quality_level'] : 0; $options['mode'] = isset($options['mode']) ? $options['mode'] : 'forum'; echo '<input type="hidden" id="debug_input" />'; foreach ($posts as $i => $post) { /* Shall we display any discussion splits before the post? */ $display_discussions = array(); foreach ($discussions as $key => $discussion) { if ($discussion['timestamp'] <= $post['timestamp']) { $display_discussions[] = $discussion; unset($discussions[$key]); } } if (count($display_discussions) > 0) { discussions_list_splits($display_discussions); } /* Shall we hide this post, due to low quality? */ $low_quality = $post['quality_level'] >= 0 && ($i > 0 && $options['enable_quality_rank'] && $post['quality_rank'] < $options['quality_level'] - 0.4 ? true : false); $low_quality = false; if (in_array('private_gb', $post['flags'])) { echo '<h5 class="private_header">Privat inlägg</h5>' . "\n"; if ($_SESSION['login']['id'] != $post['author'] && $_SESSION['login']['id'] != $options['gb_recipient']) { continue; } } echo '<!-- Post #' . $post['post_id'] . ' by ' . $post['username'] . ' at ' . date('Y-m-d H:i:s', $post['timestamp']) . '-->' . "\n"; echo '<a name="post_' . $post['post_id'] . '_anchor"></a>' . "\n"; if (in_array('removed', $post['flags'])) { echo '<div class="removed_post">' . "\n"; echo '<h2>Borttaget inlägg, skrevs ' . fix_time($post['timestamp']) . ' av <a href="/traffa/profile.php?id=' . $post['author'] . '">' . $post['username'] . '</a></h2>' . "\n"; echo '</div>' . "\n"; $displayed_posts[] = $post['post_id']; continue; } if ($low_quality) { echo '<div class="low_quality">'; } echo '<div class="post" id="post_' . $post['post_id'] . '"'; if (login_checklogin() && strpos($post['content'], $_SESSION['login']['username'])) { echo ' style="background: #f9cc88;"'; } echo '>' . "\n"; echo '<div class="author">' . "\n"; if ($low_quality) { echo 'Detta inlägg har lägre kvalitét än vad skaparen av diskussionen vill ha.'; } elseif ($post['image'] == 1 || $post['image'] == 2) { echo user_avatar($post['author']) . "\n"; } echo '</div>' . "\n"; echo '<div class="date_time">Skrevs ' . fix_time($post['timestamp']) . '</div>' . "\n"; echo '<div class="author_text"><a href="/traffa/profile.php?id=' . $post['author'] . '">' . $post['username'] . '</a>'; echo ($post['gender'] == 'm' ? ', pojke' : ($post['gender'] == 'f' ? ', flicka' : '')) . ' ' . date_get_age($post['birthday']); if (strlen($post['spot']) > 0) { echo ' från ' . $post['spot']; } echo '</div>'; if ($post['userlevel'] >= 3) { echo '<img class="badge" src="' . IMAGE_URL . 'forum/ordningsvakt.png" alt="" />'; } if ($post['lastaction'] > time() - 600) { echo '<img class="badge" src="' . IMAGE_URL . 'forum/online.png" alt="" />'; } echo '<div id="post_content_' . $post['post_id'] . '" class="' . ($low_quality ? 'low_quality_content' : 'content') . '">' . "\n"; $options_markup['post_id'] = $post['post_id']; $options_markup['context'] = 'forum'; echo setsmilies(markup_parse($post['content'], $options_markup)); if (strlen($post['forum_signature']) > 0) { echo '<div class="signature">' . $post['forum_signature'] . '</div>' . "\n"; } echo '</div>' . "\n"; echo '<div class="controls">' . "\n"; if (login_checklogin()) { $control_buttons['answer'] = '<input type="button" class="post_answer_button" id="post_answer_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Svara]" />'; $control_buttons['quote'] = '<input type="button" class="post_quote_button" id="post_quote_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Citera]" />'; $control_buttons['history'] = '<input type="button" class="post_history_button" id="post_history_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Historik]" />'; $control_buttons['delete'] = '<input type="button" class="post_delete_button" id="post_delete_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Ta bort]" />'; $control_buttons['censor'] = '<input type="button" class="post_censor_button" id="post_censor_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Censurera]" />'; $control_buttons['addition'] = '<input type="button" class="post_addition_button" id="post_addition_button_' . $post['post_id'] . '_' . $post['username'] . '" value="[Tillägg]" />'; $control_set['forum'] = array('answer', 'quote'); $control_set['guestbook'] = array('answer', 'quote', 'history'); $control_set['admin'] = array('delete', 'censor', 'addition'); foreach ($control_set[$options['mode']] as $button) { echo $control_buttons[$button] . "\n"; } if (posts_admin_check($post)) { foreach ($control_set['admin'] as $button) { echo $control_buttons[$button] . "\n"; } } elseif ($post['author'] == $_SESSION['login']['id']) { echo $control_buttons['addition']; } } echo '</div>' . "\n"; echo '<div class="post_addition" id="post_addition_' . $post['post_id'] . '">' . "\n"; echo ' <textarea id="post_addition_content_' . $post['post_id'] . '" rows="3" cols="50" ></textarea>' . "\n"; echo ' <button class="button_30" id="post_addition_submit_' . $post['post_id'] . '" value="post_addition_' . $post['post_id'] . '">Spara</button>' . "\n"; echo '</div>'; echo '</div>' . "\n"; if ($low_quality) { echo '</div>' . "\n"; } echo "\n\n"; $displayed_posts[] = $post['post_id']; } if (login_checklogin()) { /* Remove all notices and answer notices for read posts */ $query = 'DELETE FROM notices WHERE post_id IN("' . implode('", "', $displayed_posts) . '") AND user_id = "' . $_SESSION['login']['id'] . '"'; mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); } /* List the remaining discussions */ if (count($discussions) > 0) { discussions_list_splits($discussions); } }