本文整理汇总了PHP中timeformat函数的典型用法代码示例。如果您正苦于以下问题:PHP timeformat函数的具体用法?PHP timeformat怎么用?PHP timeformat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timeformat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boardindex
public static function boardindex()
{
global $context, $txt, $sourcedir, $user_info;
$data = array();
if (($data = CacheAPI::getCache('github-feed-index', 1800)) === null) {
$f = curl_init();
if ($f) {
curl_setopt_array($f, array(CURLOPT_URL => self::$my_git_api_url, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false));
$json_response = curl_exec($f);
$data = json_decode($json_response, true);
CacheAPI::putCache('github-feed-index', $data, 1800);
curl_close($f);
}
}
$n = 0;
foreach ($data as $commit) {
if (is_array($commit) && isset($commit['commit'])) {
$context['gitfeed'][] = array('message_short' => shorten_subject($commit['commit']['message'], 60), 'message' => nl2br($commit['commit']['message']), 'dateline' => timeformat(strtotime($commit['commit']['committer']['date'])), 'sha' => $commit['sha'], 'href' => self::$my_git_url . 'commit/' . $commit['sha']);
}
if (++$n > 5) {
break;
}
}
if (!empty($data)) {
/*
* add our plugin directory to the list of directories to search for templates
* and register the template hook.
* only do this if we actually have something to display
*/
EoS_Smarty::addTemplateDir(dirname(__FILE__));
EoS_Smarty::getConfigInstance()->registerHookTemplate('sidebar_below_userblock', 'gitfeed_sidebar_top');
$context['gitfeed_global']['see_all']['href'] = self::$my_git_url . 'commits/master';
$context['gitfeed_global']['see_all']['txt'] = 'Browse all commits';
}
}
示例2: PrintTopic
function PrintTopic()
{
global $db_prefix, $topic, $txt, $scripturl, $context;
global $board_info;
if (empty($topic)) {
fatal_lang_error(472, false);
}
// Get the topic starter information.
$request = db_query("\n\t\tSELECT m.posterTime, IFNULL(mem.realName, m.posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE m.ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG\n\t\tLIMIT 1", __FILE__, __LINE__);
if (mysql_num_rows($request) == 0) {
fatal_lang_error('smf232');
}
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
// Lets "output" all that info.
loadTemplate('Printpage');
$context['template_layers'] = array('print');
$context['board_name'] = $board_info['name'];
$context['category_name'] = $board_info['cat']['name'];
$context['poster_name'] = $row['posterName'];
$context['post_time'] = timeformat($row['posterTime'], false);
// Split the topics up so we can print them.
$request = db_query("\n\t\tSELECT subject, posterTime, body, IFNULL(mem.realName, posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG", __FILE__, __LINE__);
$context['posts'] = array();
while ($row = mysql_fetch_assoc($request)) {
// Censor the subject and message.
censorText($row['subject']);
censorText($row['body']);
$context['posts'][] = array('subject' => $row['subject'], 'member' => $row['posterName'], 'time' => timeformat($row['posterTime'], false), 'timestamp' => forum_time(true, $row['posterTime']), 'body' => parse_bbc($row['body'], 'print'));
if (!isset($context['topic_subject'])) {
$context['topic_subject'] = $row['subject'];
}
}
mysql_free_result($request);
}
示例3: PrintTopic
function PrintTopic()
{
global $topic, $txt, $scripturl, $context, $user_info;
global $board_info, $smcFunc, $modSettings;
// Redirect to the boardindex if no valid topic id is provided.
if (empty($topic)) {
redirectexit();
}
// Whatever happens don't index this.
$context['robot_no_index'] = true;
// Get the topic starter information.
$request = $smcFunc['db_query']('', '
SELECT m.poster_time, IFNULL(mem.real_name, m.poster_name) AS poster_name
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_topic = {int:current_topic}
ORDER BY m.id_msg
LIMIT 1', array('current_topic' => $topic));
// Redirect to the boardindex if no valid topic id is provided.
if ($smcFunc['db_num_rows']($request) == 0) {
redirectexit();
}
$row = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
// Lets "output" all that info.
loadTemplate('Printpage');
$context['template_layers'] = array('print');
$context['board_name'] = $board_info['name'];
$context['category_name'] = $board_info['cat']['name'];
$context['poster_name'] = $row['poster_name'];
$context['post_time'] = timeformat($row['poster_time'], false);
$context['parent_boards'] = array();
foreach ($board_info['parent_boards'] as $parent) {
$context['parent_boards'][] = $parent['name'];
}
// Split the topics up so we can print them.
$request = $smcFunc['db_query']('', '
SELECT subject, poster_time, body, IFNULL(mem.real_name, poster_name) AS poster_name
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_topic = {int:current_topic}' . ($modSettings['postmod_active'] && !allowedTo('approve_posts') ? '
AND (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR m.id_member = {int:current_member}') . ')' : '') . '
ORDER BY m.id_msg', array('current_topic' => $topic, 'is_approved' => 1, 'current_member' => $user_info['id']));
$context['posts'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
// Censor the subject and message.
censorText($row['subject']);
censorText($row['body']);
$context['posts'][] = array('subject' => $row['subject'], 'member' => $row['poster_name'], 'time' => timeformat($row['poster_time'], false), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => parse_bbc($row['body'], 'print'));
if (!isset($context['topic_subject'])) {
$context['topic_subject'] = $row['subject'];
}
}
$smcFunc['db_free_result']($request);
// Set a canonical URL for this page.
$context['canonical_url'] = $scripturl . '?topic=' . $topic . '.0';
}
示例4: entries
function entries($id, $num, $style)
{
$rows = getposts($id);
$entries = count($rows);
$count = $entries;
while ($count > 0 && $entries - $count < $num) {
$currentvalue = $rows[$count - 1];
$DATA = getdbpost($currentvalue);
$category = ID_BOARDtoCat($DATA['ID_BOARD']);
$filenum = array_search($currentvalue, $rows) + 1;
// Content
if ($style == 0) {
echo " <h2><a class = \"lightbg\" href = \"http://www.turkiball.com/feed/" . $filenum . ".php\">" . $DATA['subject'] . "</a></h2>\n";
echo " <h3>Category: <a class = \"lightbg\" href = \"http://www.turkiball.com/feed/" . $category[1] . ".php\">" . $category[0] . "</a></h3>\n";
echo " <p style = \"text-indent: 0px;\">\n";
echo $DATA['body'];
echo " </p>\n";
echo " <h3 style = \"text-align: left;\"><a class = \"lightbg\" href = \"http://www.turkiball.com/board/index.php/topic," . $DATA['ID_TOPIC'] . ".0.html\">Discussion (" . getreplies($DATA['ID_TOPIC']) . " comments)</a></a></h3>\n";
echo " <h3 style = \"text-align: right;\">Posted " . timeformat($DATA['posterTime']) . " by <a class = \"lightbg\" href = \"http://www.turkiball.com/feed/people/index.php?name=" . $DATA['posterName'] . "\">" . $DATA['posterName'] . "</a></h3>\n";
echo " <br><br><br>\n";
echo " <div class = \"contentline\"></div>\n";
} elseif ($style == 1) {
echo " <div class = \"newsitem\">\n";
echo " <a href = \"http://www.turkiball.com/feed/" . $category[1] . "/index.php\">\n";
echo " <img src = \"http://www.turkiball.com/images/cat" . $category[1] . "w.jpg\" alt = \"" . $category[0] . "\" width = \"150px\" height = \"30px\" border = \"0\" style = \"position: relative; top: -1px; left: -1px;\">\n";
echo " </a>\n";
echo " <h5>Posted " . dateShrink(timeformat($DATA['posterTime'])) . "</h5>\n";
echo " <h4><a href = \"http://www.turkiball.com/feed/" . $filenum . ".php\">" . $DATA['subject'] . "</a></h4>\n";
echo " <h6>By <a href = \"http://www.turkiball.com/feed/people/index.php?name=" . $DATA['posterName'] . "\">" . $DATA['posterName'] . "</a></h6>\n";
echo " </div>\n";
} elseif ($style == 2) {
// Setup the table
if ($count == $entries) {
echo " <table height=\"87\" cellspacing=\"8\" cellpadding=\"4\" width=\"530\" border=\"0\">\n";
echo " <tbody>\n";
echo " <tr><td><b>Title</b></td>\n";
echo " <td><b>Category</b></td>\n";
echo " <td><b>Date</b></td>\n";
echo " <td><b>By</b></td></tr>\n";
echo " <tr><td> </td><td> </td><td> </td><td> </td></tr>\n";
}
echo " <tr><td><a class = \"lightbg\" href = \"http://www.turkiball.com/feed/" . $filenum . ".php\"><b>" . $DATA['subject'] . "</b></a></td>\n";
echo " <td><a class = \"lightbg\" href = \"http://www.turkiball.com/feed/" . $category[1] . ".php\"><b>" . $category[0] . "</b></a></td>\n";
echo " <td><b>" . dateShrink(timeformat($DATA['posterTime'])) . "</b></a></td>\n";
echo " <td><a class = \"lightbg\" href = \"http://www.turkiball.com/feed/people/index.php?name=" . $DATA['posterName'] . "\"><b>" . $DATA['posterName'] . "</b></td></tr>\n";
// Close out the table
if ($count == 1) {
echo " </tbody>\n";
echo " </table>\n";
}
} else {
echo "Error: invalid {$style} parameter received\n";
}
$count--;
}
}
示例5: getLastPosts
function getLastPosts($latestPostOptions)
{
global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
// Find all the posts. Newer ones will have higher IDs. (assuming the last 20 * number are accessable...)
// !!!SLOW This query is now slow, NEEDS to be fixed. Maybe break into two?
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
$posts = array();
$context['MemberColor_ID_MEMBER'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
// Censor the subject and post for the preview ;).
censorText($row['subject']);
censorText($row['body']);
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => ' ')));
if ($smcFunc['strlen']($row['body']) > 128) {
$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
}
// Build the array.
$posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => empty($row['id_member']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:' . $modSettings['MemberColorGuests'] . ';">' : '') . $row['poster_name'] . (!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['poster_name'] . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>');
//The Last Posters id for the MemberColor.
if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['id_member'])) {
$context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
}
}
$smcFunc['db_free_result']($request);
// Know set the colors for the Recent posts...
if (!empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
//So Let's Color The Recent Posts ;)
if (!empty($modSettings['MemberColorRecentLastPost']) && is_array($posts)) {
foreach ($posts as $postkey => $postid_memcolor) {
if (!empty($colorDatas[$postid_memcolor['poster']['id']]['colored_link'])) {
$posts[$postkey]['poster']['link'] = $colorDatas[$postid_memcolor['poster']['id']]['colored_link'];
}
}
}
}
return $posts;
}
示例6: draftXmlReturn
/**
* Output a block of XML that contains the details of our draft.
*
* @param int $draft
*/
function draftXmlReturn($draft)
{
if (empty($draft)) {
return;
}
global $txt, $context;
header('Content-Type: text/xml; charset=UTF-8');
echo '<', '?xml version="1.0" encoding="UTF-8"?', '>
<response>
<lastsave id="', $draft, '"><![CDATA[', $txt['last_saved_on'], ': ', timeformat(time()), ']', ']></lastsave>
</response>';
obExit(false);
}
示例7: arcadeStats
/**
* SMF Arcade
*
* @package SMF Arcade
* @version 2.6 Alpha
* @license http://download.smfarcade.info/license.php New-BSD
*/
function arcadeStats($memID)
{
global $db_prefix, $scripturl, $txt, $modSettings, $context, $settings, $user_info, $smcFunc, $sourcedir;
require_once $sourcedir . '/Arcade.php';
SMFArcade::loadArcade('profile');
$context['arcade']['member_stats'] = array();
$result = $smcFunc['db_query']('', '
SELECT COUNT(*) AS champion
FROM {db_prefix}arcade_games
WHERE id_champion = {int:member}
AND enabled = 1', array('member' => $memID));
$context['arcade']['member_stats'] += $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);
$result = $smcFunc['db_query']('', '
SELECT COUNT(*) AS rates, (SUM(rating) / COUNT(*)) AS avg_rating
FROM {db_prefix}arcade_rates
WHERE id_member = {int:member}', array('member' => $memID));
$context['arcade']['member_stats'] += $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);
$result = $smcFunc['db_query']('', '
SELECT s.position, s.score, s.end_time, game.game_name, game.id_game
FROM ({db_prefix}arcade_scores AS s, {db_prefix}arcade_games AS game)
WHERE id_member = {int:member}
AND personal_best = 1
AND s.id_game = game.id_game
AND game.enabled = 1
ORDER BY position
LIMIT 10', array('member' => $memID));
$context['arcade']['member_stats']['scores'] = array();
while ($row = $smcFunc['db_fetch_assoc']($result)) {
$context['arcade']['member_stats']['scores'][] = array('link' => $scripturl . '?action=arcade;game=' . $row['id_game'], 'name' => $row['game_name'], 'score' => comma_format($row['score']), 'position' => $row['position'], 'time' => timeformat($row['end_time']));
}
$smcFunc['db_free_result']($result);
$result = $smcFunc['db_query']('', '
SELECT s.position, s.score, s.end_time, game.game_name, game.id_game
FROM ({db_prefix}arcade_scores AS s, {db_prefix}arcade_games AS game)
WHERE id_member = {int:member}
AND personal_best = 1
AND s.id_game = game.id_game
AND game.enabled = 1
ORDER BY end_time DESC
LIMIT 10', array('member' => $memID));
$context['arcade']['member_stats']['latest_scores'] = array();
while ($row = $smcFunc['db_fetch_assoc']($result)) {
$context['arcade']['member_stats']['latest_scores'][] = array('link' => $scripturl . '?action=arcade;game=' . $row['id_game'], 'name' => $row['game_name'], 'score' => comma_format($row['score']), 'position' => $row['position'], 'time' => timeformat($row['end_time']));
}
$smcFunc['db_free_result']($result);
// Layout
$context['sub_template'] = 'arcade_user_statistics';
$context['page_title'] = sprintf($txt['arcade_user_stats_title'], $context['member']['name']);
}
示例8: getLastPosts
function getLastPosts($latestPostOptions)
{
global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
// Find all the posts. Newer ones will have higher IDs. (assuming the last 20 * number are accessable...)
// !!!SLOW This query is now slow, NEEDS to be fixed. Maybe break into two?
$request = smf_db_query('
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, b.name, m1.subject AS first_subject,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS m1 ON (m1.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
$posts = array();
while ($row = mysql_fetch_assoc($request)) {
// Censor the subject and post for the preview ;).
censorText($row['subject']);
censorText($row['body']);
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => ' ')));
if (commonAPI::strlen($row['body']) > 128) {
$row['body'] = commonAPI::substr($row['body'], 0, 128) . '...';
}
$bhref = URL::board($row['id_board'], $row['board_name'], 0, true);
$mhref = URL::user($row['id_member'], $row['poster_name']);
$thref = URL::topic($row['id_topic'], $row['first_subject'], 0, false, '.msg' . $row['id_msg'], ';topicseen#msg' . $row['id_msg']);
// Build the array.
$posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $bhref, 'link' => '<a href="' . $bhref . '">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $mhref, 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $mhref . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 35), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $thref, 'link' => '<a href="' . $thref . '" rel="nofollow">' . $row['first_subject'] . '</a>');
}
mysql_free_result($request);
return $posts;
}
示例9: scheduled_paid_subscriptions
function scheduled_paid_subscriptions()
{
global $txt, $sourcedir, $scripturl, $modSettings, $language;
// Start off by checking for removed subscriptions.
$request = smf_db_query('
SELECT id_subscribe, id_member
FROM {db_prefix}log_subscribed
WHERE status = {int:is_active}
AND end_time < {int:time_now}', array('is_active' => 1, 'time_now' => time()));
while ($row = mysql_fetch_assoc($request)) {
require_once $sourcedir . '/ManagePaid.php';
removeSubscription($row['id_subscribe'], $row['id_member']);
}
mysql_free_result($request);
// Get all those about to expire that have not had a reminder sent.
$request = smf_db_query('
SELECT ls.id_sublog, m.id_member, m.member_name, m.email_address, m.lngfile, s.name, ls.end_time
FROM {db_prefix}log_subscribed AS ls
INNER JOIN {db_prefix}subscriptions AS s ON (s.id_subscribe = ls.id_subscribe)
INNER JOIN {db_prefix}members AS m ON (m.id_member = ls.id_member)
WHERE ls.status = {int:is_active}
AND ls.reminder_sent = {int:reminder_sent}
AND s.reminder > {int:reminder_wanted}
AND ls.end_time < ({int:time_now} + s.reminder * 86400)', array('is_active' => 1, 'reminder_sent' => 0, 'reminder_wanted' => 0, 'time_now' => time()));
$subs_reminded = array();
while ($row = mysql_fetch_assoc($request)) {
// If this is the first one load the important bits.
if (empty($subs_reminded)) {
require_once $sourcedir . '/lib/Subs-Post.php';
// Need the below for loadLanguage to work!
loadEssentialThemeData();
}
$subs_reminded[] = $row['id_sublog'];
$replacements = array('PROFILE_LINK' => $scripturl . '?action=profile;area=subscriptions;u=' . $row['id_member'], 'REALNAME' => $row['member_name'], 'SUBSCRIPTION' => $row['name'], 'END_DATE' => strip_tags(timeformat($row['end_time'])));
$emaildata = loadEmailTemplate('paid_subscription_reminder', $replacements, empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile']);
// Send the actual email.
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
}
mysql_free_result($request);
// Mark the reminder as sent.
if (!empty($subs_reminded)) {
smf_db_query('
UPDATE {db_prefix}log_subscribed
SET reminder_sent = {int:reminder_sent}
WHERE id_sublog IN ({array_int:subscription_list})', array('subscription_list' => $subs_reminded, 'reminder_sent' => 1));
}
return true;
}
示例10: fetch_data
/**
* fetch_data.
* Fetch Boards, Topics, Messages and Attaches.
*/
function fetch_data()
{
global $context, $smcFunc, $modSettings, $settings, $boardurl, $scripturl, $txt;
$boards = !empty($this->cfg['config']['settings']['board']) ? $this->cfg['config']['settings']['board'] : array();
$this->cfg['config']['settings']['total'] = empty($this->cfg['config']['settings']['total']) ? 1 : $this->cfg['config']['settings']['total'];
$this->posts = null;
$this->attaches = null;
$this->imgName = '';
if (!empty($boards)) {
// Load the message icons
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled');
$icon_sources = array();
foreach ($stable_icons as $icon) {
$icon_sources[$icon] = 'images_url';
}
// find the n post from each board
$this->cfg['config']['settings']['total'] = empty($this->cfg['config']['settings']['total']) ? 1 : $this->cfg['config']['settings']['total'];
$msgids = array();
$curboard = 0;
$request = $smcFunc['db_query']('', '
SELECT b.id_board, b.name, t.id_topic, t.num_replies, t.num_views, m.*
FROM {db_prefix}topics as t
LEFT JOIN {db_prefix}boards as b ON (t.id_board = b.id_board)
LEFT JOIN {db_prefix}messages as m ON (t.id_first_msg = m.id_msg)
WHERE b.id_board IN ({array_int:boards}) AND {query_wanna_see_board}
' . ($modSettings['postmod_active'] ? ' AND m.approved = {int:approv}' : '') . '
AND t.id_last_msg >= {int:min_msg}
ORDER BY b.id_board ASC, t.id_topic DESC', array('boards' => $boards, 'min_msg' => $modSettings['maxMsgID'] - 100 * $this->cfg['config']['settings']['total'], 'approv' => 1));
while ($row = $smcFunc['db_fetch_assoc']($request)) {
if ($row['id_board'] != $curboard) {
$curboard = $row['id_board'];
$max = $this->cfg['config']['settings']['total'];
}
if (!empty($max)) {
$msgids[$row['id_topic']] = $row['id_msg'];
$max--;
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
// Check that this message icon is there...
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']])) {
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
}
censorText($row['subject']);
censorText($row['body']);
// Rescale inline Images ?
if (!empty($this->cfg['config']['settings']['rescale']) || empty($this->cfg['config']['settings']['rescale']) && !is_numeric($this->cfg['config']['settings']['rescale'])) {
// find all images
if (preg_match_all('~<img[^>]*>~iS', $row['body'], $matches) > 0) {
// remove smileys
foreach ($matches[0] as $i => $data) {
if (strpos($data, $modSettings['smileys_url']) !== false) {
unset($matches[0][$i]);
}
}
// images found?
if (count($matches[0]) > 0) {
$this->imgName = $this->cfg['blocktype'] . '-' . $this->cfg['id'];
if (empty($this->cfg['config']['settings']['rescale'])) {
$fnd = array('~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
} else {
$fnd = array('~ width?=?"\\d+"~', '~ height?=?"\\d+"~', '~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
}
// modify the images for highslide
foreach ($matches[0] as $i => $data) {
$datlen = strlen($data);
preg_match('~src?=?"([^\\"]*\\")~i', $data, $src);
$alt = substr(strrchr($src[1], '/'), 1);
$alt = str_replace(array('_', '-'), ' ', strtoupper(substr($alt, 0, strrpos($alt, '.'))));
$tmp = str_replace($src[0], ' class="' . $this->imgName . '" alt="' . $alt . '" ' . $src[0], preg_replace($fnd, '', $data));
// highslide disabled?
if (!empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
$row['body'] = substr_replace($row['body'], $tmp, strpos($row['body'], $data), $datlen);
} elseif (empty($this->cfg['config']['settings']['disableHSimg']) && empty($context['pmx']['settings']['disableHSonfront'])) {
$row['body'] = substr_replace($row['body'], '<a href="' . $boardurl . '" class="' . $this->imgName . ' highslide" title="' . $txt['pmx_hs_expand'] . '" onclick="return hs.expand(this, {src: \'' . str_replace('"', '', $src[1]) . '\', align: \'center\', headingEval: \'this.thumb.alt\'})">' . $tmp . '</a>', strpos($row['body'], $data), $datlen);
} else {
$row['body'] = substr_replace($row['body'], $tmp, strpos($row['body'], $data), $datlen);
}
}
}
}
} elseif (is_numeric($this->cfg['config']['settings']['rescale'])) {
$row['body'] = PortaMx_revoveLinks($row['body'], false, true);
}
// teaser enabled ?
if (!empty($this->cfg['config']['settings']['teaser'])) {
$row['body'] = PortaMx_Tease_posts($row['body'], $this->cfg['config']['settings']['teaser'], '', false, false);
}
$this->posts[] = array('id_board' => $row['id_board'], 'board_name' => $row['name'], 'id' => $row['id_topic'], 'message_id' => $row['id_msg'], 'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" alt="' . $row['icon'] . '" />', 'subject' => $row['subject'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => $row['body'], 'replies' => $row['num_replies'], 'views' => $row['num_views'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '', 'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']), 'locked' => !empty($row['locked']));
}
}
$smcFunc['db_free_result']($request);
// any post found?
if (!is_null($this->posts)) {
// get attachments if show thumnails set
$allow_boards = boardsAllowedTo('view_attachments');
if (!empty($this->cfg['config']['settings']['thumbs']) && !empty($allow_boards)) {
$request = $smcFunc['db_query']('', '
//.........这里部分代码省略.........
示例11: template_main
function template_main()
{
global $scripturl, $context, $txt, $settings, $modSettings, $user_profile, $memberContext;
// Check if the user is an Admin
$manage_staff = allowedTo('admin_forum');
$bbc_check = function_exists('parse_bbc');
echo '<div class="tborder">';
echo '<br />';
$totalcols = 1;
if ($modSettings['smfstaff_showavatar']) {
$totalcols++;
}
if ($modSettings['smfstaff_showlastactive']) {
$totalcols++;
}
if ($modSettings['smfstaff_showdateregistered']) {
$totalcols++;
}
if ($modSettings['smfstaff_showcontactinfo']) {
$totalcols++;
}
foreach ($context['smfstaff_groups'] as $id => $data) {
$count_users = count(@$context['smfstaff_users'][$data['id']]);
if ($count_users == 0) {
continue;
}
echo '<table border="0" cellspacing="0" cellpadding="2" width="100%">';
echo '<tr>';
echo '<td class="catbg2" width="30%">', $data['name'], '</td>';
if ($modSettings['smfstaff_showavatar']) {
echo '<td class="catbg2" width="25%">', $txt['smfstaff_avatar'], '</td>';
}
if ($modSettings['smfstaff_showlastactive']) {
echo '<td class="catbg2" width="25%">', $txt['smfstaff_lastactive'], '</td>';
}
if ($modSettings['smfstaff_showdateregistered']) {
echo '<td class="catbg2" width="25%">', $txt['smfstaff_dateregistered'], '</td>';
}
if ($modSettings['smfstaff_showcontactinfo']) {
echo '<td class="catbg2" width="30%">', $txt['smfstaff_contact'], '</td>';
}
echo '</tr>';
foreach (@$context['smfstaff_users'][$data['id']] as $id => $row2) {
echo '<tr>';
echo '<td class="windowbg"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><font color="' . $data['color'] . '">' . $row2['realName'] . '</font></a></td>';
if ($modSettings['smfstaff_showavatar']) {
echo '<td class="windowbg">';
// Display the users avatar
$memCommID = $row2['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);
echo $memberContext[$memCommID]['avatar']['image'];
echo '</td>';
}
if ($modSettings['smfstaff_showlastactive']) {
echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
}
if ($modSettings['smfstaff_showdateregistered']) {
echo '<td class="windowbg">' . timeformat($row2['dateRegistered']) . '</td>';
}
if ($modSettings['smfstaff_showcontactinfo']) {
echo '<td class="windowbg">';
//Send email row
if ($row2['hideEmail'] == 0) {
echo '<a href="mailto:', $row2['emailAddress'], '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="email" /></a> ';
}
if ($row2['ICQ'] != '') {
echo '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row2['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $row2['ICQ'] . '" alt="' . $row2['ICQ'] . '" width="18" height="18" border="0" /></a> ';
}
if ($row2['AIM'] != '') {
echo '<a href="aim:goim?screenname=' . urlencode(strtr($row2['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row2['AIM'] . '" border="0" /></a> ';
}
if ($row2['YIM'] != '') {
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row2['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row2['YIM']) . '&m=g&t=0" alt="' . $row2['YIM'] . '" border="0" /></a> ';
}
if ($row2['MSN'] != '') {
echo '<a href="http://members.msn.com/' . $row2['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row2['MSN'] . '" border="0" /></a> ';
}
// Send PM row
echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '">' . $txt['smfstaff_sendpm'] . '</a>';
echo '</td>';
}
// End Contact Information
echo '</tr>';
}
// If they are allowed to manage the staff page give them the option
if ($manage_staff) {
echo '<tr>
<td align="center" colspan="', $totalcols, '" class="windowbg">
<a href="' . $scripturl . '?action=staff;sa=catdown&id=' . $data['id'] . '">' . $txt['smfstaff_down'] . '</a> | <a href="' . $scripturl . '?action=staff;sa=catup&id=' . $data['id'] . '">' . $txt['smfstaff_up'] . '</a> | <a href="' . $scripturl . '?action=staff;sa=delete&id=' . $data['id'] . ';ret">' . $txt['smfstaff_delgroup'] . '</a></td></tr>';
}
echo '</table>';
// Seperate the groups from the local mods.
echo '<br />';
}
// End of Main staff listing
if ($modSettings['smfstaff_showlocalmods']) {
$localcount = count($context['smfstaff_localmods']);
if ($localcount > 0) {
echo '<table border="0" cellspacing="0" cellpadding="2" width="100%">';
//.........这里部分代码省略.........
示例12: MessageIndex
//.........这里部分代码省略.........
$pages .= ' »';
} else {
$pages = '';
}
// We need to check the topic icons exist...
if (!empty($modSettings['messageIconChecks_enable'])) {
if (!isset($context['icon_sources'][$row['first_icon']])) {
$context['icon_sources'][$row['first_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['first_icon'] . '.png') ? 'images_url' : 'default_images_url';
}
if (!isset($context['icon_sources'][$row['last_icon']])) {
$context['icon_sources'][$row['last_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['last_icon'] . '.png') ? 'images_url' : 'default_images_url';
}
} else {
if (!isset($context['icon_sources'][$row['first_icon']])) {
$context['icon_sources'][$row['first_icon']] = 'images_url';
}
if (!isset($context['icon_sources'][$row['last_icon']])) {
$context['icon_sources'][$row['last_icon']] = 'images_url';
}
}
if (!empty($settings['avatars_on_indexes'])) {
// Allow themers to show the latest poster's avatar along with the topic
if (!empty($row['avatar'])) {
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize') {
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
} else {
$avatar_width = '';
$avatar_height = '';
}
}
}
// 'Print' the topic info.
$context['topics'][$row['id_topic']] = array('id' => $row['id_topic'], 'first_post' => array('id' => $row['id_first_msg'], 'member' => array('username' => $row['first_member_name'], 'name' => $row['first_display_name'], 'id' => $row['first_id_member'], 'href' => !empty($row['first_id_member']) ? $scripturl . '?action=profile;u=' . $row['first_id_member'] : '', 'link' => !empty($row['first_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['first_id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_display_name'] . '" class="preview">' . $row['first_display_name'] . '</a>' : $row['first_display_name']), 'time' => timeformat($row['first_poster_time']), 'timestamp' => forum_time(true, $row['first_poster_time']), 'subject' => $row['first_subject'], 'preview' => $row['first_body'], 'icon' => $row['first_icon'], 'icon_url' => $settings[$context['icon_sources'][$row['first_icon']]] . '/post/' . $row['first_icon'] . '.png', 'href' => $scripturl . '?topic=' . (empty($row['id_redirect_topic']) ? $row['id_topic'] : $row['id_redirect_topic']) . '.0', 'link' => '<a href="' . $scripturl . '?topic=' . (empty($row['id_redirect_topic']) ? $row['id_topic'] : $row['id_redirect_topic']) . '.0">' . $row['first_subject'] . '</a>'), 'last_post' => array('id' => $row['id_last_msg'], 'member' => array('username' => $row['last_member_name'], 'name' => $row['last_display_name'], 'id' => $row['last_id_member'], 'href' => !empty($row['last_id_member']) ? $scripturl . '?action=profile;u=' . $row['last_id_member'] : '', 'link' => !empty($row['last_id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['last_id_member'] . '">' . $row['last_display_name'] . '</a>' : $row['last_display_name']), 'time' => timeformat($row['last_poster_time']), 'timestamp' => forum_time(true, $row['last_poster_time']), 'subject' => $row['last_subject'], 'preview' => $row['last_body'], 'icon' => $row['last_icon'], 'icon_url' => $settings[$context['icon_sources'][$row['last_icon']]] . '/post/' . $row['last_icon'] . '.png', 'href' => $scripturl . '?topic=' . (empty($row['id_redirect_topic']) ? $row['id_topic'] : $row['id_redirect_topic']) . ($user_info['is_guest'] ? '.' . (!empty($options['view_newest_first']) ? 0 : (int) ($row['num_replies'] / $context['pageindex_multiplier']) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg'] : ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new'), 'link' => '<a href="' . $scripturl . '?topic=' . (empty($row['id_redirect_topic']) ? $row['id_topic'] : $row['id_redirect_topic']) . ($user_info['is_guest'] ? '.' . (!empty($options['view_newest_first']) ? 0 : (int) ($row['num_replies'] / $context['pageindex_multiplier']) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg'] : ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new') . '" ' . ($row['num_replies'] == 0 ? '' : 'rel="nofollow"') . '>' . $row['last_subject'] . '</a>'), 'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']), 'is_locked' => !empty($row['locked']), 'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0, 'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'], 'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'], 'is_posted_in' => false, 'icon' => $row['first_icon'], 'icon_url' => $settings[$context['icon_sources'][$row['first_icon']]] . '/post/' . $row['first_icon'] . '.png', 'subject' => $row['first_subject'], 'new' => $row['new_from'] <= $row['id_msg_modified'], 'new_from' => $row['new_from'], 'newtime' => $row['new_from'], 'new_href' => $scripturl . '?topic=' . (empty($row['id_redirect_topic']) ? $row['id_topic'] : $row['id_redirect_topic']) . '.msg' . $row['new_from'] . '#new', 'pages' => $pages, 'replies' => comma_format($row['num_replies']), 'views' => comma_format($row['num_views']), 'approved' => $row['approved'], 'unapproved_posts' => $row['unapproved_posts']);
if (!empty($settings['avatars_on_indexes'])) {
$context['topics'][$row['id_topic']]['last_post']['member']['avatar'] = array('name' => $row['avatar'], 'image' => $row['avatar'] == '' ? $row['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" />' : '' : (stristr($row['avatar'], 'http://') ? '<img class="avatar" src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" />'), 'href' => $row['avatar'] == '' ? $row['id_attach'] > 0 ? empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename'] : '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']), 'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']));
}
determineTopicClass($context['topics'][$row['id_topic']]);
}
$smcFunc['db_free_result']($result);
// Fix the sequence of topics if they were retrieved in the wrong order. (for speed reasons...)
if ($fake_ascending) {
$context['topics'] = array_reverse($context['topics'], true);
}
if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($topic_ids)) {
$result = $smcFunc['db_query']('', '
SELECT id_topic
FROM {db_prefix}messages
WHERE id_topic IN ({array_int:topic_list})
AND id_member = {int:current_member}
GROUP BY id_topic
LIMIT ' . count($topic_ids), array('current_member' => $user_info['id'], 'topic_list' => $topic_ids));
while ($row = $smcFunc['db_fetch_assoc']($result)) {
$context['topics'][$row['id_topic']]['is_posted_in'] = true;
$context['topics'][$row['id_topic']]['class'] = 'my_' . $context['topics'][$row['id_topic']]['class'];
}
$smcFunc['db_free_result']($result);
}
}
$context['jump_to'] = array('label' => addslashes(un_htmlspecialchars($txt['jump_to'])), 'board_name' => htmlspecialchars(strtr(strip_tags($board_info['name']), array('&' => '&'))), 'child_level' => $board_info['child_level']);
// Is Quick Moderation active/needed?
if (!empty($options['display_quick_mod']) && !empty($context['topics'])) {
$context['can_markread'] = $context['user']['is_logged'];
$context['can_lock'] = allowedTo('lock_any');
$context['can_sticky'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);
$context['can_move'] = allowedTo('move_any');
示例13: loadMemberContext
function loadMemberContext($user)
{
global $memberContext, $user_profile, $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER, $board_info, $settings;
global $db_prefix, $func;
static $dataLoaded = array();
// If this person's data is already loaded, skip it.
if (isset($dataLoaded[$user])) {
return true;
}
// We can't load guests or members not loaded by loadMemberData()!
if ($user == 0) {
return false;
}
if (!isset($user_profile[$user])) {
trigger_error('loadMemberContext(): member id ' . $user . ' not previously loaded by loadMemberData()', E_USER_WARNING);
return false;
}
// Well, it's loaded now anyhow.
$dataLoaded[$user] = true;
$profile = $user_profile[$user];
// Censor everything.
censorText($profile['signature']);
censorText($profile['personalText']);
censorText($profile['location']);
// Set things up to be used before hand.
$gendertxt = $profile['gender'] == 2 ? $txt[239] : ($profile['gender'] == 1 ? $txt[238] : '');
$profile['signature'] = str_replace(array("\n", "\r"), array('<br />', ''), $profile['signature']);
$profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['ID_MEMBER']);
$profile['is_online'] = (!empty($profile['showOnline']) || allowedTo('moderate_forum')) && $profile['isOnline'] > 0;
$profile['stars'] = empty($profile['stars']) ? array('', '') : explode('#', $profile['stars']);
// Setup the buddy status here (One whole in_array call saved :P)
$profile['buddy'] = in_array($profile['ID_MEMBER'], $user_info['buddies']);
$buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array();
// If we're always html resizing, assume it's too large.
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize') {
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
} else {
$avatar_width = '';
$avatar_height = '';
}
// What a monstrous array...
$memberContext[$user] = array('username' => &$profile['memberName'], 'name' => &$profile['realName'], 'id' => &$profile['ID_MEMBER'], 'is_guest' => $profile['ID_MEMBER'] == 0, 'is_buddy' => $profile['buddy'], 'is_reverse_buddy' => in_array($ID_MEMBER, $buddy_list), 'buddies' => $buddy_list, 'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '', 'href' => $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>', 'email' => &$profile['emailAddress'], 'hide_email' => $profile['emailAddress'] == '' || !empty($modSettings['guest_hideContacts']) && $user_info['is_guest'] || !empty($profile['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum') && $ID_MEMBER != $profile['ID_MEMBER'], 'email_public' => (empty($profile['hideEmail']) || empty($modSettings['allow_hideEmail'])) && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']), 'registered' => empty($profile['dateRegistered']) ? $txt[470] : timeformat($profile['dateRegistered']), 'registered_timestamp' => empty($profile['dateRegistered']) ? 0 : forum_time(true, $profile['dateRegistered']), 'blurb' => &$profile['personalText'], 'gender' => array('name' => $gendertxt, 'image' => !empty($profile['gender']) ? '<img src="' . $settings['images_url'] . '/' . ($profile['gender'] == 1 ? 'Male' : 'Female') . '.gif" alt="' . $gendertxt . '" border="0" />' : ''), 'website' => array('title' => &$profile['websiteTitle'], 'url' => &$profile['websiteUrl']), 'birth_date' => empty($profile['birthdate']) || $profile['birthdate'] === '0001-01-01' ? '0000-00-00' : (substr($profile['birthdate'], 0, 4) === '0004' ? '0000' . substr($profile['birthdate'], 4) : $profile['birthdate']), 'signature' => &$profile['signature'], 'location' => &$profile['location'], 'icq' => $profile['ICQ'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => &$profile['ICQ'], 'href' => 'http://www.icq.com/whitepages/about_me.php?uin=' . $profile['ICQ'], 'link' => '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $profile['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $profile['ICQ'] . '" alt="' . $profile['ICQ'] . '" width="18" height="18" border="0" /></a>', 'link_text' => '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $profile['ICQ'] . '" target="_blank">' . $profile['ICQ'] . '</a>') : array('name' => '', 'add' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'aim' => $profile['AIM'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => &$profile['AIM'], 'href' => 'aim:goim?screenname=' . urlencode(strtr($profile['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'], 'link' => '<a href="aim:goim?screenname=' . urlencode(strtr($profile['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $profile['AIM'] . '" border="0" /></a>', 'link_text' => '<a href="aim:goim?screenname=' . urlencode(strtr($profile['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '">' . $profile['AIM'] . '</a>') : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'yim' => $profile['YIM'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => &$profile['YIM'], 'href' => 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['YIM']), 'link' => '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($profile['YIM']) . '&m=g&t=0" alt="' . $profile['YIM'] . '" border="0" /></a>', 'link_text' => '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['YIM']) . '">' . $profile['YIM'] . '</a>') : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'msn' => $profile['MSN'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => &$profile['MSN'], 'href' => 'http://members.msn.com/' . $profile['MSN'], 'link' => '<a href="http://members.msn.com/' . $profile['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $profile['MSN'] . '" border="0" /></a>', 'link_text' => '<a href="http://members.msn.com/' . $profile['MSN'] . '" target="_blank">' . $profile['MSN'] . '</a>') : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'real_posts' => $profile['posts'], 'posts' => $profile['posts'] > 100000 ? $txt[683] : ($profile['posts'] == 1337 ? 'leet' : comma_format($profile['posts'])), 'avatar' => array('name' => &$profile['avatar'], 'image' => $profile['avatar'] == '' ? $profile['ID_ATTACH'] > 0 ? '<img src="' . (empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" class="avatar" border="0" />' : '' : (stristr($profile['avatar'], 'http://') ? '<img src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" class="avatar" border="0" />'), 'href' => $profile['avatar'] == '' ? $profile['ID_ATTACH'] > 0 ? empty($profile['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $profile['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename'] : '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']), 'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])), 'last_login' => empty($profile['lastLogin']) ? $txt['never'] : timeformat($profile['lastLogin']), 'last_login_timestamp' => empty($profile['lastLogin']) ? 0 : forum_time(0, $profile['lastLogin']), 'karma' => array('good' => &$profile['karmaGood'], 'bad' => &$profile['karmaBad'], 'allow' => !$user_info['is_guest'] && $user_info['posts'] >= $modSettings['karmaMinPosts'] && allowedTo('karma_edit') && !empty($modSettings['karmaMode']) && $ID_MEMBER != $user), 'ip' => htmlspecialchars($profile['memberIP']), 'ip2' => htmlspecialchars($profile['memberIP2']), 'online' => array('is_online' => $profile['is_online'], 'text' => &$txt[$profile['is_online'] ? 'online2' : 'online3'], 'href' => $scripturl . '?action=pm;sa=send;u=' . $profile['ID_MEMBER'], 'link' => '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $profile['ID_MEMBER'] . '">' . $txt[$profile['is_online'] ? 'online2' : 'online3'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['buddy'] ? 'buddy_' : '') . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', 'label' => &$txt[$profile['is_online'] ? 'online4' : 'online5']), 'language' => $func['ucwords'](strtr($profile['lngfile'], array('_' => ' ', '-utf8' => ''))), 'is_activated' => isset($profile['is_activated']) ? $profile['is_activated'] : 1, 'is_banned' => isset($profile['is_activated']) ? $profile['is_activated'] >= 10 : 0, 'options' => $profile['options'], 'is_guest' => false, 'group' => $profile['member_group'], 'group_color' => $profile['member_group_color'], 'group_id' => $profile['ID_GROUP'], 'post_group' => $profile['post_group'], 'post_group_color' => $profile['post_group_color'], 'group_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['stars'][1]) ? $settings['images_url'] . '/' . $profile['stars'][1] : '') . '" alt="*" border="0" />', empty($profile['stars'][0]) || empty($profile['stars'][1]) ? 0 : $profile['stars'][0]), 'local_time' => timeformat(time() + ($profile['timeOffset'] - $user_info['time_offset']) * 3600, false));
return true;
}
示例14: LikesByUser
/**
* @param $memID int id_member
*
* fetch all likes received by the given user and display them
* part of the profile -> show content area.
*/
function LikesByUser($memID)
{
global $context, $user_info, $scripturl, $memberContext, $txt, $modSettings, $options;
if ($memID != $user_info['id']) {
isAllowedTo('can_view_ratings');
}
// let us use the same value as for topics per page here.
$perpage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
$out = $_GET['sa'] === 'likesout';
// display likes *given* instead of received ones
$is_owner = $user_info['id'] == $memID;
// we are the owner of this profile, this is important for proper formatting (you/yours etc.)
$boards_like_see = boardsAllowedTo('like_see');
// respect permissions
$start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
if (!($user_info['is_admin'] || allowedTo('moderate_forum'))) {
// admins and global mods can see everything
$bq = ' AND b.id_board IN({array_int:boards})';
} else {
$bq = '';
}
$q = $out ? 'l.id_user = {int:id_user}' : 'l.id_receiver = {int:id_user}';
$request = smf_db_query('SELECT count(l.id_msg) FROM {db_prefix}likes AS l
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = l.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . $q . ' AND {query_see_board}' . $bq, array('id_user' => $memID, 'boards' => $boards_like_see));
list($context['total_likes']) = mysql_fetch_row($request);
mysql_free_result($request);
$request = smf_db_query('SELECT m.subject, m.id_topic, l.id_user, l.id_receiver, l.updated, l.id_msg, l.rtype, mfirst.subject AS first_subject, SUBSTRING(m.body, 1, 150) AS body FROM {db_prefix}likes AS l
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = l.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}messages AS mfirst ON (mfirst.id_msg = t.id_first_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . $q . ' AND {query_see_board} ' . $bq . ' ORDER BY l.id_like DESC LIMIT {int:startwith}, {int:perpage}', array('id_user' => $memID, 'startwith' => $start, 'perpage' => $perpage, 'boards' => $boards_like_see));
$context['results_count'] = 0;
$context['likes'] = array();
$context['displaymode'] = $out ? true : false;
$context['pages'] = '';
if ($context['total_likes'] > $perpage) {
$context['pages'] = constructPageIndex($scripturl . '?action=profile;area=showposts;sa=' . $_GET['sa'] . ';u=' . trim($memID), $start, $context['total_likes'], $perpage);
}
$users = array();
while ($row = mysql_fetch_assoc($request)) {
$context['results_count']++;
$thref = URL::topic($row['id_topic'], $row['first_subject'], 0);
$phref = URL::topic($row['id_topic'], $row['subject'], 0, false, '.msg' . $row['id_msg'], '#msg' . $row['id_msg']);
$users[] = $out ? $row['id_receiver'] : $row['id_user'];
$context['likes'][] = array('id_user' => $out ? $row['id_receiver'] : $row['id_user'], 'time' => timeformat($row['updated']), 'topic' => array('href' => $thref, 'link' => '<a href="' . $thref . '">' . $row['first_subject'] . '</a>', 'subject' => $row['first_subject']), 'post' => array('href' => $phref, 'link' => '<a href="' . $phref . '">' . $row['subject'] . '</a>', 'subject' => $row['subject'], 'id' => $row['id_msg']), 'rtype' => $row['rtype'], 'teaser' => strip_tags(preg_replace('~[[\\/\\!]*?[^\\[\\]]*?]~si', '', $row['body'])) . '...', 'morelink' => URL::parse('?msg=' . $row['id_msg'] . ';perma'));
}
loadMemberData(array_unique($users));
foreach ($context['likes'] as &$like) {
loadMemberContext($like['id_user']);
$like['member'] =& $memberContext[$like['id_user']];
$like['text'] = $out ? $is_owner ? sprintf($txt['liked_a_post'], $is_owner ? $txt['you_liker'] : $memberContext[$memID]['name'], $memberContext[$like['id_user']]['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : sprintf($txt['liked_a_post'], $is_owner ? $txt['you_liker'] : $memberContext[$memID]['name'], $memberContext[$like['id_user']]['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : ($is_owner ? sprintf($txt['liked_your_post'], $like['id_user'] == $user_info['id'] ? $txt['you_liker'] : $like['member']['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : sprintf($txt['liked_a_post'], $like['id_user'] == $user_info['id'] ? $txt['you_liker'] : $like['member']['link'], $memberContext[$memID]['name'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']));
}
mysql_free_result($request);
EoS_Smarty::getConfigInstance()->registerHookTemplate('profile_content_area', 'ratings/profile_display');
}
示例15: prepareDisplayContext
function prepareDisplayContext($reset = false)
{
global $settings, $txt, $modSettings, $scripturl, $options, $user_info, $smcFunc;
global $memberContext, $context, $messages_request, $topic, $attachments, $topicinfo;
static $counter = null;
// If the query returned false, bail.
if ($messages_request == false) {
return false;
}
// Remember which message this is. (ie. reply #83)
if ($counter === null || $reset) {
$counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start'];
}
// Start from the beginning...
if ($reset) {
return @$smcFunc['db_data_seek']($messages_request, 0);
}
// Attempt to get the next message.
$message = $smcFunc['db_fetch_assoc']($messages_request);
if (!$message) {
$smcFunc['db_free_result']($messages_request);
return false;
}
// $context['icon_sources'] says where each icon should come from - here we set up the ones which will always exist!
if (empty($context['icon_sources'])) {
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless', 'clip');
$context['icon_sources'] = array();
foreach ($stable_icons as $icon) {
$context['icon_sources'][$icon] = 'images_url';
}
}
// Message Icon Management... check the images exist.
if (empty($modSettings['messageIconChecks_disable'])) {
// If the current icon isn't known, then we need to do something...
if (!isset($context['icon_sources'][$message['icon']])) {
$context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.gif') ? 'images_url' : 'default_images_url';
}
} elseif (!isset($context['icon_sources'][$message['icon']])) {
$context['icon_sources'][$message['icon']] = 'images_url';
}
// If you're a lazy bum, you probably didn't give a subject...
$message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
// Are you allowed to remove at least a single reply?
$context['can_remove_post'] |= allowedTo('delete_own') && (empty($modSettings['edit_disable_time']) || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 >= time()) && $message['id_member'] == $user_info['id'];
// If it couldn't load, or the user was a guest.... someday may be done with a guest table.
if (!loadMemberContext($message['id_member'], true)) {
// Notice this information isn't used anywhere else....
$memberContext[$message['id_member']]['name'] = $message['poster_name'];
$memberContext[$message['id_member']]['id'] = 0;
$memberContext[$message['id_member']]['group'] = $txt['guest_title'];
$memberContext[$message['id_member']]['link'] = $message['poster_name'];
$memberContext[$message['id_member']]['email'] = $message['poster_email'];
$memberContext[$message['id_member']]['show_email'] = showEmailAddress(true, 0);
$memberContext[$message['id_member']]['is_guest'] = true;
} else {
$memberContext[$message['id_member']]['can_view_profile'] = allowedTo('profile_view_any') || $message['id_member'] == $user_info['id'] && allowedTo('profile_view_own');
$memberContext[$message['id_member']]['is_topic_starter'] = $message['id_member'] == $context['topic_starter_id'];
$memberContext[$message['id_member']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member']]['warning_status'] && ($context['user']['can_mod'] || !$user_info['is_guest'] && !empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member'] == $user_info['id']));
}
$memberContext[$message['id_member']]['ip'] = $message['poster_ip'];
// Do the censor thang.
censorText($message['body']);
censorText($message['subject']);
// Run BBC interpreter on the message.
$message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
// Compose the memory eat- I mean message array.
$output = array('attachment' => loadAttachmentContext($message['id_msg']), 'alternate' => $counter % 2, 'id' => $message['id_msg'], 'href' => $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'] . '" rel="nofollow">' . $message['subject'] . '</a>', 'member' => &$memberContext[$message['id_member']], 'icon' => $message['icon'], 'icon_url' => $settings[$context['icon_sources'][$message['icon']]] . '/post/' . $message['icon'] . '.gif', 'subject' => $message['subject'], 'time' => timeformat($message['poster_time']), 'timestamp' => forum_time(true, $message['poster_time']), 'counter' => $counter, 'modified' => array('time' => timeformat($message['modified_time']), 'timestamp' => forum_time(true, $message['modified_time']), 'name' => $message['modified_name']), 'body' => $message['body'], 'new' => empty($message['is_read']), 'approved' => $message['approved'], 'first_new' => isset($context['start_from']) && $context['start_from'] == $counter, 'is_ignored' => !empty($modSettings['enable_buddylist']) && !empty($options['posts_apply_ignore_list']) && in_array($message['id_member'], $context['user']['ignoreusers']), 'can_approve' => !$message['approved'] && $context['can_approve'], 'can_unapprove' => $message['approved'] && $context['can_approve'], 'can_modify' => (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('modify_any') || allowedTo('modify_replies') && $context['user']['started'] || allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || !$message['approved'] || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 > time())), 'can_remove' => allowedTo('delete_any') || allowedTo('delete_replies') && $context['user']['started'] || allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 > time()), 'can_see_ip' => allowedTo('moderate_forum') || $message['id_member'] == $user_info['id'] && !empty($user_info['id']));
// Is this user the message author?
$output['is_message_author'] = $message['id_member'] == $user_info['id'];
if (empty($options['view_newest_first'])) {
$counter++;
} else {
$counter--;
}
return $output;
}