function fetch($user_id, $photoblog_preferences_default_values) { global $photoblog_preferences_default_values; $user_id = !empty($user_id) ? $user_id : $_SESSION['login']['id']; if (!is_numeric($user_id)) { throw new Exception('$user_id must be a numerical value'); } elseif (!login_checklogin()) { throw new Exception('You must be logged in to load your photoblog preferences'); } $photoblog_preferences_fetch_sql = 'SELECT * FROM photoblog_preferences WHERE userid = ' . $_SESSION['login']['id'] . ' LIMIT 1'; $photoblog_preferences_fetch_result = mysql_query($photoblog_preferences_fetch_sql); if (mysql_num_rows($photoblog_preferences_fetch_result) == 0) { $sql = 'INSERT INTO photoblog_preferences SET'; $photoblog_preferences_default_values_count = count($photoblog_preferences_default_values); $count = 0; foreach ($photoblog_preferences_default_values as $default_key => $default_val) { if (is_numeric($default_val)) { $sql .= ' ' . $default_key . ' = ' . $default_val; } else { $sql .= ' ' . $default_key . ' = "' . $default_val . '"'; } $count++; if ($count != $photoblog_preferences_default_values_count) { $sql .= ','; } } mysql_query($sql) or report_sql_error($sql, __FILE__, __LINE__); $photoblog_preferences_fetch_data = $photoblog_preferences_default_values; } else { $photoblog_preferences_fetch_data = mysql_fetch_assoc($photoblog_preferences_fetch_result); } return $photoblog_preferences_fetch_data; }
function profile_fetch($options) { $options['viewer'] = isset($options['viewer']) ? $options['viewer'] : (login_checklogin() ? $_SESSION['login']['id'] : 0); //preint_r(array('viewer' => $options['viewer'], 'userblock_check' => userblock_check($options['user_id'], $options['viewer'])), 'Joel är en testare!'); if ($options['viewer'] > 0 && userblock_check($options['user_id'], $options['viewer']) == 1) { $options['error_message'] = 'Användaren har blockerat dig.'; } else { $query = 'SELECT l.username, l.lastaction, l.lastlogon, u.gender, u.birthday, u.image, u.user_status, u.profile_theme, u.gb_entries, z.spot, u.presentation_text, p.gb_anti_p12'; $query .= ' FROM login AS l, userinfo AS u, zip_codes AS z, preferences AS p'; $query .= ' WHERE l.id = "' . $options['user_id'] . '" AND u.userid = l.id AND z.zip_code = u.zip_code AND p.userid = l.id'; if (!isset($options['show_removed_users']) || isset($options['show_removed_users']) && $options['show_removed_users'] == false) { $query .= ' AND l.username NOT LIKE "Borttagen"'; } $query .= ' LIMIT 1'; $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { $data = mysql_fetch_assoc($result); if (strlen($data['presentation_text']) == 0) { $old_presentation_query = 'SELECT freetext AS presentation_text FROM traffa_freetext WHERE userid = "' . $options['user_id'] . '" LIMIT 1'; $result = mysql_query($old_presentation_query) or report_sql_error($old_presentation_query); if (mysql_num_rows($old_presentation_result) > 0) { $old_presentation = mysql_fetch_assoc($old_presentation_result); $options['presentation_text'] = $old_presentation['presentation_text']; profile_presentation_save($options); } else { $options['presentation_text'] = 'Användaren har inte skapat någon presentation ännu.'; } } $options = array_merge($options, $data); } else { $options['error_message'] = 'Den användaren hittade vi tyvärr inte.'; } } return $options; }
function photos_upload($options) { if (!login_checklogin()) { return false; } $category = photos_get_categories(array('user' => $options['user'], 'name' => $options['category'], 'create_if_not_found' => true)); $category = array_pop($category); $query = 'INSERT INTO user_photos (user, description, category, date)'; $query .= ' VALUES("' . $options['user'] . '", "' . $options['description'] . '", "' . $category['id'] . '", "' . date('Y-m-d') . '")'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $id = mysql_insert_id(); $folder = floor($id / 5000); $query = 'UPDATE user_photo_categories SET photo_count = photo_count + 1 WHERE id = "' . $category['id'] . '" LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); // Check if folders exists, otherwise, create it foreach (array('mini', 'thumb', 'full') as $format) { if (!is_dir(PHOTOS_PATH . $format . '/' . $folder)) { mkdir(PHOTOS_PATH . $format . '/' . $folder); } } $image_size = getimagesize($options['file']); $square = min($image_size[0], $image_size[1]); $width = round($square * 0.9); $height = $width / 4 * 3; $mini = 'convert ' . $options['file'] . ' -gravity center -crop ' . $width . 'x' . $height . '+0+0 -resize 50x38! ' . PHOTOS_PATH . 'mini/' . $folder . '/' . $id . '.jpg'; $thumb = 'convert ' . $options['file'] . ' -gravity center -crop ' . $width . 'x' . $height . '+0+0 -resize 150x112! ' . PHOTOS_PATH . 'thumb/' . $folder . '/' . $id . '.jpg'; $full = 'convert -resize "630x630>" ' . $options['file'] . ' ' . PHOTOS_PATH . 'full/' . $folder . '/' . $id . '.jpg'; system($mini); system($thumb); system($full); return $id; }
function digga_view_info($artist) { $query = 'SELECT name, popularity FROM artists WHERE id = "' . $artist . '" LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); if (mysql_num_rows($result) != 1) { die('Artisten finns inte'); } $data = mysql_fetch_assoc($result); $artist_name = $data['name']; echo '<h1>' . $artist_name . '</h1>'; echo 'Uppskattas av ' . $data['popularity'] . ' hamsterpajare<br />' . "\n"; if (login_checklogin()) { if ($artist_name == 'Kent') { treasure_item(27); } $query = 'SELECT user FROM user_artists WHERE user = "******" AND artist = "' . $artist . '" LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); if (mysql_num_rows($result) == 1) { echo '<input type="button" class="button" value="Sluta digga!" onclick="window.location=\'?action=dislike&artist=' . $_GET['artist'] . '\';" />' . "\n"; } else { echo '<input type="button" class="button" value="Börja digga!" onclick="window.location=\'?action=like&artist=' . $_GET['artist'] . '\';" />' . "\n"; } } echo '<input type="button" value="Mer om ' . htmlentities($artist_name) . '" onclick="opener.window.location=\'digga.php?action=view_info&artist_id=' . $_GET['artist'] . '\'; window.close();" />' . "\n"; }
function movie_compability_form($movies, $options) { rounded_corners_top(array('id' => 'movie_compability_review_list', 'color' => 'white')); echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n"; if (isset($options['owner'])) { echo '<input type="hidden" name="owner" value="' . $options['owner'] . '" />' . "\n"; } if (login_checklogin()) { $query = 'SELECT * FROM movie_tests WHERE owner = "' . $_SESSION['login']['id'] . '"'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); while ($data = mysql_fetch_assoc($result)) { $old_score[$data['movie_id']] = $data['score']; } } foreach ($movies as $movie_handle => $movie) { echo '<div class="movie">' . "\n"; echo '<img src="' . IMAGE_URL . 'movie_compability/folders/' . $movie_handle . '.png" alt="' . $movie_handle . '" />' . "\n"; echo '<div class="scoring">' . "\n"; for ($i = 0; $i <= 5; $i++) { echo '<div>' . "\n"; echo '<label for="movie_compability_' . $movie_handle . '_' . $i . '">' . $i . '</label>' . "\n"; $checked = $old_score[$movie['id']] == $i && isset($old_score[$movie['id']]) ? ' checked="checked"' : ''; echo '<input type="radio" name="movie_compability_' . $movie['id'] . '" value="' . $i . '" class="movie_compability_input_scroll" id="movie_compability_' . $movie_handle . '_' . $i . '"' . $checked . ' />' . "\n"; echo '</div>' . "\n"; } echo '<div class="movie_compability_vote_not_seen">' . "\n"; echo '<input type="radio" name="movie_compability_' . $movie['id'] . '" value="not_seen" class="movie_compability_input_scroll" for="movie_compability_' . $movie_handle . '_not_seen" />' . "\n"; echo '<label for="movie_compability_' . $movie_handle . '_not_seen">Ej sett</label>' . "\n"; echo '</div>' . "\n"; echo '<br style="clear: both;" />' . "\n"; echo '</div>' . "\n"; echo '<h3>' . $movie['title'] . '</h3>' . "\n"; echo '<p>' . $movie['description'] . '</p>' . "\n"; echo '</div>' . "\n"; } rounded_corners_bottom(array('color' => 'white')); if (!login_checklogin()) { rounded_corners_top(); echo '<h2>Fyll i ditt namn</h2>' . "\n"; echo '<div class="first_name">' . "\n"; echo '<h3>Förnamn</h3>' . "\n"; echo '<input type="text" class="textbox" name="first_name" />' . "\n"; echo '</div>' . "\n"; echo '<div class="surname">' . "\n"; echo '<h3>Efternamn</h3>' . "\n"; echo '<input type="text" class="textbox" name="surname" />' . "\n"; echo '</div>' . "\n"; rounded_corners_bottom(); } echo '<input type="submit" value="Skicka!" class="button" />' . "\n"; echo '</form>' . "\n"; }
function rank_input_draw($item_id, $item_type, $options) { $previous = isset($options['previous']) ? $options['previous'] : 0; $output = ''; $output = '<div class="rank_input_container">' . "\n"; $output .= '<div id="rank_input" class="rank_input"' . (login_checklogin() ? '' : ' onclick="javascript: tiny_reg_form_show();"') . '>' . "\n"; for ($i = 0; $i <= 10; $i++) { $output .= '<div class="rank_input_part" id="rank_input_part_' . $i . '"></div>'; } $output .= '<input type="hidden" id="rank_previous" value="' . $previous . '" />' . "\n"; $output .= '<input type="hidden" id="rank_item_id" value="' . $item_id . '" />' . "\n"; $output .= '<input type="hidden" id="rank_item_type" value="' . $item_type . '" />' . "\n"; $output .= '</div>' . "\n"; $output .= '<br style="clear: both;" /><div id="rank_input_message">Tack för din röst!</div>' . "\n"; $output .= '</div>' . "\n"; return $output; }
function irl_update_attending($content) { if (!is_numeric($_GET['irl'])) { throw new Exception('ID is not numeric'); } if (!login_checklogin()) { throw new Exception('You must be loged in'); } $query = 'SELECT user_id FROM irl_attendings WHERE user_id = ' . $_SESSION['login']['id'] . ' AND irl_id = ' . $_GET['irl'] . ' LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); if (mysql_num_rows($result) == 1) { $query = 'UPDATE irl_attendings SET attending = "' . $content['attending'] . '", has_beds = "' . $content['has_beds'] . '", needs_beds = "' . $content['needs_beds'] . '"'; $query .= ' WHERE user_id = "' . $_SESSION['login']['id'] . '" AND irl_id = ' . $_GET['irl'] . ' LIMIT 1'; mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); } else { $query = 'INSERT INTO irl_attendings (irl_id, user_id, attending, has_beds, needs_beds) '; $query .= 'VALUES(' . $_GET['irl'] . ', "' . $_SESSION['login']['id'] . '", "' . $content['attending'] . '", "' . $content['has_beds'] . '", "' . $content['needs_beds'] . '")'; mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); } }
function photos_upload($options) { if (!login_checklogin()) { return false; } $category = photos_get_categories(array('user' => $options['user'], 'name' => $options['category'], 'create_if_not_found' => true)); $category = array_pop($category); $query = 'INSERT INTO user_photos (user, description, category, date)'; $query .= ' VALUES("' . $options['user'] . '", "' . $options['description'] . '", "' . $category['id'] . '", "' . date('Y-m-d') . '")'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $id = mysql_insert_id(); $folder = floor($id / 5000); $query = 'UPDATE user_photo_categories SET photo_count = photo_count + 1 WHERE id = "' . $category['id'] . '" LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); // Check if folders exists, otherwise, create it foreach (array('mini', 'thumb', 'full') as $format) { if (!is_dir(PHOTOS_PATH . $format . '/' . $folder)) { mkdir(PHOTOS_PATH . $format . '/' . $folder); } } if (!($image_size = getimagesize($options['file']))) { throw new Exception('Är du säker på att det var en bild du laddade upp?'); } $dimensions = array($image_size[0], $image_size[1]); foreach ($dimensions as $width_or_height) { if ($width_or_height > 4000) { throw new Exception('Whoa! Har du fotograferat en långtradare eller varför är bilden så stor?<br />Maxdimensionerna är 4000 x 4000 pixlar.'); } } $square = min($image_size[0], $image_size[1]); $width = round($square * 0.9); $height = $width / 4 * 3; $mini = 'convert ' . $options['file'] . ' -gravity center -crop ' . $width . 'x' . $height . '+0+0 -resize 50x38! ' . PHOTOS_PATH . 'mini/' . $folder . '/' . $id . '.jpg'; $thumb = 'convert ' . $options['file'] . ' -gravity center -crop ' . $width . 'x' . $height . '+0+0 -resize 150x112! ' . PHOTOS_PATH . 'thumb/' . $folder . '/' . $id . '.jpg'; $full = 'convert -resize "630x630>" ' . $options['file'] . ' ' . PHOTOS_PATH . 'full/' . $folder . '/' . $id . '.jpg'; system($mini); system($thumb); system($full); return $id; }
function userblock_checkblock($object_id) { // PREVENT SQL QUERY ERROR DUE TO MISSING OBJECT ID if (strlen($object_id) == 0) { return false; } elseif (!is_numeric($object_id)) { return false; } elseif (!login_checklogin()) { return false; } $sql = 'SELECT * FROM userblocks WHERE ownerid = ' . $object_id . ' AND blockedid = ' . $_SESSION['login']['id'] . ' LIMIT 1'; $result = mysql_query($sql) or report_sql_error($sql, __FILE__, __LINE__); $data = mysql_fetch_assoc($result); if ($data['blockedid'] === $_SESSION['login']['id'] && !is_privilegied('igotgodmode') && !is_privilegied('ip_ban_admin')) { return true; } elseif ($data['blockedid'] === $_SESSION['login']['id'] && is_privilegied('igotgodmode') && !is_privilegied('ip_ban_admin')) { echo '<p class="error"><strong>Den här användaren har blockerat dig!</strong><br />' . "\n"; echo 'Men eftersom du är 1337 h4xx0r så kan du se personens presentation i alla fall :)</p>' . "\n"; } else { return false; } }
function poll_fetch($options) { $options['limit'] = is_numeric($options['limit']) ? $options['limit'] : 1; $query = 'SELECT poll.*'; $query .= login_checklogin() ? ', poll_answers.answer_id' : ''; $query .= ' FROM poll'; $query .= login_checklogin() ? ' LEFT OUTER JOIN poll_answers ON poll.id = poll_answers.poll_id AND poll_answers.user_id = "' . $_SESSION['login']['id'] . '"' : ''; $query .= ' WHERE 1'; $query .= isset($options['id']) && is_numeric($options['id']) ? ' AND poll.id = "' . $options['id'] . '"' : ''; $query .= isset($options['author']) ? ' AND poll.author = "' . $options['author'] . '"' : ''; $query .= isset($options['handle']) ? ' AND poll.handle = "' . $options['handle'] . '"' : ''; $query .= isset($options['type']) ? ' AND poll.type = "' . $options['type'] . '"' : ''; $query .= ' ORDER BY poll.id DESC'; $query .= ' LIMIT ' . $options['limit']; //if(!login_checklogin()) if (false) { $poll = query_cache(array('query' => $query, 'type' => 'poll')); } else { $result = mysql_query($query) or report_sql_error($query); while ($data = mysql_fetch_assoc($result)) { $poll[] = $data; } } foreach ($poll as $id => $current) { if (login_checklogin()) { $poll[$id]['can_answer'] = $current['answer_id'] > 0 ? false : true; } elseif ($current['force_logon'] == 0) { if ($_COOKIE['poll_' . $current['id']] == true) { $poll[$id]['can_answer'] = false; } else { $poll[$id]['can_answer'] = true; } } else { $poll[$id]['can_answer'] = false; } } return $poll; }
function comments_remove($id) { $query = 'SELECT user_id, item_type, item_id FROM user_comments WHERE id = ' . $id . ' LIMIT 1'; $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { $data = mysql_fetch_assoc($result); if ($data['item_type'] == 'photos') { $photos = photos_fetch(array('id' => $data['item_id'], 'limit' => 1)); $photo_owner = $photos[0]['user']; if (login_checklogin() && ($_SESSION['login']['id'] == $data['user_id'] || $_SESSION['login']['id'] == $photo_owner || is_privilegied('comments_admin'))) { $query = 'UPDATE user_comments SET removed=1 WHERE id = ' . $id . ' LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); } else { die('FEL @ ' . __FILE__ . ' #' . __LINE__); } } else { if (login_checklogin() && ($_SESSION['login']['id'] == $data['user_id'] || is_privilegied('comments_admin'))) { $query = 'UPDATE user_comments SET removed=1 WHERE id = ' . $id . ' LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); } } } }
$message .= '-----' . "\n"; $message .= '%CONTENT%' . "\n"; $message .= '-----' . "\n\n"; $message .= 'Har du några frågor så ta det med någon ordningsvakt, du hittar sådana i modulen "Inloggade Ordningsvakter" till höger.' . "\n"; $message .= 'Detta är inte hela världen, men det är kanske bäst att du chillar lite extra i framtiden.' . "\n\n"; $message .= '/Webmaster'; $guestbook_message = array('sender' => 2348, 'recipient' => intval($post['author']), 'message' => mysql_real_escape_string(str_replace(array('%TITLE%', '%CONTENT%', '%REMOVAL_COMMENT%', '%REMOVERS_USERNAME%'), array($post['title'], $post['content'], $_GET['removal_comment'], $_SESSION['login']['username']), $message))); preint_r($guestbook_message); guestbook_insert($guestbook_message); log_admin_event('post removed', $post['removal_comment'], $_SESSION['login']['id'], $post['author'], $_GET['post_id']); admin_action_count($_SESSION['login']['id'], 'post_removed'); } if ($_GET['action'] == 'unremove_post' && forum_security(array('action' => 'unremove_post', 'post_id' => $_GET['post_id']))) { discussion_forum_remove_post(array('post_id' => $_GET['post_id'], 'mode' => 'unremove')); } if ($_GET['action'] == 'vote' && login_checklogin() && is_numeric($_GET['thread_id'])) { $query = 'UPDATE forum_read_posts SET has_voted = 1 WHERE thread_id = "' . $_GET['thread_id'] . '" AND user_id = "' . $_SESSION['login']['id'] . '" AND has_voted = 0'; mysql_query($query); if (mysql_affected_rows() == 1) { $operand = $_GET['vote'] == 'positive' ? '+' : '-'; $query = 'UPDATE forum_posts SET score = score ' . $operand . ' 1 WHERE id = "' . $_GET['thread_id'] . '"'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); } } /* Thread subscriptions */ if ($_GET['action'] == 'add_thread_subscription') { $query = 'UPDATE forum_read_posts SET subscribing = "true" WHERE user_id = "' . $_SESSION['login']['id'] . '" AND thread_id = "' . $_GET['thread_id'] . '" LIMIT 1'; mysql_query($query); $thread = array_pop(discussion_forum_post_fetch(array('post_id' => $_GET['thread_id']))); $_SESSION['forum']['subscriptions'][$_GET['thread_id']] = $thread; }
function dl_index() { global $DL_CATEGORIES; foreach ($DL_CATEGORIES as $category) { $sum_count += $category['count']; $sum_completed += $category['completed']; } ?> <h1>Gratis teoriprogram på nätet</h1> <p> Här hittar du <strong><?php echo $sum_count; ?> frågor</strong> att träna på inför teoriprovet för vanligt B-körkort. Systemet håller koll på vilka frågor du kan och vilka du behöver öva mer på - även om du loggar ut och tar en paus eller byter dator.<br /> Det kostar ingenting att använda teoriprogrammet men du måste vara inloggad för att det skall fungera! </p> <?php echo '<h2><a href="?action=practice">Plugga på allt</a> '; echo login_checklogin() ? '(' . round($sum_completed / $sum_count * 100) . '% klart)' : ''; echo '</h2>' . "\n"; echo '<img src="http://images.hamsterpaj.net/drivers-license/dl_teaser.png" style="float: right; margin-left: 10px;" />' . "\n"; /* echo'<ul class="dl_category_list">' . "\n"; foreach($DL_CATEGORIES AS $handle => $category) { echo '<li><a href="?action=practice&category=' . $handle . '">' . $category['label'] . '</a> '; if($category['completed'] == 0) { $status = 'inte påbörjad'; } elseif($category['completed'] < $category['count']) { $status = round(($category['completed'] / $category['count']) * 100 ) . '% klar'; } else { $status = 'klar'; } echo '(' . $category['count'] . ' frågor, ' . $status . ')</li>' . "\n"; } echo '</ul>' . "\n"; echo '<h2>Rensa ämnen du har klarat av</h2>' . "\n"; echo '<p>Om du vill kan du nollställa dina poäng, antingen för alla frågor eller efter ämne. Klicka bara på en länk här nedanför så nollställer vi dina poäng.</p>' . "\n"; echo '<h3><a href="?action=clear_all">Nollställ poängen i alla ämnen</a></h3>' . "\n"; foreach($DL_CATEGORIES AS $handle => $category) { echo '<a href="?action=clear_category&category=' . $handle . '">' . $category['label'] . '</a>, '; */ echo '<table class="dl_category_index">' . "\n"; echo '<tr><th> </th><th class="label"> </th><th class="question_count">Frågor</th><th class="percentage_done">Avklarat</th></tr>' . "\n"; foreach ($DL_CATEGORIES as $handle => $category) { echo '<tr>' . "\n"; echo '<td>' . ($category['completed'] == $category['count'] ? '<img src="http://images.hamsterpaj.net/drivers-license/complete.png" alt="Alla frågor avklarade" />' : ' ') . '</td>'; echo '<td><a href="?action=practice&category=' . $handle . '">' . $category['label'] . '</a></td>' . "\n"; echo '<td>' . $category['count'] . '</td>' . "\n"; echo '<td>' . round($category['completed'] / $category['count'] * 100) . '%</td>' . "\n"; echo '<td><a href="?action=clear_category&category=' . $handle . '" class="category_clear" title="Rensa kategorin ' . strtolower($category['label']) . '"><img src="http://images.hamsterpaj.net/drivers-license/clear.png" alt="Rensa ' . $category['label'] . '" /></a></td>' . "\n"; echo '</tr>' . "\n\n"; } echo '</table>'; }
} /* Check zip_code */ if (!is_numeric($info['zip_code'])) { $return['zip_code'] = 'error'; } $query = 'SELECT spot FROM zip_codes WHERE zip_code = "' . $info['zip_code'] . '" LIMIT 1'; $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__)); if (mysql_num_rows($result) != 1) { $return['zip_code'] = 'error'; } if (count($return) > 0) { return $return; } return true; } if (!login_checklogin()) { echo 'Nu gick något fel, du loggades inte in...'; trace('register_error', 'register.php acsessed by not logged on user...'); } else { if (isset($_POST['submit_button'])) { $check = regform_check($_POST); if ($check === true) { unset($data); $data['userinfo']['gender'] = $_POST['gender']; $data['userinfo']['zip_code'] = $_POST['zip_code']; $data['userinfo']['birthday'] = $_POST['birth_year'] . '-' . $_POST['birth_month'] . '-' . $_POST['birth_day']; login_save_user_data($_SESSION['login']['id'], $data); session_merge($data); /*$alert = 'Tackar! Nu skickar vi dig till en introduktionssida som berättar mer om Hamsterpaj,\\n'; $alert .= 'vad man gör här och hur sidan fungerar, du måste inte läsa den om du inte vill.'; jscript_alert($alert);
echo '<h1>' . $abuse_headers[$_GET['report_type']] . '</h1>'; echo $abuse_info[$_GET['report_type']]; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n"; echo '<input type="hidden" name="report_type" value="' . $_GET['report_type'] . '" />' . "\n"; echo '<input type="hidden" name="reference_id" value="' . $_GET['reference_id'] . '" />' . "\n"; foreach ($abuse_alternatives_by_type[$_GET['report_type']] as $handle) { echo '<input type="radio" name="abuse_type" class="abuse_radio" value="' . $handle . '" id="abuse_' . $handle . '" />' . "\n"; echo '<label for="abuse_' . $handle . '">' . $abuse_types[$handle]['label'] . '</label>' . "\n"; echo '<p>' . $abuse_types[$handle]['description'] . '</p>' . "\n"; } echo '<label for="abuse_freetext">Fritextbeskrivning</label>' . "\n"; echo '<textarea name="freetext" id="abuse_freetext"></textarea>' . "\n"; echo '<input type="submit" class="button_70" value="Nästa »" />' . "\n"; echo '</form>' . "\n"; } } elseif (login_checklogin() && isset($_POST['reference_id']) && is_numeric($_POST['reference_id'])) { $query = 'INSERT INTO abuse (timestamp, reporter, report_type, reference_id, abuse_type, freetext)'; $query .= ' VALUES("' . time() . '", "' . $_SESSION['login']['id'] . '", "' . $_POST['report_type'] . '", "' . $_POST['reference_id'] . '", "' . $_POST['abuse_type'] . '", "' . $_POST['freetext'] . '")'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $url = forum_get_url_by_post($_POST['reference_id']); echo '<h1>Din rapport har sparats</h1>' . "\n"; echo '<p>Vi kommer att granska din rapport och återkomma till dig med ett personligt svar inom 24 timmar.</p>' . "\n"; echo '<h2>Ärende-id: #' . mysql_insert_id() . '</h2>' . "\n"; echo '<br /> <a href="' . $url . '">Gå tillbaka till forumet</a>'; if ($_POST['report_type'] == 'guestbook_entry') { $query = 'UPDATE traffa_guestbooks SET is_private = 0, deleted = 0 WHERE id = "' . $_POST['reference_id'] . '" AND recipient = "' . $_SESSION['login']['id'] . '" LIMIT 1'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); echo '<h1>OBS! Viktigt om rapporterade gästboksinlägg</h1>' . "\n"; echo '<p>För att våra ordningsvakter ska kunna granska ett inlägg får det inte vara privat eller borttaget. Privatisera inte och ta inte bort inlägget!</p>' . "\n"; } } else {
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; }
//$data_array = query_cache(array('query' => $query, 'max_delay' => 60)); $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); while ($data = mysql_fetch_assoc($result)) { $data_array[] = $data; } $user_votes = array(); if (login_checklogin()) { $query = 'SELECT ascii_art_id FROM ascii_art_votes WHERE userid = ' . $_SESSION['login']['id']; $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); while ($vote = mysql_fetch_assoc($query)) { $user_votes[] = $vote['ascii_art_id']; } } foreach ($data_array as $data) { $allow_voting = false; if (login_checklogin() && !in_array($data['id'], $user_votes)) { $allow_voting = true; } echo '<a name="ascii_art_link_' . $data['id'] . '"></a>'; echo '<div class="ascii_art_div">'; echo '<div class="resources">'; echo '<h2>' . $data['title'] . '</h2>' . "\n"; echo ' <a href="#ascii_art_link_' . $data['id'] . '" id="ascii_art_direct_link_show_' . $data['id'] . '">(Direktlänk)</a>'; echo '<input type="text" id="ascii_art_direct_link_input_' . $data['id'] . '" class="ascii_art_direct_link_input" value="http://www.hamsterpaj.net/mattan/ascii_art.php#ascii_art_link_' . $data['id'] . '" />' . "\n"; if (is_privilegied('ascii_art_admin')) { echo ' <a href="?delete=' . $data['id'] . '" onclick="return confirm(\\"Sure?\\")">(X)</a>'; } // Avoid division-by-zero-errors... $voters = (int) $data['voters'] == 0 ? 1 : (int) $data['voters']; echo '<div class="ascii_art_vote" style="background-position: 0px ' . (75 - (round((int) $data['votes'] / $voters) - 1) * 15) . 'px"' . ($allow_voting ? ' id="ascii_art_vote_' . $data['id'] . '_' . round((int) $data['votes'] / $voters) . '"' : '') . ' /> </div>'; echo '</div>';
function discussions_head($discussion, $options) { echo '<div id="discussions_head">' . "\n"; echo '<h1 id="discussion_head_header">' . $discussion['title'] . '</h1>' . "\n"; echo '<input type="hidden" id="discussion_author" value="' . $discussion['author'] . '"/>' . "\n"; echo '<input type="hidden" id="discussion_title" value="' . $discussion['title'] . '"/>' . "\n"; //Starttid och författare echo '<span class="title_short_info">' . "\n"; echo 'Startades ' . fix_time($discussion['timestamp']) . ' av <a href="/traffa/profile.php?id=' . $discussion['author'] . '">'; echo $discussion['author_username'] . '</a> och har ' . $discussion['posts'] . ' inlägg.' . "\n"; echo '</span>' . "\n"; echo ' <div class="tabs" id="discussions_head_tabs">' . "\n"; echo ' <div id="forum_tab_navigation" class="active">Navigering</div>' . "\n"; echo ' <div id="forum_tab_tags">Taggar</div>' . "\n"; // echo ' <div><a href="#">Teknisk analys</a></div>' . "\n"; if ($_SESSION['login']['userlevel'] >= 3) { echo ' <div id="forum_tab_administration">Administration</div>' . "\n"; } echo ' </div>' . "\n"; /* Navigation pane */ echo ' <div class="info_pane_visible" id="forum_info_pane_navigation">' . "\n"; if ($discussion['parent_discussion'] > 0) { $fetch['id'] = $discussion['parent_discussion']; $fetch['limit'] = 1; $parent_discussion = discussions_fetch($fetch); $parent_discussion = $parent_discussion[0]; echo ' Diskussionen en nivå upp, <a href="/forum/' . forum_get_parent_category($parent_discussion['category_handle']) . '/' . $parent_discussion['category_handle'] . '/' . $parent_discussion['handle'] . '/">' . $parent_discussion['title'] . '</a>' . "\n"; } posts_page_list($discussion['posts'], '/forum/' . forum_get_parent_category($discussion['category_handle']) . '/' . $discussion['category_handle'] . '/' . $discussion['handle'] . '/', $options['request']['page_number']); discussions_page_navigation($discussion); if (login_checklogin()) { $query = 'SELECT * FROM discussion_watches WHERE user_id = ' . $_SESSION['login']['id'] . ' AND discussion_id = ' . $discussion['id']; $result = mysql_query($query); if (mysql_fetch_assoc($result)) { $watched = true; } echo ' <div class="discussion_control">'; echo ' <input id="forum_discussion_watch" type="checkbox" value="discussion_watch" ' . ($watched ? 'checked="checked"' : '') . '/>'; echo ' <label for="forum_discussion_watch">Bevaka den här diskussionen</label>'; echo ' </div>'; } echo ' <input type="hidden" id="discussion_id" value="' . $discussion['id'] . '" />' . "\n"; echo ' <br style="clear: both;" />' . "\n"; echo ' </div>' . "\n"; /* Tags begin */ echo ' <div class="info_pane" id="forum_info_pane_tags">' . "\n"; echo '<h3>Diskussionen ligger i kategorin <a href="/forum/' . forum_get_parent_category($discussion['category_handle']) . '/' . $discussion['category_handle'] . '/">' . $discussion['category_tag'] . '</a> och är taggad som</h3>' . "\n"; forum_tag_cloud($discussion['tags']); echo ' </div>' . "\n"; if ($_SESSION['login']['userlevel'] >= 3) { //Kontroller för ordningsvakter $quality_levels = array('1' => 'Väldigt seriös', '0.5' => 'Ganska seriös', '0' => 'Normalseriös', '-0.5' => 'Ganska oseriös', '-1' => 'Totalt oseriös'); echo ' <div class="info_pane" id="forum_info_pane_administration">' . "\n"; echo '<p>Önskad kvalitet: ' . $quality_levels[$discussion['desired_quality']] . ' = ' . $discussion['desired_quality'] . "\n"; echo ', verklig kvalitet: ' . $discussion['quality_rank'] . '</p>'; echo '<div id="discussion_admin_message"></div>' . "\n"; echo '<button class="button_60" id="discussion_rubbish_button" value="' . $discussion['id'] . '">Skräp!</button>'; echo 'Sätter diskussionens önskade kvalitet till "Totalt oseriös"<br/>' . "\n"; echo '<button class="button_60" id="forum_admin_discussion_delete" value="' . $discussion['id'] . '">Ta bort!</button>'; echo 'Tar bort diskussionen (använd med eftertanke)' . "\n"; echo '<div class="forum_admin_tag_edit">' . "\n"; echo '<form action="/forum/admin.php">' . "\n"; echo '<input type="hidden" name="action" value="discussion_category_set" />' . "\n"; echo '<input type="hidden" name="discussion_id" value="' . $discussion['id'] . '" />' . "\n"; echo ' <div class="input_right" >'; echo ' <h5>Du kan flytta diskussionen till en annan kategori här:</h5>' . "\n"; echo ' <select name="category" >' . "\n"; global $FORUM_CATEGORIES; foreach ($FORUM_CATEGORIES as $main_category) { echo ' <optgroup label="' . $main_category['label'] . '">' . "\n"; foreach ($main_category['sub_categories'] as $handle => $sub_category) { echo ' <option value="' . $handle . '"'; if ($discussion['category_handle'] == $handle) { echo ' selected="selected"'; } echo '>' . $sub_category['label'] . '</option>' . "\n"; } echo ' </optgroup>' . "\n"; } echo ' </select>' . "\n\n"; echo '<button class="button_50" id="discussion_category_save_button" >Spara</button>' . "\n"; echo ' </div>'; echo '</form>' . "\n"; echo '<h3>Redigera taggar:</h3>' . "\n"; foreach ($discussion['tags'] as $tag) { $tags[] = $tag['label']; } echo '<input type="text" id="discussion_admin_tag_edit_input" style="width: 80%;" name="tags" value="' . implode(', ', $tags) . '">'; echo '<input type="hidden" value="discussion_id" value="' . $discussion['id'] . '" />' . "\n"; echo '<input type="button" value="Spara taggar" id="discussion_admin_tag_edit_submit" />' . "\n"; echo '<h3>Byt rubrik på diskussionen:</h3>' . "\n"; echo '<input type="text" id="forum_admin_discussion_rename_input" style="width: 80%;" name="rename" value="' . $discussion['title'] . '">'; echo '<input type="button" value="Spara titel" id="forum_admin_discussion_rename" />' . "\n"; echo '</div>' . "\n"; echo '</div>' . "\n"; } echo '</div>' . "\n"; }
<?php require '../include/core/common.php'; include PATHS_INCLUDE . 'libraries/poll.lib.php'; if ($_GET['action'] == 'vote' && is_numeric($_GET['poll_id']) && in_array($_GET['answer_id'], array(1, 2, 3, 4, 5, 6, 7))) { echo 'Ok'; $poll = poll_fetch(array('id' => $_GET['poll_id'])); preint_r($poll); if ($poll[0]['can_answer'] == true) { $query = 'UPDATE poll SET alt_' . $_GET['answer_id'] . '_votes = alt_' . $_GET['answer_id'] . '_votes + 1'; $query .= ' WHERE id = "' . $_GET['poll_id'] . '"'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); if (login_checklogin()) { $query = 'INSERT INTO poll_answers (poll_id, user_id, answer_id) VALUES("' . $_GET['poll_id'] . '", "' . $_SESSION['login']['id'] . '", "' . $_GET['answer_id'] . '")'; mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); } else { } } }
<?php require 'include/core/common.php'; //session_start(); require_once PATHS_LIBRARIES . 'admin.lib.php'; $_GET['id'] = intval($_GET['id']); if (!is_numeric($_GET['id']) && isset($_GET['id'])) { die('FISK ' . $_GET['id']); } if (isset($_GET['refuse']) && is_numeric($_GET['refuse']) && login_checklogin() && is_privilegied('avatar_admin')) { refuse_image($_GET['refuse'], $_SESSION['login']['username']); jscript_alert('Borttaget!'); jscript_selfclose(); die; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Visningsbild på Hamsterpaj</title> <link rel="icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" /> <link rel="shortcut icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" /> <style type="text/css"> @import url('/stylesheets/avatar.css'); @import url('/stylesheets/shared.css'); </style> <script type="text/javascript" language="javascript" src="/javascripts/avatar.js"></script> </head>
function discussion_forum_parse_request($url) { $url = strtolower($url); $url_query_parts = explode('?', $url); $url_anchor_parts = explode('#', $url_query_parts[0]); $url = $url_anchor_parts[0]; if (substr($url, -1) == '/') { $url = substr($url, 0, -1); } if ($url == '/diskussionsforum') { $request['action'] = 'index'; } elseif ($url == '/diskussionsforum/flytta_traad.php' && is_numeric($_POST['new_category'])) { $request['action'] = 'move_thread'; $request['thread'] = array_pop(discussion_forum_post_fetch(array('post_id' => $_POST['thread_id']))); $request['new_category'] = array_pop(discussion_forum_categories_fetch(array('id' => $_POST['new_category']))); } elseif ($url == '/diskussionsforum/nytt_inlaegg.php') { $request['action'] = 'new_post'; } elseif ($url == '/diskussionsforum/soek.php') { $request['action'] = 'search'; $request['freetext'] = substr($url_query_parts[1], 9); } elseif ($url == '/diskussionsforum/nya_traadar.php') { $request['action'] = 'latest_threads'; } elseif ($url == '/diskussionsforum/dina_traadar.php') { $request['action'] = 'threads_by_user'; $request['user_id'] = $_SESSION['login']['id']; } elseif ($url == '/diskussionsforum/notiser.php') { $request['action'] = 'view_notices'; } elseif ($url == '/diskussionsforum/notiser.new.php') { $request['action'] = 'view_new_notices'; } elseif (substr($url, -4) == '.php' && substr($url, strrpos($url, '/'), 11) != '/traadsida_') { // Note: This does NOT have to be a thread, it could also be a help-page such as regler.php // AND, the url might be fomatted like this: /discussionsforum/traad_handtag/sida_1.php $explosion = explode('/', $url); $page_count_start = strrpos($url, '/sida_') + 6; $page_count_end = strrpos($url, '.'); $page_count_length = $page_count_end - $page_count_start; $request['page_num'] = substr($url, $page_count_start, $page_count_length); $request['action'] = 'view_thread'; $request['thread_handle'] = $explosion[count($explosion) - 2]; /*//trace('datamirk', print_r($explosion, true)); $request['category'] = array_pop(discussion_forum_categories_fetch(array('handle' => $explosion[count($explosion)-3]))); if(!in_array($explosion[count($explosion)-3], array('hamsterpaj', 'nyheter', 'buggar_och_fel', 'spel_och_film', 'mellan_himmel_och_jord', 'mat', 'klaeder_och_utseende', 'djur_och_husdjur', 'historier_och_skaemt', 'mobiltelefoner', 'tonaaring', 'relationer', 'kropp_och_pubertet', 'sex', 'familjen', 'vaenner', 'skola', 'pengar', 'fritid', 'sport', 'traening', 'foereningsliv', 'motor', 'musik', 'film_och_tv', 'foto', 'litteratur', 'spel', 'datorspel', 'counter_strike', 'world_of_warcraft', 'xbox', 'playstation', 'nintendo', 'retrokonsoller', 'lajv_och_rollspel', 'datorer', 'support_och_hjaelp', 'haardvara', 'mjukvara', 'operativsystem', 'lan_och_naetverk', 'programmering', 'php_scripting', 'webbdesign', 'min_hemsida', 'vetenskap', 'fysik', 'kemi', 'biologi', 'matematik', 'teknik', 'elektronik', 'astronomi', 'psykologi', 'debatt', 'politik', 'religion', 'jaemstaelldhet', 'miljoe', 'filosofi', 'alkohol_tobak_droger', 'historia', 'oevrigt', 'koep_och_saelj', 'efterlysningar', 'forumlekar', 'listor_omroestningar', 'skraep_och_spam', 'teknik', 'kaerlek', 'open_source', 'presentationsteman', 'forum_error', 'ordningsvaktsforum'))) { if($explosion[count($explosion)-3] != 'diskussionsforum') { trace('extreme_datamirk', $_SESSION['login']['username'] . ':' . $explosion[count($explosion)-3] . ' = ' . print_r($explosion, true)); } }*/ } else { $request['action'] = 'view_category'; $explosion = explode('/', $url); $last_piece = $explosion[count($explosion) - 1]; if (substr($last_piece, 0, 10) == 'traadsida_' && substr($last_piece, -4) == '.php' && is_numeric(substr($last_piece, 10, -4)) && intval(substr($last_piece, 10, -4)) > 0) { $request['page_offset'] = intval(substr(array_pop($explosion), 10, -4)) - 1; } else { $request['page_offset'] = 0; } $handle = array_pop($explosion); if ($handle == url_secure_string($handle)) { $viewers_userlevel = login_checklogin() ? $_SESSION['login']['userlevel'] : 0; $request['category'] = array_pop(discussion_forum_categories_fetch(array('handle' => $handle, 'viewers_userlevel' => $viewers_userlevel, 'disable_query_caching' => true))); $request['category_handle'] = $handle; if (count($request['category']) < 1) { $request['action'] = 'forum_not_found'; } } else { $request['action'] = 'forum_not_found'; } } return $request; }
function ui_notices_fetch() { if (login_checklogin()) { $notices = array(); if ($_SESSION['cache']['lastupdate'] < time() - 20) { cache_update_all(); } $notices['guestbook'] = $_SESSION['notices']['unread_gb_entries']; $notices['discussion_forum'] = array('new_notices' => $_SESSION['forum']['new_notices'], 'subscriptions' => array()); foreach ($_SESSION['forum']['subscriptions'] as $subscription) { if ($subscription['unread_posts'] > 0) { $notices['discussion_forum']['subscriptions'][] = $subscription; } } $notices['groups'] = array('unread_notices' => $_SESSION['cache']['unread_group_notices'], 'groups' => $_SESSION['cache']['group_notices']); $notices['photo_comments'] = $_SESSION['cache']['unread_photo_comments']; return $notices; } else { throw new Exception('Du har blivit utloggad. Logga in igen =D'); } }
discussion_forum_reload_all(); $ui_options['menu_path'][] = 'notices'; $ui_options['title'] = 'Bevakade trådar - Hamsterpaj.net'; $output .= discussion_forum_locator(array('page' => 'notices')); $output .= discussion_forum_list_notices(); $output .= '<h1>Bevakade trådar</h1>' . "\n"; $options['notice_listing'] = true; $output .= discussion_forum_thread_list($_SESSION['forum']['subscriptions'], $options); foreach ($_SESSION['forum']['categories'] as $category) { if ($category['subscribing'] == 1) { $subscribing_categories[] = $category['category_id']; } } if (count($subscribing_categories) > 0) { $output .= '<h1 style="margin-top: 20px;">Kategorier du prenumererar på</h1>' . "\n"; $viewers_userlevel = login_checklogin() ? $_SESSION['login']['userlevel'] : 0; $categories = discussion_forum_categories_fetch(array('id' => $subscribing_categories, 'max_levels' => 0, 'viewers_userlevel' => $viewers_userlevel)); foreach ($categories as $category) { $options['show_new_threads'] = true; $options['forum_id'] = $category['id']; $threads = discussion_forum_post_fetch($options); $output .= '<h2><a href="' . $category['url'] . '">' . $category['title'] . '</a></h2>' . "\n"; if (count($threads) > 0) { // next row gave lef a lot of spokenotices, so that has to be checked before release! // $output .= '<a href="/ajax_gateways/discussion_forum.php?action=set_category_read&category=' . $category['id'] . '&return=' . $_SERVER['REQUEST_URI'] . '">Markera kategori som läst</a>' . "\n"; $options['notice_listing'] = false; $output .= discussion_forum_thread_list($threads, $options); } else { $output .= '<p>Inga nya trådar i kategorin :(</p>' . "\n"; } }
function age_guess_result() { global $AGE_GUESS_COMMENTS; $return .= '<img src="http://images.hamsterpaj.net/images/users/thumb/' . $_SESSION['age_guess']['current_user'] . '" />' . "\n"; $age_diff = $_GET['guessed_age'] == 'skip' ? 1 : $_GET['guessed_age'] - $_SESSION['age_guess']['current_age']; switch (abs($age_diff)) { case 0: $score = 5; $score_class = 'positive'; break; case 1: $score = 0; $score_class = 'unchanged'; break; default: $score = abs($age_diff) * -1 + 1; $score = $score < -5 ? -5 : $score; $score_class = 'negative'; } $return .= '<h2 class="age_guess_score_' . $score_class . '">' . $score . 'p</h2>' . "\n"; foreach ($AGE_GUESS_COMMENTS as $comment => $differences) { foreach ($differences as $difference) { $comments_by_diff[$difference][] = $comment; } } $comment = $_GET['guessed_age'] == 'skip' ? 'Hoppade över' : $comments_by_diff[$age_diff][rand(0, count($comments_by_diff[$age_diff]) - 1)]; $return .= '<h2>' . $comment . '</h2>' . "\n"; $return .= '<p class="age_guess_answer_text"><a href="/traffa/profile.php?id=' . $_SESSION['age_guess']['current_user'] . '">' . $_SESSION['age_guess']['current_username'] . '</a>' . "\n"; $return .= ' är ' . $_SESSION['age_guess']['current_age'] . ' år</p>'; $return .= '<button onclick="window.open(\'/traffa/profile.php?id=' . $_SESSION['age_guess']['current_user'] . '\');">Besök i nytt fönster</button>' . "\n"; if (is_numeric($_GET['guessed_age'])) { event_log_log('age_guess_guess'); /* Log answer to database */ $insertquery = 'INSERT INTO age_guess_logs (user, age_' . $_GET['guessed_age'] . ') VALUES("' . $_SESSION['age_guess']['current_user'] . '", 1)'; $updatequery = 'UPDATE age_guess_logs SET age_' . $_GET['guessed_age'] . ' = age_' . $_GET['guessed_age'] . ' + 1 WHERE user = "******" LIMIT 1'; mysql_query($insertquery) or mysql_query($updatequery); if (login_checklogin()) { $correct = $age_diff == 0 ? 1 : 0; $insertquery = 'INSERT INTO age_guess_scoring (user, week, score, viewed_images, correct_guesses, correct_ratio)'; $insertquery .= ' VALUES("' . $_SESSION['login']['id'] . '", "' . date('YW') . '", "' . $score . '", 1, ' . $correct . ', correct_guesses/viewed_images)'; $updatequery = 'UPDATE age_guess_scoring SET score = score + ' . $score . ', viewed_images = viewed_images + 1, correct_guesses = correct_guesses + ' . $correct . ', correct_ratio = correct_guesses/viewed_images'; $updatequery .= ' WHERE user = "******" AND week = "' . date('YW') . '" LIMIT 1'; mysql_query($insertquery) or mysql_query($updatequery); $_SESSION['age_guess']['score'] += $score; $_SESSION['age_guess']['correct_guesses'] += $correct; if ($_SESSION['age_guess']['score'] < -10) { $_SESSION['age_guess']['score'] = -10; $query = 'UPDATE age_guess_scoring SET score = -10 WHERE user = "******" AND week = "' . date('YW') . '" LIMIT 1'; mysql_query($query); } /* Find out if the remote user is online, if so, open the session and send a quicknote about the vote */ if ($score != 5) { $query = 'SELECT session_id, lastaction FROM login WHERE id = "' . $_SESSION['age_guess']['current_user'] . '" LIMIT 1'; $result = mysql_query($query); if ($data = mysql_fetch_assoc($result)) { if ($data['lastaction'] > time() - 600) { $remote_session = session_load($data['session_id']); $remote_session['notice_message'] = 'Du, <a href="/traffa/profile.php?id=' . $_SESSION['login']['id'] . '">' . $_SESSION['login']['username'] . '</a> gissade nyss att du är ' . $_GET['guessed_age'] . ' år gammal i <a href="/traffa/age_guess.php">Gissa Åldern</a>!'; session_save($data['session_id'], $remote_session); } } } } } return $return; }
function promoe_paintboard($promoe = null) { if (isset($promoe) && login_checklogin()) { $query = 'SELECT user FROM promoe_hypes WHERE user = "******" AND promoe = "' . $promoe['id'] . '" LIMIT 1'; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { echo '<input type="button" class="button" id="promoe_hype_button" value="Hypa" />' . "\n"; } else { echo '<span class="promoe_already_hyped">Du har redan hypat denna Promoe</span>' . "\n"; } } $heading = isset($promoe) ? $promoe['description'] . ' ritad av <a href="/traffa/profile.php?id=' . $promoe['author_id'] . '">' . $promoe['author_username'] . '</a>' : 'Rita en ny Promoe'; echo '<h1>' . $heading . '</h1>' . "\n"; ?> <div class="promoe_editor"> <div class="left"> <div id="promoe_paintboard"> <h2>Bilden laddas</h2> <p> Det kan ta några sekunder att ladda bilden, den laddas inte förrens resten av sidan har laddat klart. </p> </div> <div class="promoe_save_restart"> <input type="button" value="Rita en ny bild" id="promoe_restart_button" /> <input type="button" value="Spara bilden" id="promoe_save_button" /> <input type="button" value="Förhandsgranska" id="promoe_preview_button" /> </div> </div> <div class="right"> <div class="promoe_colors"> <h3>Färgväljare</h3> <?php require_once PATHS_CONFIGS . 'promoe.conf.php'; foreach ($promoe_colors as $color) { echo '<div id="promoe_color_' . substr($color, 1) . '" style="background: ' . $color . '" class="promoe_color"> </div>' . "\n"; } ?> </div> <div class="promoe_drawing_mode"> <div class="promoe_drawing_mode_pen"> <input type="radio" value="Pennan" id="promoe_drawing_mode_pen" checked="checked" name="promoe_painting_mode" /> <label for="promoe_drawing_mode_pen">Pennan</label> </div> <input type="radio" value="flood_fill" id="promoe_drawing_mode_flood_fill" name="promoe_painting_mode" /> <label for="promoe_drawing_mode_flood_fill">Färghinken</label> </div> <div class="promoe_grid_control"> <input type="button" value="Visa rutnätet" id="promoe_grid_control" /> </div> </div> </div> <div id="promoe_preview"> </div> <?php echo '<script>' . "\n"; echo 'var imagestring = \'' . $promoe['imagestring'] . '\';' . "\n"; $parent = $promoe['parent'] > 0 ? $promoe['parent'] : $promoe['id']; echo 'var promoe_parent = \'' . $parent . '\';' . "\n"; echo 'var promoe_id = \'' . $promoe['id'] . '\'' . "\n"; echo '</script>' . "\n"; }
} else { $add_to_list = true; foreach ($_SESSION['profile_visits'] as $current) { if ($current['id'] == $user_id) { $add_to_list = false; } } if ($add_to_list == true) { array_unshift($_SESSION['profile_visits'], array('id' => $user_id, 'username' => $userinfo['login']['username'], 'timestamp' => time())); } } } if (count($_SESSION['profile_visits']) >= 10) { array_splice($_SESSION['profile_visits'], 10); } if (login_checklogin() == 1 && $user_id != $_SESSION['login']['id']) { /* Log the visit to database */ $query = 'INSERT INTO user_event_log(user, action, remote_user_id, timestamp) '; $query .= 'VALUES("' . $user_id . '", "profile_visit", "' . $_SESSION['login']['id'] . '", "' . time() . '")'; mysql_query($query) or die(report_sql_error($query)); /* Log the visit to database - New system */ $increase_profile_visitors = true; foreach ($_SESSION['profile_visits'] as &$current) { if ($current['id'] == $user_id) { if (isset($current['timestamp']) && $current['timestamp'] > time() - 120) { $increase_profile_visitors = false; } // Note: $current is a pointer! $current['timestamp'] = time(); } }
<?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']);
<?php require '../include/core/common.php'; if (login_checklogin() && isset($_GET['upload_ticket']) && isset($_GET['photo_id']) && $_GET['upload_ticket'] && is_numeric($_GET['photo_id'])) { if (isset($_SESSION['photoblog']['upload']['upload_tickets'][$_GET['upload_ticket']][$_GET['photo_id']])) { $real_photo_id = $_SESSION['photoblog']['upload']['upload_tickets'][$_GET['upload_ticket']][$_GET['photo_id']]; $folder = floor($real_photo_id / 5000); header('HTTP/1.0 301 Moved Permanently'); header('Location: http://images.hamsterpaj.net/photos/thumb/' . $folder . '/' . $real_photo_id . '.jpg'); } }
mysql_query($query); } } $out .= '<p style="margin-top: 2px;"><a style="color: #565656; text-decoration: underline;" href="' . forum_get_url_by_post($module['thread_id']) . '" class="fp_moudle_commenting">Kommentera i forumet</a></p>' . "\n"; } if ($module['piraja'] == 'true') { $out .= '<p style="margin-top: 2px;"><a style="color: #565656; text-decoration: underline;" href="/piraja/prylar.php">Flera prylar</a></p>' . "\n"; } $out .= '<br style="font-size: 0px; height: 0px; clear: both; line-height: 0px;" />' . "\n"; if ($module['commenting'] == 'true' || $module['published'] == 'true' || $module['grading'] == 'true') { $out .= '<div class="controls">' . "\n"; if ($module['published'] == 'true') { $out .= '<p class="fp_module_published">Upplagd ' . date('Y-m-d', $module['launch']) . '</p>' . "\n"; } if ($module['grading'] == 'true') { if (login_checklogin() && !in_array($module['id'], $_SESSION['fp_module_votes'])) { $out .= '<img src="http://images.hamsterpaj.net/discussion_forum/thread_voting_plus.png" class="fp_vote" id="fp_vote_plus_' . $module['id'] . '" />' . "\n"; $out .= '<img src="http://images.hamsterpaj.net/discussion_forum/thread_voting_minus.png" class="fp_vote" id="fp_vote_minu_' . $module['id'] . '" />' . "\n"; } $out .= '<p class="fp_module_score"><span id="fp_module_score_' . $module['id'] . '">' . $module['score'] . '</span>p</p>' . "\n"; } if ($module['clicks'] > 0) { $out .= '<p>' . cute_number($module['clicks']) . ' klick</p>' . "\n"; } $out .= '</div>' . "\n"; } if ($module['format'] == '2_3') { $out .= '</div>' . "\n"; $out .= '<div class="puff">' . "\n"; $puff_query = 'SELECT * FROM fp_puffs ORDER BY id ASC'; $puffs = query_cache(array('category' => 'fp_puffs', 'max_limit' => 600, 'query' => $puff_query));
<?php require '../include/core/common.php'; require PATHS_INCLUDE . 'libraries/profile.lib.php'; require PATHS_INCLUDE . 'libraries/userblock.lib.php'; require PATHS_INCLUDE . 'libraries/guestbook.lib.php'; $ui_options['stylesheets'][] = 'user_profile.css'; $ui_options['stylesheets'][] = 'rounded_corners_tabs.css'; $ui_options['stylesheets'][] = 'discussion_forum.css'; if (isset($_GET['id']) && is_numeric($_GET['id'])) { $params['user_id'] = $_GET['id']; } elseif (isset($_GET['user_id']) && is_numeric($_GET['user_id'])) { $params['user_id'] = $_GET['user_id']; } elseif (login_checklogin()) { $params['user_id'] = $_SESSION['login']['id']; } if (userblock_checkblock($params['user_id'])) { ui_top(); echo '<p class="error">IXΘYΣ! Du har blivit blockad, var snel hest så slipper du sånt ;)<br /><em>Visste du förresten att IXΘYΣ betyder Fisk på grekiska?</em></p>'; ui_bottom(); exit; } /* Fetching Username and setting page title */ $query = 'SELECT username FROM login WHERE id = "' . $params['user_id'] . '" LIMIT 1'; $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__); $data = mysql_fetch_assoc($result); $profile = profile_fetch($params); $ui_options['title'] .= $data['username'] . ' - Hamsterpaj.net'; $ui_options['stylesheets'][] = 'profile_themes/' . $profile['profile_theme'] . '.css'; ui_top($ui_options); echo profile_mini_page($profile);