本文整理汇总了PHP中parse_bbc函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_bbc函数的具体用法?PHP parse_bbc怎么用?PHP parse_bbc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_bbc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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';
}
开发者ID:jdarwood007,项目名称:SimpleDesk,代码行数:30,代码来源:SimpleDesk-AdminCustomField.php
示例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>');
}
开发者ID:norv,项目名称:EosAlpha,代码行数:31,代码来源:Recent.php
示例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);
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:35,代码来源:Printpage.php
示例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;
}
开发者ID:SatiricMan,项目名称:addons,代码行数:9,代码来源:class.smfcompatibility.plugin.php
示例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';
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:57,代码来源:Printpage.php
示例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;
}
}
开发者ID:richtaur,项目名称:chat,代码行数:14,代码来源:auth_smf.php
示例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;
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:17,代码来源:News.subs.php
示例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;
}
开发者ID:Kheros,项目名称:MMOver,代码行数:53,代码来源:Subs-Recent.php
示例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;
}
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:54,代码来源:download.php
示例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);
}
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:19,代码来源:TestBBC.subs.php
示例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>';
}
}
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:21,代码来源:bbc_script.php
示例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'];
}
}
}
开发者ID:juanitotaveras,项目名称:Polyphasic.xyz,代码行数:19,代码来源:global-hf.php
示例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);
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:49,代码来源:ManageBBC.controller.php
示例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;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:40,代码来源:Subs-Recent.php
示例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);
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:35,代码来源:ManagePosts.php
示例16: 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']('', '
//.........这里部分代码省略.........
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:101,代码来源:boardnewsmult.php
示例17: legalise_bbc
/**
* Attempt to clean up illegal BBC caused by browsers like Opera which don't obey the rules
* @param string $text
* @return string
*/
function legalise_bbc($text)
{
global $modSettings;
// Don't care about the texts that are too short.
if (strlen($text) < 3) {
return $text;
}
// We are going to cycle through the BBC and keep track of tags as they arise - in order. If get to a block level tag we're going to make sure it's not in a non-block level tag!
// This will keep the order of tags that are open.
$current_tags = array();
// This will quickly let us see if the tag is active.
$active_tags = array();
// A list of tags that's disabled by the admin.
$disabled = empty($modSettings['disabledBBC']) ? array() : array_flip(explode(',', strtolower($modSettings['disabledBBC'])));
// Add flash if it's disabled as embedded tag.
if (empty($modSettings['enableEmbeddedFlash'])) {
$disabled['flash'] = true;
}
// Get a list of all the tags that are not disabled.
$all_tags = parse_bbc(false);
$valid_tags = array();
$self_closing_tags = array();
foreach ($all_tags as $tag) {
if (!isset($disabled[$tag['tag']])) {
$valid_tags[$tag['tag']] = !empty($tag['block_level']);
}
if (isset($tag['type']) && $tag['type'] == 'closed') {
$self_closing_tags[] = $tag['tag'];
}
}
// Don't worry if we're in a code/nobbc.
$in_code_nobbc = false;
// Right - we're going to start by going through the whole lot to make sure we don't have align stuff crossed as this happens load and is stupid!
$align_tags = array('left', 'center', 'right', 'pre');
// Remove those align tags that are not valid.
$align_tags = array_intersect($align_tags, array_keys($valid_tags));
// These keep track of where we are!
if (!empty($align_tags) && count($matches = preg_split('~(\\[/?(?:' . implode('|', $align_tags) . ')\\])~', $text, -1, PREG_SPLIT_DELIM_CAPTURE)) > 1) {
// The first one is never a tag.
$isTag = false;
// By default we're not inside a tag too.
$insideTag = null;
foreach ($matches as $i => $match) {
// We're only interested in tags, not text.
if ($isTag) {
$isClosingTag = substr($match, 1, 1) === '/';
$tagName = substr($match, $isClosingTag ? 2 : 1, -1);
// We're closing the exact same tag that we opened.
if ($isClosingTag && $insideTag === $tagName) {
$insideTag = null;
} elseif (!$isClosingTag && $insideTag === null) {
$insideTag = $tagName;
} else {
unset($matches[$i]);
}
}
// The next one is gonna be the other one.
$isTag = !$isTag;
}
// We're still inside a tag and had no chance for closure?
if ($insideTag !== null) {
$matches[] = '[/' . $insideTag . ']';
}
// And a complete text string again.
$text = implode('', $matches);
}
// Quickly remove any tags which are back to back.
$backToBackPattern = '~\\[(' . implode('|', array_diff(array_keys($valid_tags), array('td', 'anchor'))) . ')[^<>\\[\\]]*\\]\\s*\\[/\\1\\]~';
$lastlen = 0;
while (strlen($text) !== $lastlen) {
$lastlen = strlen($text = preg_replace($backToBackPattern, '', $text));
}
// Need to sort the tags my name length.
uksort($valid_tags, 'sort_array_length');
// These inline tags can compete with each other regarding style.
$competing_tags = array('color', 'size');
// In case things changed above set these back to normal.
$in_code_nobbc = false;
$new_text_offset = 0;
// These keep track of where we are!
if (count($parts = preg_split(sprintf('~(\\[)(/?)(%1$s)((?:[\\s=][^\\]\\[]*)?\\])~', implode('|', array_keys($valid_tags))), $text, -1, PREG_SPLIT_DELIM_CAPTURE)) > 1) {
// Start with just text.
$isTag = false;
// Start outside [nobbc] or [code] blocks.
$inCode = false;
$inNoBbc = false;
// A buffer containing all opened inline elements.
$inlineElements = array();
// A buffer containing all opened block elements.
$blockElements = array();
// A buffer containing the opened inline elements that might compete.
$competingElements = array();
// $i: text, $i + 1: '[', $i + 2: '/', $i + 3: tag, $i + 4: tag tail.
for ($i = 0, $n = count($parts) - 1; $i < $n; $i += 5) {
$tag = $parts[$i + 3];
//.........这里部分代码省略.
|
请发表评论