Пример #1
0
function discussion_forum_post_render($data, $parent_post = array(), $options = array())
{
    $options['post'] = $data;
    /*
    			[id] => 2 [handle] => normal_vikt [author] => 3 [timestamp] => 1200341971 [parent_post] => 0 [forum_id] => 0
    			[forum_type] => public_forum [title] => Normal vikt? [content] => Denna post har skapats av en funktion! [score] => 0 
    			[verified] => 0 [removed] => 0 [removal_comment] => [remover] => 0 [child_count] => 1 [locked] => 0 [sticky] => 0
    			[last_post] => 0 [anonymous] => 0 [username] => Johan [birthday] => 1988-09-10 [gender] => m [spot] => Göteborg
    */
    $warned = 0;
    $options['show_post_controls'] = isset($options['show_post_controls']) ? $options['show_post_controls'] : true;
    $options['show_removed_posts_content'] = isset($options['show_removed_posts_content']) ? $options['show_removed_posts_content'] : false;
    $return = '<a name="post_' . $data['id'] . '"></a>' . "\n";
    $return .= '<input type="hidden" id="post_' . $data['id'] . '_author_username" value="' . $data['username'] . '" />' . "\n";
    $return .= '<div class="forum_post_container">' . "\n";
    if ($data['removed'] == 1 && $options['show_removed_posts_content'] != true) {
        $return .= '<div class="forum_post_removed">Inlägget har tagits bort' . "\n";
        $return .= $options['show_post_controls'] == true && forum_security(array('action' => 'unremove_post')) ? '<button value="' . $data['id'] . '" class="forum_unremove_button">trob At</button>, Borttaget av <a href="/traffa/profile.php?id=' . $data['remover'] . '">' . $data['remover'] . '</a>.' . "\n" : '';
        $return .= '</div>';
    } else {
        $return .= strpos(strtolower($data['content']), strtolower($_SESSION['login']['username'])) ? '<div class="highlight">' . "\n" : '';
        $return .= '<div class="forum_post_top"></div>' . "\n";
        $return .= '<div class="forum_post" id="forum_post_' . $data['id'] . '">' . "\n";
        $return .= '<div class="author">' . "\n";
        if (strtolower($data['username']) == 'vit_seger') {
            $data['username'] = '******';
        }
        $return .= '<a class="username" href="/traffa/profile.php?id=' . $data['author'] . '">' . $data['username'];
        $return .= '</a>' . "\n";
        $return .= $data['author'] == 2 ? '&nbsp;<a href="/diskussionsforum/hamsterpaj/veckans_ros/" title="Veckans ros"><img src="http://images.hamsterpaj.net/ros.png" alt="Ros" style="width: 11px; height: 17px;border:0;" /></a><br style="clear: both;" />' . "\n" : '';
        $return .= '<div class="passepartout">' . "\n";
        $return .= ui_avatar($data['author']);
        $return .= '</div>' . "\n";
        $return .= '<span class="gender">' . str_replace(array('m', 'f', 'u'), array('P', 'F', ''), $data['gender']) . '</span>' . "\n";
        if ($data['birthday'] != '0000-00-00') {
            $return .= '<span class="age">' . date_get_age($data['birthday']) . '</span>' . "\n";
        }
        if (strlen($data['spot']) > 0) {
            $return .= ' <span class="location">' . $data['spot'] . '</span>' . "\n";
        }
        if ($data['last_warning'] > time() - 604800) {
            $return .= '<span class="warned">Varnad ' . '</span>' . "\n";
        } elseif (strlen($data['forum_userlabel']) > 0) {
            $return .= '<span class="userlevel">' . $data['forum_userlabel'] . '</span>' . "\n";
        } elseif ($data['regtimestamp'] < time() - 86400 * 356 * 2.5) {
            $return .= '<span class="userlevel">Veteran</span>' . "\n";
        } elseif ($data['regtimestamp'] < time() - 86400 * 356) {
            $return .= '<span class="userlevel">Stammis</span>' . "\n";
        } elseif ($data['regtimestamp'] > time() - 86400 * 7) {
            $return .= '<span class="userlevel">Nykomling</span>' . "\n";
        }
        if ($data['quality_level'] == 1) {
            $return .= '<span class="post_count">' . cute_number($data['author_spam_count']) . ' spam</span>' . "\n";
        } else {
            if ($data['author'] == 15) {
                $author_post_count = 'Några osöta';
            } elseif ($data['author'] == 87926) {
                $author_post_count = 'Många söta';
            } elseif ($data['author'] == 774586) {
                $author_post_count = 'Inte många';
            } elseif ($data['author'] == 787082) {
                $author_post_count = 'Många schmarta';
            } elseif ($data['author'] == 891711) {
                $author_post_count = '';
            } elseif ($data['author'] == 299825) {
                $author_post_count = '666 hatiska inlägg';
            } else {
                $author_post_count = cute_number($data['author_post_count']);
            }
            $return .= '<span class="post_count">' . $author_post_count . ' inlägg</span>' . "\n";
        }
        if ($data['lastaction'] > time() - 600) {
            $return .= '<span class="online_status">Online</span>' . "\n";
        }
        $return .= ui_birthday_cake($data['birthday']) . "\n";
        $return .= '</div>' . "\n";
        $return .= '<div class="post_info">' . "\n";
        $return .= '<span class="post_timestamp">' . fix_time($data['timestamp']) . '</span>' . "\n";
        $return .= $data['parent_post'] == 0 ? '<h3>' . $data['title'] . '</h3>' : '';
        $return .= '</div>' . "\n";
        $return .= '<div class="post_content">' . "\n";
        $return .= $data['removed'] == 1 ? '<strong>Inlägget är borttaget!</strong><br />' . "\n" : '';
        $return .= discussion_forum_parse_output($data['content'], $options);
        if (strlen($data['user_status']) > 0) {
            $return .= '<p class="user_status">' . $data['user_status'] . '</p>' . "\n";
        }
        $return .= '</div>' . "\n";
        $return .= '<div class="controls">' . "\n";
        if ($options['show_post_controls'] == true) {
            $return .= '<input type="text" class="forum_direct_link_input" id="forum_direct_link_input_' . $data['id'] . '" />';
            $return .= '<button id="forum_direct_link_button_' . $data['id'] . '" class="forum_direct_link_button">Länk</button>' . "\n";
            $return .= forum_security(array('action' => 'remove_post')) ? '<button value="' . $data['id'] . '" class="forum_remove_button">Ta bort</button>' . "\n" : '';
            $return .= forum_security(array('action' => 'edit_post', 'post' => $data)) || forum_security(array('action' => 'post_addition', 'post' => $data)) ? '<button id="forum_edit_button_' . $data['id'] . '" class="forum_edit_button">Ändra</button>' . "\n" : '';
            $return .= forum_security() ? '<button id="post_reply_' . $data['id'] . '" class="forum_reply_button">Citera</button>' . "\n" : '';
            $return .= forum_security(array('action' => 'reply', 'post' => $parent_post)) === true ? '<button id="post_reply_' . $data['id'] . '" class="forum_reply_button">Svara</button>' . "\n" : '';
            $return .= login_checklogin() ? '<button id="post_comment_' . $data['author'] . '" class="forum_comment_button" value="' . $data['id'] . '">Gästbok</button>' . "\n" : '';
            if (forum_security()) {
                $return .= '<input type="checkbox" class="post_move_check" name="post[]" value="' . $data['id'] . '" id="forum_move_check_' . $data['id'] . '" />';
                $return .= '<label for="forum_move_check_' . $data['id'] . '">Flytta</label>' . "\n";
            }
            $return .= forum_security(array('action' => 'user_ro')) ? '<button value="' . $data['username'] . '" class="forum_user_ro">QL</button>' . "\n" : '';
            $return .= forum_security(array('action' => 'report')) ? '<a href="/hamsterpaj/abuse.php?report_type=forum_post&reference_id=' . $data['id'] . '" class="abuse_button"><img src="http://images.hamsterpaj.net/abuse.png" /></a>' . "\n" : '';
            $return .= guestbook_form(array('recipient' => $data['author'], 'form_id' => 'forum_comment_' . $data['id']));
        } else {
            $return .= '<small>Knappar har inaktiverats</small>';
        }
        $return .= '</div>' . "\n";
        $return .= '</div>' . "\n";
        $return .= '<div class="forum_post_bottom"> </div>' . "\n";
        $return .= strpos(strtolower($data['content']), strtolower($_SESSION['login']['username'])) ? '</div>' . "\n" : '';
    }
    $return .= '</div>' . "\n";
    return $return;
}
Пример #2
0
     ui_bottom();
     exit;
     //Important!
 }
 $ui_options['stylesheets'][] = 'profile_themes/' . $profile['profile_theme'] . '.css';
 $out .= '<div class="profile_' . $profile['profile_theme'] . '">' . "\n";
 $out .= profile_head($profile);
 $out .= '</div>' . "\n";
 $ui_options['stylesheets'][] = 'user_profile.css';
 $ui_options['javascripts'][] = 'user_profile.js';
 if (isset($_GET['history'])) {
     $fetch['recipient'] = array($fetch['recipient'], $_GET['history']);
     $fetch['sender'] = $fetch['recipient'];
 }
 if (!isset($_GET['history']) && login_checklogin() && $fetch['recipient'] != $_SESSION['login']['id'] && !is_array($fetch['recipient'])) {
     $out .= guestbook_form(array('recipient' => $fetch['recipient']));
 }
 $entries = guestbook_fetch($fetch);
 $out .= guestbook_list($entries);
 if (login_checklogin()) {
     foreach ($entries as $entry) {
         if ($entry['recipient'] == $_SESSION['login']['id'] && $entry['read'] == 0) {
             $update_read[] = $entry['id'];
         }
     }
     if (count($update_read) > 0) {
         $query = 'UPDATE traffa_guestbooks SET `read` = 1 WHERE id IN("' . implode('", "', $update_read) . '")';
         mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
         $_SESSION['notices']['unread_gb_entries'] -= count($update_read);
     }
     $_SESSION['notices']['unread_gb_entries'] = 0;
Пример #3
0
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;
}
Пример #4
0
    }
    // Joar är stolt över detta, ge honom en klapp på ryggen.
    $title_start = $profile['username'];
    $title_end = ' gästbok - Hamsterpaj.net';
    $title_end = strtolower(substr($profile['username'], -1)) != "s" ? 's' . $title_end : $title_end;
    $ui_options['title'] = $title_start . $title_end;
    $ui_options['stylesheets'][] = 'user_profile.css';
    if (strlen($profile['profile_theme']) > 0) {
        $ui_options['stylesheets'][] = 'profile_themes/' . $profile['profile_theme'] . '.css';
    }
    $out .= profile_mini_page($profile);
    $ui_options['javascripts'][] = 'user_profile.js';
    $ui_options['header_extra'] .= '<link href="/rss/' . $profile['username'] . '" rel="alternate" type="application/rss+xml" title="' . rtrim($profile['username'], 's') . 's' . ' gästbok som RSS-flöde" />';
    $out .= guestbook_p12_shield($profile['gb_anti_p12']);
    if (!isset($_GET['history']) && login_checklogin() && $fetch['recipient'] != $_SESSION['login']['id'] && !is_array($fetch['recipient'])) {
        $out .= guestbook_form(array('recipient' => $fetch['recipient'], 'username' => $profile['username']));
    }
    if (!is_array($fetch['recipient']) && $fetch['recipient'] == $_SESSION['login']['id']) {
        if ($_SESSION['login']['id'] == $fetch['recipient']) {
            $out .= '<form style="display:inline;" action="/traffa/guestbook.php" method="post" onsubmit="return confirm(\'Är du säker på att du vill radera ALLA dina gästboksinlägg?\\n\\nDU KAN INTE ÅNGRA DETTA\');">
			<input type="hidden" name="guestbook_remove_all">
			<input type="submit" id="guestbook_remove_all" class="button_130" value="Radera alla inlägg" />
			</form>' . "\n";
        }
        $out .= '<button id="guestbook_zero_unread" class="button_150">Markera alla som lästa</button>' . "\n";
        $out .= '<div style="padding-top: 4px;" height><a href="/rss/' . $profile['username'] . '" style="float:right;" title="RSS-flöde"><img src="' . IMAGE_URL . 'rss-23x23.png" alt="RSS-flöde" /></a></div><span style="clear:both;">&nbsp;</span>';
    }
    if (isset($_GET['history'])) {
        $fetch['recipient'] = array($fetch['recipient'], $_GET['history']);
        $fetch['sender'] = $fetch['recipient'];
    }