本文整理汇总了PHP中parse_bbc函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_bbc函数的具体用法?PHP parse_bbc怎么用?PHP parse_bbc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_bbc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shd_admin_custom_main
/**
* Display all the custom fields, including new/edit/save/delete UI hooks
*
* @since 2.0
*/
function shd_admin_custom_main()
{
global $context, $smcFunc, $modSettings, $txt;
$context['custom_fields'] = array();
$query = shd_db_query('', '
SELECT id_field, active, field_order, field_name, field_desc, field_loc, icon, field_type, can_see, can_edit
FROM {db_prefix}helpdesk_custom_fields
ORDER BY field_order', array());
while ($row = $smcFunc['db_fetch_assoc']($query)) {
$row['active_string'] = empty($row['active']) ? 'inactive' : 'active';
$row['field_type'] = $context['field_types'][$row['field_type']][1];
// convert the integer in the DB into the string for language + image uses
$row['can_see'] = explode(',', $row['can_see']);
$row['can_edit'] = explode(',', $row['can_edit']);
$row['field_desc'] = parse_bbc($row['field_desc'], false);
$context['custom_fields'][] = $row;
}
if (!empty($context['custom_fields'])) {
$context['custom_fields'][0]['is_first'] = true;
$context['custom_fields'][count($context['custom_fields']) - 1]['is_last'] = true;
}
// Final stuff before we go.
$context['page_title'] = $txt['shd_admin_custom_fields'];
$context['sub_template'] = 'shd_custom_field_home';
}
示例2: getLastPost
function getLastPost()
{
global $scripturl, $modSettings, $board;
// Find it by the board - better to order by board than sort the entire messages table.
$request = smf_db_query('
SELECT ml.poster_time, ml.subject, ml.id_topic, ml.poster_name, ml.body, ml.id_msg, b.id_board,
ml.smileys_enabled
FROM {db_prefix}boards AS b
INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = b.id_last_msg)
WHERE {query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND ml.approved = {int:is_approved}
ORDER BY b.id_msg_updated DESC
LIMIT 1', array('recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
if (mysql_num_rows($request) == 0) {
return array();
}
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
$board = $row['id_board'];
// Censor the subject and post...
censorText($row['subject']);
censorText($row['body']);
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled']), array('<br />' => ' ')));
parse_bbc_stage2($row['body'], $row['id_msg']);
if (commonAPI::strlen($row['body']) > 128) {
$row['body'] = commonAPI::substr($row['body'], 0, 128) . '...';
}
// Send the data.
return array('topic' => $row['id_topic'], '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']), 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new">' . $row['subject'] . '</a>');
}
示例3: 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);
}
示例4: Format
public function Format($String)
{
try {
$Result = parse_bbc($String);
} catch (Exception $Ex) {
$Result = '<!-- Error: ' . htmlspecialchars($Ex->getMessage()) . '-->' . Gdn_Format::Display($String);
}
return $Result;
}
示例5: 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';
}
示例6: formatBBCode
/**
* Convert bbCode into HTML
*/
function formatBBCode($text, $smileys = true)
{
// We doing this the SMF way?
if ($this->config['Core']['Auth'] == 'SMF') {
require_once $this->config['Path']['Auth_Local'] . 'Sources/Subs.php';
return parse_bbc($text, $smileys);
} else {
// We don't HAVE bbcode, bitch!
return $text;
}
}
示例7: getNews
/**
* Prepares an array of the forum news items
*
* @package News
* @return array
*/
function getNews()
{
global $modSettings;
$admin_current_news = array();
// Ready the current news.
foreach (explode("\n", $modSettings['news']) as $id => $line) {
$admin_current_news[$id] = array('id' => $id, 'unparsed' => un_preparsecode($line), 'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext"><$1form></em>', parse_bbc($line)));
}
$admin_current_news['last'] = array('id' => 'last', 'unparsed' => '', 'parsed' => '<div id="moreNewsItems_preview"></div>');
return $admin_current_news;
}
示例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 = $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;
}
示例9: pmxc_InitContent
/**
* InitContent.
* Checks the autocache and create the content if necessary.
*/
function pmxc_InitContent()
{
global $smcFunc, $context, $user_info, $scripturl, $txt;
if ($this->visible) {
$this->download_content = parse_bbc($this->cfg['content']);
if (isset($this->cfg['config']['settings']['download_board']) && !empty($this->cfg['config']['settings']['download_board'])) {
// get downloads for board
$request = $smcFunc['db_query']('', '
SELECT a.id_attach, a.size, a.downloads, t.id_topic, t.locked, m.subject, m.body
FROM {db_prefix}attachments a
LEFT JOIN {db_prefix}messages m ON (a.id_msg = m.id_msg)
LEFT JOIN {db_prefix}topics t ON (m.id_topic = t.id_topic)
WHERE m.id_board = {int:board} AND a.mime_type NOT LIKE {string:likestr} AND t.locked = 0', array('board' => $this->cfg['config']['settings']['download_board'], 'likestr' => 'IMAGE%'));
$dlacs = implode('=1,', $this->cfg['config']['settings']['download_acs']);
$entrys = $smcFunc['db_num_rows']($request);
if ($entrys > 0) {
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$this->download_content .= '
<div style="text-align:left;">';
if (allowPmxGroup($dlacs)) {
$this->download_content .= '
<a href="' . $scripturl . '?action=dlattach;id=' . $row['id_attach'] . ';fld=' . $this->cfg['id'] . '">
<img style="vertical-align:middle;" src="' . $context['pmx_imageurl'] . 'download.png" alt="*" title="' . (empty($row['file_order']) ? $row['subject'] : substr($row['subject'], 4)) . '" /></a>';
}
if ($user_info['is_admin']) {
$this->download_content .= '
<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '">
<strong>' . (empty($row['file_order']) ? $row['subject'] : substr($row['subject'], 4)) . '</strong>
</a>';
} else {
$this->download_content .= '
<strong>' . (empty($row['file_order']) ? $row['subject'] : substr($row['subject'], 4)) . '</strong>';
}
$this->download_content .= '
<div class="dlcomment">' . parse_bbc(trim($row['body'])) . '</div>
<b>[' . round($row['size'] / 1000, 3) . '</b> ' . $txt['pmx_kb_downloads'] . '<b>' . $row['downloads'] . '</b>]
</div>' . ($entrys > 1 ? '<hr class="pmx_hr" />' : '');
$entrys--;
}
$smcFunc['db_free_result']($request);
} else {
$this->download_content .= '<br />' . $txt['pmx_download_empty'];
}
} else {
$this->download_content .= '<br />' . $txt['pmx_download_empty'];
}
}
// return the visibility flag (true/false)
return $this->visible;
}
示例10: testBBcode
/**
* testBBcode, parse bbcode and checks that the results are what we expect
*/
public function testBBcode()
{
foreach ($this->bbcTestCases as $testcase) {
$name = $testcase[0];
$test = $testcase[1];
$expected = $testcase[2];
$result = parse_bbc($test);
$this->assertEqual($expected, $result);
}
foreach ($this->bbcInvalidTestCases as $testcase) {
$name = $testcase[0];
$test = $testcase[1];
$result = parse_bbc($test);
$this->assertEqual($test, $result);
}
}
示例11: pmxc_ShowContent
/**
* ShowContent
*/
function pmxc_ShowContent()
{
global $context, $txt;
if (!empty($this->cfg['config']['settings']['printing'])) {
$printdir = 'ltr';
$printChars = $context['character_set'];
echo '
<img class="pmx_printimg" src="' . $context['pmx_imageurl'] . 'Print.png" alt="Print" title="' . $txt['pmx_text_printing'] . '" onclick="PmxPrintPage(\'' . $printdir . '\', \'' . $this->cfg['id'] . '\', \'' . $printChars . '\', \'' . $this->getUserTitle() . '\')" />
<div id="print' . $this->cfg['id'] . '">';
}
// Write out bbc parsed content
echo '
' . PortaMx_BBCsmileys(parse_bbc($this->cfg['content'], false), $this->cfg['config']['settings']['disableHSimg']);
if (!empty($this->cfg['config']['settings']['printing'])) {
echo '
</div>';
}
}
示例12: retrieveGlobalHFContent
function retrieveGlobalHFContent($placement)
{
global $context, $boarddir, $sourcedir, $global_hf, $modSettings;
if (!isset($_GET['xml']) && (!isset($_GET['action']) || $_GET['action'] != 'dlattach')) {
$global_hf = array('head' => un_htmlspecialchars(file_get_contents($boarddir . '/smfhacks_resources/global-hf-head.txt')), 'header' => un_htmlspecialchars(file_get_contents($boarddir . '/smfhacks_resources/global-hf-header.txt')), 'footer' => un_htmlspecialchars(file_get_contents($boarddir . '/smfhacks_resources/global-hf-footer.txt')));
if ($placement != 'load') {
if (!empty($modSettings['global_header_bbc'])) {
$global_hf['parsed']['header'] = parse_bbc($global_hf['header']);
}
if (!empty($modSettings['global_footer_bbc'])) {
$global_hf['parsed']['footer'] = parse_bbc($global_hf['footer']);
}
loadTemplate('smfhacks_templates/global-hf');
loadSubTemplate('global_hf' . $placement, true);
} elseif (!empty($global_hf['head'])) {
$context['html_headers'] .= "\n" . $global_hf['head'];
}
}
}
示例13: action_bbcSettings_display
/**
* Administration page in Posts and Topics > BBC.
*
* - This method handles displaying and changing which BBC tags are enabled on the forum.
*
* @uses Admin template, edit_bbc_settings sub-template.
*/
public function action_bbcSettings_display()
{
global $context, $txt, $modSettings, $scripturl;
// Initialize the form
$this->_initBBCSettingsForm();
$config_vars = $this->_bbcSettings->settings();
// Make sure a nifty javascript will enable/disable checkboxes, according to BBC globally set or not.
addInlineJavascript('
toggleBBCDisabled(\'disabledBBC\', ' . (empty($modSettings['enableBBC']) ? 'true' : 'false') . ');', true);
// We'll need this forprepare_db() and save_db()
require_once SUBSDIR . '/SettingsForm.class.php';
// Make sure we check the right tags!
$modSettings['bbc_disabled_disabledBBC'] = empty($modSettings['disabledBBC']) ? array() : explode(',', $modSettings['disabledBBC']);
// Save page
if (isset($_GET['save'])) {
checkSession();
// Security: make a pass through all tags and fix them as necessary
$bbcTags = array();
foreach (parse_bbc(false) as $tag) {
$bbcTags[] = $tag['tag'];
}
if (!isset($_POST['disabledBBC_enabledTags'])) {
$_POST['disabledBBC_enabledTags'] = array();
} elseif (!is_array($_POST['disabledBBC_enabledTags'])) {
$_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']);
}
// Work out what is actually disabled!
$_POST['disabledBBC'] = implode(',', array_diff($bbcTags, $_POST['disabledBBC_enabledTags']));
// Notify addons and integrations
call_integration_hook('integrate_save_bbc_settings', array($bbcTags));
// Save the result
Settings_Form::save_db($config_vars);
// And we're out of here!
redirectexit('action=admin;area=postsettings;sa=bbc');
}
// Make sure the template stuff is ready now...
$context['sub_template'] = 'show_settings';
$context['page_title'] = $txt['manageposts_bbc_settings_title'];
$context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=bbc';
$context['settings_title'] = $txt['manageposts_bbc_settings_title'];
Settings_Form::prepare_db($config_vars);
}
示例14: 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;
}
示例15: ModifyBBCSettings
function ModifyBBCSettings($return_config = false)
{
global $context, $txt, $modSettings, $helptxt, $scripturl, $sourcedir;
$config_vars = array(array('check', 'enableBBC'), array('check', 'enablePostHTML'), array('check', 'autoLinkUrls'), '', array('bbc', 'disabledBBC'));
if ($return_config) {
return $config_vars;
}
// Setup the template.
require_once $sourcedir . '/ManageServer.php';
$context['sub_template'] = 'show_settings';
$context['page_title'] = $txt['manageposts_bbc_settings_title'];
// Make sure we check the right tags!
$modSettings['bbc_disabled_disabledBBC'] = empty($modSettings['disabledBBC']) ? array() : explode(',', $modSettings['disabledBBC']);
// Saving?
if (isset($_GET['save'])) {
checkSession();
// Clean up the tags.
$bbcTags = array();
foreach (parse_bbc(false) as $tag) {
$bbcTags[] = $tag['tag'];
}
if (!isset($_POST['disabledBBC_enabledTags'])) {
$_POST['disabledBBC_enabledTags'] = array();
} elseif (!is_array($_POST['disabledBBC_enabledTags'])) {
$_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']);
}
// Work out what is actually disabled!
$_POST['disabledBBC'] = implode(',', array_diff($bbcTags, $_POST['disabledBBC_enabledTags']));
saveDBSettings($config_vars);
redirectexit('action=admin;area=postsettings;sa=bbc');
}
$context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=bbc';
$context['settings_title'] = $txt['manageposts_bbc_settings_title'];
prepareDBSettingContext($config_vars);
}