本文整理汇总了PHP中date_get_age函数的典型用法代码示例。如果您正苦于以下问题:PHP date_get_age函数的具体用法?PHP date_get_age怎么用?PHP date_get_age使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_get_age函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_entries
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;
}
示例2: irl_attending
function irl_attending($options)
{
$query = 'SELECT DISTINCT l.id, l.username, i.*, u.birthday, z.spot, u.gender ';
$query .= 'FROM login AS l, userinfo AS u, irl_attendings AS i, zip_codes AS z ';
$query .= 'WHERE i.user_id = l.id AND z.zip_code = u.zip_code AND i.user_id = u.userid AND i.irl_id = "' . $_GET['irl'] . '" AND i.attending = "' . $options['attending'] . '" ';
$query .= 'ORDER BY i.irl_title DESC LIMIT 200';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
$output .= $options['attending'] == 'yes' ? '<h2 style="margin-top: 0;">De som kommer(' . mysql_num_rows($result) . ')</h2>' : '<h2 style="margin-top: 0;">De som kanske kommer(' . mysql_num_rows($result) . ')</h2>' . "\n";
$output .= '<table style="width: 638px;">' . "\n";
$output .= '<tr>' . "\n";
$output .= '<th>Användare</th>' . "\n";
$output .= '<th></th>' . "\n";
$output .= '<th>Titel</th>' . "\n";
$output .= '<th>Har sängplatser för</th>' . "\n";
$output .= '<th>Behöver sängplats</th>' . "\n";
$output .= '<th>Bor</th>' . "\n";
$output .= '</tr>' . "\n";
while ($data = mysql_fetch_assoc($result)) {
$output .= '<tr>' . "\n";
$output .= '<td><a href="http://www.hamsterpaj.net/traffa/profile.php?user_id=' . $data['user_id'] . '">' . $data['username'] . '</a></td>' . "\n";
$output .= '<td>' . "\n";
$genders = array('m' => 'kille', 'f' => 'tjej');
$output .= $data['gender'];
$output .= $data['birthday'] != '0000-00-00' ? '<span class="age">' . date_get_age($data['birthday']) . '</span> ' : '';
$output .= '</td>' . "\n";
$output .= '<td>' . $data['irl_title'] . '</td>' . "\n";
$output .= '<td>' . $data['has_beds'] . '</td>' . "\n";
$output .= '<td>' . ($data['needs_beds'] == '1' ? 'Ja' : 'Nej') . '</td>' . "\n";
$output .= '<td>' . $data['spot'] . '</td>' . "\n";
$output .= '</tr>' . "\n";
}
$output .= '</table>' . "\n";
return $output;
}
示例3: viewPosts
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
}
示例4: live_chat_event
function live_chat_event($options)
{
$event['id'] = live_chat_event_id(array('type' => $options['type'], 'reference_id' => $options['reference_id']));
$event['timestamp'] = date('H:i');
$event['event_type'] = $options['event_type'];
$event['message'] = str_replace(array("\r", "\n"), null, nl2br($options['message']));
$event['username'] = isset($options['username']) ? $options['username'] : $_SESSION['login']['username'];
$event['user_id'] = $_SESSION['login']['id'];
$event['age'] = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? date_get_age($_SESSION['userinfo']['birthday']) : 0;
if ($options['username'] == $_SESSION['login']['username'] && $_SESSION['userinfo']['image'] == 2) {
$event['user_photo'] = $_SESSION['login']['id'];
}
if ($_SESSION['login']['username'] == 'Snaxman' && rand(1, 5) == 3) {
$event['message'] .= ' Förresten, Justin Timberlake är inte så bra...';
}
$line = "\n" . serialize($event);
file_put_contents(LIVE_CHAT_STORAGE_PATH . $options['type'] . '/' . $options['reference_id'], $line, FILE_APPEND);
}
示例5: render_friends_list
function render_friends_list($friends, $params = array())
{
$return .= '<ul class="friends_list">' . "\n";
foreach ($friends as $friend) {
$return .= '<li>' . "\n";
if ($friend['image'] == 1 || $friend['image'] == 2) {
$return .= ui_avatar($friend['user_id']) . "\n";
}
$return .= '<a href="/traffa/profile.php?id=' . $friend['user_id'] . '">' . $friend['username'] . '</a>' . "\n";
$genders = array('f' => 'F', 'm' => 'P');
$return .= isset($genders[$friend['gender']]) ? $genders[$friend['gender']] : '';
$return .= $friend['birthday'] != '0000-00-00' ? date_get_age($friend['birthday']) : '';
$return .= $friend['lastaction'] > time() - 600 ? '<span class="online">online</span>' : '';
if ($params['user_id'] == $_SESSION['login']['id'] && ($params['friend_type'] == 'idol' || $params['friend_type'] == 'friend')) {
$return .= '<a class="relation_end_control" href="/traffa/friends.php?user_id=' . $friend['user_id'] . '&action=removefriend">[Avsluta relationen]</a>' . "\n";
}
$return .= '</li>' . "\n";
}
$return .= '</ul>' . "\n";
return $return;
}
示例6: guestbook_list
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=' . $entry['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;
}
示例7: array
$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;
ui_bottom();
?>
示例8: comments_list
/**
* 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;
}
示例9: while
<div style="float: left; width: 23%;">Från</div>
<div style="float: left; width: 33%; text-align: right;">Besökstid</div>
<br style="clear: both;"/>
</div>';
$x = 0;
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'];
$x++;
echo '
<div style="padding: 3px; ' . ($x % 2 ? 'background: #fffaef;' : '') . '">
<div style="float: left; width: 3%;"><img src="' . IMAGE_URL . '/famfamfam_icons/' . ($data['gender'] == 'f' ? 'user_female.png' : ($data['gender'] == 'm' ? 'user.png' : 'user_gray.png')) . '"/></div>
<div style="float: left; width: 40%;">
<div style="float: left; width: 90%;">
<a href="/traffa/profile.php?id=' . $data['user_id'] . '">' . $data['username'] . '</a>' . ($data['birthday'] != '0000-00-00' ? ', ' . date_get_age($data['birthday']) . ' år' : '') . ($data['lastaction'] > time() - 600 ? '<span style="color: green;"> (Online)</span>' : '') . '
</div>
<div style="float: left; width: 10%; text-align: center;">
' . (in_array($data['image'], array(1, 2)) ? '<a href="javascript:;" style="text-decoration: none;" onclick="window.open(\'http://www.hamsterpaj.net/avatar.php?id=' . $data['user_id'] . '\',\'' . time() . '\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=320, height=427\')"><img src="' . IMAGE_URL . '/famfamfam_icons/pictures.png"></a>' : '') . '
</div>
<br style="clear: both;"/>
</div>
<div style="float: left; width: 23%;">' . (strlen($data['spot']) > 0 ? $data['spot'] : 'Okänd ort') . '</div>
<div style="float: left; width: 33%; text-align: right;">' . fix_time($data['timestamp']) . '</div>
<br style="clear: both;"/>
</div>
';
}
ui_bottom();
示例10: digga_view
function digga_view($artist_id)
{
$artist_info = digga_fetch_info($artist_id);
echo '<h1>Digga ger dig info om ' . $artist_info['name'] . '</h1>' . "\n";
echo '<h3>' . cute_number($artist_info['popularity']) . ' Hamsterpajare diggar ' . $artist_info['name'] . '!</h3>' . "\n";
if (strlen($artist_info['description']) > 0) {
echo '<p class="digga_description">' . "\n";
echo nl2br($artist_info['description']);
echo '</p>' . "\n";
} else {
echo '<p class="digga_no_description">' . "\n";
echo 'Vi har tyvärr ingen beskrivning om ' . $artist_info['name'] . ' än. Om du känner att du kan mycket om det ';
echo 'här bandet eller den här artisten så får du hemskt gärna skriva en egen beskrivning och skicka den som ett ';
echo 'privat meddelande till <a href="/traffa/profile.php?id=774586">Joar</a>. Glöm inte att tala om vilken artist ';
echo 'det gäller!' . "\n";
echo '</p>' . "\n";
}
if (is_privilegied('digga_admin')) {
echo 'Du kan <a href="?action=edit&artist_id=' . $artist_id . '">';
echo 'ändra beskrivningen och namnet</a>';
}
$diggers = digga_fetch_diggers($artist_id);
if (count($diggers) > 0) {
echo '<div id="digga_diggers">' . "\n";
echo '<h2>Hamsterpajare som diggar ' . $artist_info['name'] . '</h2>' . "\n";
echo '<table>' . "\n";
foreach ($diggers as $digger) {
echo '<tr>' . "\n";
echo '<td><a href="/traffa/profile.php?id=' . $digger['id'] . '">' . $digger['username'] . '</a></td>' . "\n";
echo '<td>' . $digger['gender'] . date_get_age($digger['birthday']) . '</td>' . "\n";
echo '<td>';
echo $digger['lastaction'] > time() - 900 ? 'online' : 'offline';
echo '</td>' . "\n";
echo '</tr>' . "\n";
}
echo '</table>' . "\n";
echo '</div>' . "\n";
}
echo '<div id="digga_songs">' . "\n";
echo '<h2>Låtar av ' . $artist_info['name'] . '</h2>' . "\n";
$query = 'SELECT title FROM songs WHERE artist = "' . $artist_id . '" ORDER BY popularity DESC';
$result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
echo '<ul style="list-style-type: none;">' . "\n";
while ($data = mysql_fetch_assoc($result)) {
echo '<li>' . $data['title'] . '</li>' . "\n";
}
echo '</ul>' . "\n";
echo '</div>' . "\n";
}
示例11: profile_head
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> ' : '';
$out .= strlen($params['spot']) > 0 ? '<span class="spot">' . $params['spot'] . '</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 = "' . $params['user_id'] . '" 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['old_profile']['label'] = 'Gammal presentation';
$profile_modules['old_profile']['url'] = '/traffa/old_profile.php?id=%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;
}
示例12: mysql_query
if (!isset($_GET['user_id']) || !is_numeric($_GET['user_id'])) {
$user_id = 65654;
} else {
$user_id = $_GET['user_id'];
}
// user
$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 = ' . $user_id . ' AND u.userid = l.id AND z.zip_code = u.zip_code AND p.userid = l.id';
$query .= ' AND l.is_removed = 0';
$query .= ' LIMIT 1';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
$user = mysql_fetch_assoc($result);
$gender = array('m' => 'P', 'f' => 'F');
$gender = isset($gender[$user['gender']]) ? $gender[$user['gender']] : '';
$birthday = $user['birthday'] != '0000-00-00' ? date_get_age($user['birthday']) : '';
$location = empty($user['spot']) ? '' : ' från ' . $user['spot'];
$online = $user['lastaction'] > time() - 600 ? 'true' : 'false';
// user flags
$query = 'SELECT ufl.* FROM user_flags AS uf, user_flags_list AS ufl';
$query .= ' WHERE user = ' . $user_id . ' AND ufl.id = uf.flag';
$query .= ' LIMIT 5';
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
$flags = array();
while ($data = mysql_fetch_assoc($result)) {
$flags[] = $data;
}
?>
{
username: '<?php
echo $user['username'];
示例13: ui_top
function ui_top($options = array())
{
/* Den här raden skapades när nya ui_top skapades. Låt den vara kvar, så kommer man ha något att le åt av nostalgiska syften. 2008-08-15, Joel.
*/
if (rand(0, 73) == 50) {
$query = 'UPDATE pageviews SET views = views + 73 WHERE date = "' . date('Y-m-d') . '" LIMIT 1';
mysql_query($query);
if (mysql_affected_rows() == 0) {
$query = 'INSERT INTO pageviews (views, date) VALUES(73, "' . date('Y-m-d') . '")';
mysql_query($query);
}
}
if (login_checklogin() && rand(1, 5) == 2) {
$query = 'UPDATE login SET lastrealaction="' . time() . '" WHERE id="' . $_SESSION['login']['id'] . '"';
mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
}
if (isset($_SERVER['HTTP_REFERER']) && preg_match('/hamsterpaj\\.eu/', $_SERVER['HTTP_REFERER'])) {
header('Location: http://child-abuse-trap.telia.se/');
}
$options['adtoma_category'] = isset($options['adtoma_category']) ? $options['adtoma_category'] : 'other';
define('ADTOMA_CATEGORY', $options['adtoma_category']);
$output = '';
$output .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' . "\n";
$output .= ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
$output .= '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
$output .= ' <head>' . "\n";
$options['meta_description'] = isset($options['meta_description']) ? $options['meta_description'] : '';
$options['meta_keywords'] = isset($options['meta_keywords']) ? $options['meta_keywords'] : '';
$output .= '<meta name="description" content="' . $options['meta_description'] . '" />' . "\n";
$output .= '<meta name="keywords" content="' . $options['meta_keywords'] . '" />' . "\n";
$output .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
$output .= '<meta http-equiv="X-UA-Compatible" content="IE=8" />' . "\n";
$options['title'] = isset($options['title']) ? $options['title'] : 'Hamsterpaj.net - Onlinespel, community, forum och annat kul ;)';
$output .= ' <title>' . $options['title'] . '</title>' . "\n";
$output .= ' <link rel="icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
$output .= ' <link rel="shortcut icon" href="http://images.hamsterpaj.net/favicon.png" type="image/x-icon" />' . "\n";
$options['stylesheets'] = isset($options['stylesheets']) && is_array($options['stylesheets']) ? $options['stylesheets'] : array();
// Stylesheets
array_unshift($options['stylesheets'], 'ui.css');
$options['stylesheets'][] = 'shared.css';
$options['stylesheets'][] = 'new_guestbook.css';
$options['stylesheets'][] = 'poll.css';
$options['stylesheets'][] = 'ui_modules.css';
$today_day = date('j');
if (date('m') == 12 && $today_day >= 1 && $today_day <= 24) {
$options['stylesheets'][] = 'ui_christmas.css';
}
// Remove duplicates
$options['stylesheets'] = array_unique($options['stylesheets']);
$output .= '<style type="text/css">' . "\n";
foreach ($options['stylesheets'] as $stylesheet) {
$output .= '@import url(\'/stylesheets/' . $stylesheet . '?version=' . filemtime(PATHS_WEBROOT . 'stylesheets/' . $stylesheet) . '\');' . "\n";
}
$output .= '</style>' . "\n";
$options['adtoma_category'] = isset($options['adtoma_category']) ? $options['adtoma_category'] : 'other';
define('ADTOMA_CATEGORY', $options['adtoma_category']);
// Create HP namespace...
$output .= '<script type="text/javascript" language="javascript">var hp = new Object();</script>' . "\n";
$output .= '<script type="text/javascript" language="javascript">' . 'hp.login_checklogin = function(){ return ' . (login_checklogin() ? 'true' : 'false') . '; }' . '</script>' . "\n";
$options['javascripts'] = isset($options['javascripts']) && is_array($options['javascripts']) ? $options['javascripts'] : array();
$javascripts_path = PATHS_WEBROOT . 'javascripts/';
global $js_compress_important_files;
// standard_javascripts.conf.php
if (ENVIRONMENT == 'development') {
foreach ($js_compress_important_files as $javascript) {
$output .= '<script type="text/javascript" language="javascript" src="/javascripts/' . $javascript . '?version=' . filemtime(PATHS_WEBROOT . 'javascripts/' . $javascript) . '"></script>' . "\n";
}
foreach ($options['javascripts'] as $javascript) {
$output .= '<script type="text/javascript" language="javascript" src="/javascripts/' . $javascript . '"></script>' . "\n";
}
} else {
$output .= '<script type="text/javascript" language="javascript" src="/javascripts/merge_' . filemtime(PATHS_STATIC . 'javascripts/merged.js') . '.js"></script>' . "\n";
$options['javascripts'] = array_unique($options['javascripts']);
foreach ($options['javascripts'] as $javascript) {
$internal_path = PATHS_STATIC . 'javascripts/specified/' . $javascript;
if (!in_array($javascript, $js_compress_important_files) && file_exists($internal_path)) {
$output .= '<script type="text/javascript" language="javascript" src="/javascripts/compressed_' . preg_replace('/\\.js$/i', '', $javascript) . '_' . filemtime($internal_path) . '.js"></script>' . "\n";
}
}
}
$output .= isset($options['header_extra']) ? $options['header_extra'] : '';
$output .= '<script type="text/javascript" src="http://nyheter24.se/template/1-0-1/javascript/ads.js?20090605"></script>';
$output .= '<script type="text/javascript">Ads.init(\'http://ads.nyheter24.se/\', false);</script>';
$output .= '</head> ' . "\n";
$output .= '<body' . (isset($options['body_extra']) ? ' ' . $options['body_extra'] : '') . '>' . "\n";
$output .= '<script type="text/javascript">' . "\n";
$adtoma_gender = in_array($_SESSION['userinfo']['gender'], array('P', 'F')) ? $_SESSION['userinfo']['gender'] : 'xx';
$adtoma_age = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? date_get_age($_SESSION['userinfo']['birthday']) : 'xx';
$adtoma_birthyear = $_SESSION['userinfo']['birthday'] != '0000-00-00' ? substr($_SESSION['userinfo']['birthday'], 0, 4) : 'xx';
$output .= "\t" . 'var CM8Server = "ad.adtoma.com";' . "\n";
$output .= "\t" . 'var CM8Cat = "hp.' . ADTOMA_CATEGORY . '";' . "\n";
$output .= "\t" . 'var CM8Profile = "hp_age=' . $adtoma_age . '&hp_birthyear=' . $adtoma_birthyear . '&hp_gender=' . $adtoma_gender . '"' . "\n";
$output .= '</script>' . "\n";
$output .= '<script language="JavaScript" type="text/javascript" src="http://ad.adtoma.com/adam/cm8adam_1_call.js"></script>' . "\n";
$output .= '<div>' . "\n";
$output .= ' <script type="text/javascript">CM8ShowAd("Bigbanner");</script>' . "\n";
$output .= '</div>' . "\n";
if (isset($_SESSION['user_message'])) {
$output .= jscript_alert($_SESSION['user_message'], true) . "\n";
unset($_SESSION['user_message']);
//.........这里部分代码省略.........
示例14: posts_list_old
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";
//.........这里部分代码省略.........
示例15: array
$ui_options['admtoma_category'] = 'chat';
$ui_options['menu_path'] = array('chatt');
$ui_options['stylesheets'][] = 'chat.css';
ui_top($ui_options);
$url = 'http://ved.hamsterpaj.net/chatt/index.php?';
if (login_checklogin()) {
$url .= 'nick=';
/* Please comment this if you understand the following lines */
/* Ask Joel, he can explain it. /Joel */
if (!preg_match("/^[A-Za-z]\$/i", substr($_SESSION['login']['username'], 0, 1))) {
$url .= substr($_SESSION['login']['username'], 1, strlen($_SESSION['login']['username']));
} else {
$url .= $_SESSION['login']['username'];
}
$url .= '&realname=';
$ageArray = date_get_age($_SESSION['userinfo']['birthday']);
$url .= urlencode($ageArray . ';');
$url .= urlencode($_SESSION['userinfo']['gender'] . ';');
$url .= urlencode($_SESSION['userinfo']['location'] . ';');
$url .= urlencode($_SESSION['login']['id'] . ';');
$url .= urlencode($_SESSION['userinfo']['image'] . ';');
} else {
$url .= 'guest';
}
$fjortis_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&chan=fjortis' . '\',\'' . rand() . '\',\'location=no, width=640, height=478\')">';
$traffa_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&chan=' . urlencode('träffa') . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$kuddhornan_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&chan=' . urlencode('kuddhörnan') . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$trivia_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&chan=trivia' . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$webdesign_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&chan=webdesign' . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$musik_link = '<a href="javascript: void(0);" onclick="window.open(\'' . $url . '&chan=musik' . '\',\'' . rand() . '\',\'toolbar=no, width=640, height=478\')">';
$chattare = file_get_contents('clients.txt');