<?php require '../include/core/common.php'; require PATHS_INCLUDE . '../survey/library.php'; $ui_options['menu_path'] = array('hamsterpaj', 'gamla_undersoekningar'); $ui_options['title'] = 'Gamla undersökningar som körts på Hamsterpaj'; $ui_options['stylesheets'][] = 'survey.css'; $ui_options['javascripts'][] = 'survey.js'; ui_top($ui_options); echo '<div id="old_surveys">' . "\n"; if (isset($_GET['survey_id']) && is_numeric($_GET['survey_id'])) { $survey = survey_fetch(array('type' => 'front_page', 'id' => $_GET['survey_id'])); echo survey_draw_frame($survey); } echo '<h1>Gamla undersökningar på Hamsterpaj</h1>' . "\n"; $surveys = survey_fetch(array('type' => 'front_page'), array('limit' => 999999, 'order-by' => 'start_time')); foreach ($surveys as $survey) { if ($current_month != date('Y_m', $survey['start_time'])) { if (isset($current_month)) { echo '</ul>' . "\n"; } echo '<h2>' . date('F', $survey['start_time']) . ' -' . date('y', $survey['start_time']) . '</h2>' . "\n"; $current_month = date('Y_m', $survey['start_time']); echo '<ul>' . "\n"; } echo "\n" . '<li><span class="date">' . date('d/m', $survey['start_time']) . '</span> <a href="?survey_id=' . $survey['id'] . '" class="question">' . $survey['question'] . '</a></li>' . "\n"; } echo '</ul>' . "\n"; echo '</div>' . "\n"; ui_bottom(); ?>
function group_list_messages($options) { $groupid = $options['group_id']; /* Fetch the total messages in group */ $selectquery = 'SELECT message_count AS total, owner FROM groups_list WHERE groupid = ' . $groupid; $result = mysql_query($selectquery) or die(report_sql_error($selectquery)); $data = mysql_fetch_assoc($result); $total_msg = $data['total']; $new_messages = $data['total']; /* Get the group owner */ $owner = $data['owner']; /* Fetch read_msg for this user */ $selectquery = 'SELECT read_msg AS total_read FROM groups_members WHERE groupid = ' . $groupid . ' AND userid = ' . $_SESSION['login']['id']; $result = mysql_query($selectquery) or die(report_sql_error($selectquery)); $data = mysql_fetch_assoc($result); $query = 'UPDATE groups_members SET read_msg = ' . $total_msg . ' WHERE userid = ' . $_SESSION['login']['id'] . ' AND groupid = ' . $groupid; mysql_query($query) or die(report_sql_error($query)); $_SESSION['cache']['groups_notices'][$groupid]['unread_messages'] = 0; $new_messages = $new_messages - $data['total_read']; /* Update the read_msg */ $query = 'SELECT login.username, groups_scribble.userid, groups_scribble.timestamp, groups_scribble.text, groups_scribble.id, userinfo.image, userinfo.birthday FROM login, groups_scribble, userinfo WHERE login.id = groups_scribble.userid AND groups_scribble.groupid = ' . $groupid . ' AND userinfo.userid = groups_scribble.userid AND groups_scribble.deleted = 0 ORDER BY groups_scribble.id DESC LIMIT ' . ($options['page'] - 1) * 100 . ', 100'; //Lef hackar via råd från heggan. Maskroskisseporr ska inte synas för hennes söta ögon. if ($_SESSION['login']['id'] == '148153') { /* Fetch the total messages in group */ $query = 'SELECT login.username, groups_scribble.userid, groups_scribble.timestamp, groups_scribble.text, groups_scribble.id, userinfo.image, userinfo.birthday FROM login, groups_scribble, userinfo WHERE groups_scribble.text NOT LIKE "%maskrosp0rn%" AND login.id = groups_scribble.userid AND groups_scribble.groupid = ' . $groupid . ' AND userinfo.userid = groups_scribble.userid AND groups_scribble.deleted = 0 ORDER BY groups_scribble.id DESC LIMIT ' . ($options['page'] - 1) * 100 . ', 100'; } //Död åt lef $result = mysql_query($query) or die(report_sql_error($query)); /* $count_read - Hur många msg har gruppen */ $count_read = 0; while ($data = mysql_fetch_assoc($result)) { for ($i = 0; $i < count($surveys); $i++) { if ($surveys[$i]['start_time'] >= $data['timestamp']) { echo survey_draw_frame($surveys[$i]); unset($surveys[$i]); } } $div_code = $count_read < $new_messages ? 'orange' : 'blue'; if (preg_match("/(" . $_SESSION['login']['username'] . "|Magic word: igotgodmodeigotgubbmode)/i", $data['text'])) { $div_code = 'orange_deluxe'; } echo rounded_corners_top(array('color' => $div_code)); echo '<table class="body" style="width: 95%;"><tr><td style="vertical-align: top; width: 75px;">'; if ($data['image'] == 1 || $data['image'] == 2) { echo ui_avatar($data['userid']); } else { echo '<img src="' . IMAGE_URL . 'user_no_image.png" alt="Ingen visningsbild"/>'; } echo '</td><td style="vertical-align: top;">'; echo fix_time($data['timestamp']) . ' <a href="javascript:void(0);" onclick="javascript:document.postform.group_message.value=document.postform.group_message.value + \'' . $data['username'] . ': \';document.postform.group_message.focus();">[^]</a><br/>'; echo '<a href="/traffa/profile.php?id=' . $data['userid'] . '">'; echo '<b>' . ($data['userid'] == 43273 ? '<span style="color: #FF60B6">GheyAtrapp</span>' : $data['username']) . '</b></a> '; if ($owner == $_SESSION['login']['id'] || is_privilegied('groups_superadmin')) { echo '<a href="' . $_SERVER['PHP_SELF'] . '?action=remove_post&groupid=' . $groupid . '&postid=' . $data['id'] . '" onclick="return confirm(\'Vill du verkligen ta bort posten?\')">[Ta bort]</a>'; } echo ui_birthday_cake($data['birthday']) . ' '; echo '<br/>'; echo setSmilies(discussion_forum_parse_output($data['text'])); echo '</td></tr></table>'; echo rounded_corners_bottom(array('color' => $div_code)); $count_read++; } }