本文整理汇总了PHP中postParser::parse_badwords方法的典型用法代码示例。如果您正苦于以下问题:PHP postParser::parse_badwords方法的具体用法?PHP postParser::parse_badwords怎么用?PHP postParser::parse_badwords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类postParser
的用法示例。
在下文中一共展示了postParser::parse_badwords方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: round
$percent = round($percent, 2);
}
if ($percent > 100) {
$percent = 100;
}
if (!empty($memprofile['icq'])) {
$memprofile['icq'] = intval($memprofile['icq']);
} else {
$memprofile['icq'] = '';
}
$awaybit = '';
if ($memprofile['away'] == 1 && $mybb->settings['allowaway'] != 0) {
$lang->away_note = $lang->sprintf($lang->away_note, $memprofile['username']);
$awaydate = my_date($mybb->settings['dateformat'], $memprofile['awaydate']);
if (!empty($memprofile['awayreason'])) {
$reason = $parser->parse_badwords($memprofile['awayreason']);
$awayreason = htmlspecialchars_uni($reason);
} else {
$awayreason = $lang->away_no_reason;
}
if ($memprofile['returndate'] == '') {
$returndate = "{$lang->unknown}";
} else {
$returnhome = explode("-", $memprofile['returndate']);
// PHP native date functions use integers so timestamps for years after 2038 will not work
// Thus we use adodb_mktime
if ($returnhome[2] >= 2038) {
require_once MYBB_ROOT . "inc/functions_time.php";
$returnmkdate = adodb_mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate, "", 1, true);
} else {
示例2: eval
}
$tofromusername = build_profile_link($tofromusername, $tofromuid);
$denyreceipt = '';
if ($message['icon'] > 0 && $icon_cache[$message['icon']]) {
$icon = $icon_cache[$message['icon']];
$icon['path'] = str_replace("{theme}", $theme['imgdir'], $icon['path']);
$icon['path'] = htmlspecialchars_uni($icon['path']);
$icon['name'] = htmlspecialchars_uni($icon['name']);
eval("\$icon = \"" . $templates->get("private_messagebit_icon") . "\";");
} else {
$icon = '	';
}
if (!trim($message['subject'])) {
$message['subject'] = $lang->pm_no_subject;
}
$message['subject'] = $parser->parse_badwords($message['subject']);
if (my_strlen($message['subject']) > 50) {
$message['subject'] = htmlspecialchars_uni(my_substr($message['subject'], 0, 50) . "...");
} else {
$message['subject'] = htmlspecialchars_uni($message['subject']);
}
if ($message['folder'] != "3") {
$senddate = my_date('relative', $message['dateline']);
} else {
$senddate = $lang->not_sent;
}
$foldername = $foldernames[$message['folder']];
// What we do here is parse the post using our post parser, then strip the tags from it
$parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
$message['message'] = strip_tags($parser->parse_message($message['message'], $parser_options));
if (my_strlen($message['message']) > 200) {
示例3: build_postbit
//.........这里部分代码省略.........
}
// Sanatize our custom profile fields for use in templates, if people choose to use them
foreach ($post as $post_field => $field_value) {
if (substr($post_field, 0, 3) != 'fid') {
continue;
}
$post[$post_field] = htmlspecialchars_uni($field_value);
}
if (!$postcounter) {
// Used to show the # of the post
if ($page > 1) {
if (!$mybb->settings['postsperpage'] || (int) $mybb->settings['postsperpage'] < 1) {
$mybb->settings['postsperpage'] = 20;
}
$postcounter = $mybb->settings['postsperpage'] * ($page - 1);
} else {
$postcounter = 0;
}
$post_extra_style = "border-top-width: 0;";
} elseif ($mybb->input['mode'] == "threaded") {
$post_extra_style = "border-top-width: 0;";
} else {
$post_extra_style = "margin-top: 5px;";
}
if (!$altbg) {
// Define the alternate background colour if this is the first post
$altbg = "trow1";
}
$postcounter++;
// Format the post date and time using my_date
$post['postdate'] = my_date($mybb->settings['dateformat'], $post['dateline']);
$post['posttime'] = my_date($mybb->settings['timeformat'], $post['dateline']);
// Dont want any little 'nasties' in the subject
$post['subject'] = $parser->parse_badwords($post['subject']);
// Pm's have been htmlspecialchars_uni()'ed already.
if ($post_type != 2) {
$post['subject'] = htmlspecialchars_uni($post['subject']);
}
if (empty($post['subject'])) {
$post['subject'] = ' ';
}
$post['author'] = $post['uid'];
// Get the usergroup
if ($post['userusername']) {
if (!$post['displaygroup']) {
$post['displaygroup'] = $post['usergroup'];
}
$usergroup = $groupscache[$post['displaygroup']];
} else {
$usergroup = $groupscache[1];
}
if (!is_array($titlescache)) {
$cached_titles = $cache->read("usertitles");
if (!empty($cached_titles)) {
foreach ($cached_titles as $usertitle) {
$titlescache[$usertitle['posts']] = $usertitle;
}
}
if (is_array($titlescache)) {
krsort($titlescache);
}
unset($usertitle, $cached_titles);
}
// Work out the usergroup/title stuff
$post['groupimage'] = '';
if (!empty($usergroup['image'])) {
示例4: multipage
}
if ($page > $pages || $page <= 0) {
$page = 1;
}
if ($page) {
$start = ($page - 1) * $perpage;
} else {
$start = 0;
$page = 1;
}
$multipage = multipage($unapproved_threads, $perpage, $page, "modcp.php?action=modqueue&type=threads");
$query = $db->query("\n\t\t\tSELECT t.tid, t.dateline, t.fid, t.subject, t.username AS threadusername, p.message AS postmessage, u.username AS username, t.uid\n\t\t\tFROM " . TABLE_PREFIX . "threads t\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (p.pid=t.firstpost)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=t.uid)\n\t\t\tWHERE t.visible='0' {$tflist_queue_threads}\n\t\t\tORDER BY t.lastpost DESC\n\t\t\tLIMIT {$start}, {$perpage}\n\t\t");
$threads = '';
while ($thread = $db->fetch_array($query)) {
$altbg = alt_trow();
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$thread['threadlink'] = get_thread_link($thread['tid']);
$forum_link = get_forum_link($thread['fid']);
$forum_name = $forum_cache[$thread['fid']]['name'];
$threaddate = my_date('relative', $thread['dateline']);
if ($thread['username'] == "") {
if ($thread['threadusername'] != "") {
$profile_link = $thread['threadusername'];
} else {
$profile_link = $lang->guest;
}
} else {
$profile_link = build_profile_link($thread['username'], $thread['uid']);
}
$thread['postmessage'] = nl2br(htmlspecialchars_uni($thread['postmessage']));
eval("\$forum = \"" . $templates->get("modcp_modqueue_link_forum") . "\";");
示例5:
// Get the thread details from the database.
$thread = get_thread($mybb->input['tid']);
// Get thread prefix if there is one.
$thread['threadprefix'] = '';
$thread['displayprefix'] = '';
if ($thread['prefix'] != 0) {
$threadprefix = build_prefixes($thread['prefix']);
if ($threadprefix['prefix']) {
$thread['threadprefix'] = $threadprefix['prefix'] . ' ';
$thread['displayprefix'] = $threadprefix['displaystyle'] . ' ';
}
}
if (substr($thread['closed'], 0, 6) == "moved|") {
$thread['tid'] = 0;
}
$reply_subject = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($reply_subject);
// Subject too long? Shorten it to avoid error message
if (my_strlen($reply_subject) > 85) {
$reply_subject = my_substr($reply_subject, 0, 82) . '...';
}
$reply_subject = htmlspecialchars_uni($reply_subject);
$tid = $thread['tid'];
$fid = $thread['fid'];
if (!$thread['username']) {
$thread['username'] = $lang->guest;
}
$visibleonly = "AND visible='1'";
$visibleonly2 = "AND p.visible='1' AND t.visible='1'";
// Is the currently logged in user a moderator of this forum?
if (is_moderator($fid)) {
示例6: while
}
// Fetch attachments assigned to this post.
if ($mybb->get_input('pid', MyBB::INPUT_INT)) {
$attachwhere = "pid='" . $mybb->get_input('pid', MyBB::INPUT_INT) . "'";
} else {
$attachwhere = "posthash='" . $db->escape_string($mybb->get_input('posthash')) . "'";
}
$query = $db->simple_select("attachments", "*", $attachwhere);
while ($attachment = $db->fetch_array($query)) {
$attachcache[0][$attachment['aid']] = $attachment;
}
$postbit = build_postbit($post, 1);
eval("\$preview = \"" . $templates->get("previewpost") . "\";");
}
}
$subject = htmlspecialchars_uni($parser->parse_badwords($subject));
$posthash = htmlspecialchars_uni($mybb->get_input('posthash'));
// Do we have attachment errors?
if (count($errors) > 0) {
$reply_errors = inline_error($errors);
}
// Get a listing of the current attachments.
if ($mybb->settings['enableattachments'] != 0 && $forumpermissions['canpostattachments'] != 0) {
$attachcount = 0;
if ($pid) {
$attachwhere = "pid='{$pid}'";
} else {
$attachwhere = "posthash='" . $db->escape_string($posthash) . "'";
}
$attachments = '';
$query = $db->simple_select("attachments", "*", $attachwhere);
示例7: firstpreview_pm
function firstpreview_pm()
{
global $mybb, $db, $charset, $headerinclude, $header;
$header = '<div class="arrow-down"></div>' . $header;
// Add jQuery and noConflict for MyBB 1.6.*
$jquery = '';
$noconflict = '';
if ($mybb->version < "1.7.0") {
$jquery = '<script type="text/javascript">
//<![CDATA[
if (!window.jQuery)
{
document.write(unescape("%3Cscript src=\\"http://code.jquery.com/jquery-latest.min.js\\" type=\\"text/javascript\\"%3E%3C/script%3E"));
}
//]]>
</script>';
$noconflict = 'jQuery.noConflict();';
}
// Background color
$bg_color = '#aaaaaa';
if (isset($mybb->settings['firstpreview_bg']) && preg_match('/^#([0-9a-f]{1,6})$/i', $mybb->settings['firstpreview_bg'])) {
$bg_color = htmlspecialchars_uni($mybb->settings['firstpreview_bg']);
}
// Close button
$close_preview = '#close_preview{display:none;cursor:pointer;background:#000;color:#fff;float:right;font-size:1em;font-weight:bold;text-align:center;width:20px;height:20px;border-radius:5px}';
if (isset($mybb->settings['firstpreview_close']) && $mybb->settings['firstpreview_close'] == 1) {
$close_preview = '#close_preview{cursor:pointer;background:#000;color:#fff;float:right;font-size:1em;font-weight:bold;text-align:center;width:20px;height:20px;border-radius:5px}';
}
// Insert the code
$headerinclude .= '
<!-- start: first_preview_plugin -->
<style type="text/css">
.modal_firstpost{text-align:left;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;border:1px solid ' . $bgcolor . ';display:none;position:absolute;z-index:29000;width:390px;height:180px;overflow:hidden}
.fpreview{z-index:29001;width:390px;height:180px;overflow:auto;background:' . $bg_color . '}
.arrow-down{display:none;position:absolute;z-index:28999;width:0;height:0;border-left:20px solid transparent;border-right:20px solid transparent;border-top:20px solid ' . $bg_color . '}
.prev_content{padding:10px;height:auto;word-wrap:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;-o-hyphens:auto;hyphens:auto;background:none}
' . $close_preview . '
</style>
' . $jquery . '
<script type="text/javascript">
//<![CDATA[
' . $noconflict . '
<!--
if(use_xmlhttprequest == 1) {
jQuery(document).ready(function(e){e(".pmprev").on("touchenter mouseenter",function(){id=e(this).attr("id");pmid=id.replace(/[^\\d.]/g,"");var t=e(this).offset().left;var n=e(this).offset().top-200;showPost=setTimeout(function(){e.ajax({url:"private.php?pmid="+pmid+"&firstpm=1",type:"post",complete:function(t){e(".modal_firstpost").html(t.responseText)}});e(".modal_firstpost").fadeIn("slow");e(".modal_firstpost").css("top",n);e(".modal_firstpost").css("left",t);e(".arrow-down").fadeIn("slow");e(".arrow-down").css("top",n+180);e(".arrow-down").css("left",t+20);},1500)});e(".pmprev").on("mouseleave touchleave touchend",function(){clearTimeout(showPost);});e(".modal_firstpost").on("mouseleave touchmove",function(){e(".modal_firstpost").fadeOut("slow");e(".arrow-down").fadeOut("fast")});e(".modal_firstpost").on("click", "#close_preview", function(){e(".modal_firstpost").fadeOut("slow");e(".arrow-down").fadeOut("fast")})});
}
//]]>
</script>
<!-- end: first_preview_plugin -->
';
// Get the pm preview
if (isset($mybb->input['firstpm']) && $mybb->input['firstpm'] == 1 && $mybb->request_method == "post") {
$pmid = (int) $mybb->input['pmid'];
$query = $db->simple_select('privatemessages', '*', "pmid = '" . $pmid . "'");
$pm = $db->fetch_array($query);
// Load the users own messages only
if ($pm['uid'] != $mybb->user['uid']) {
return;
}
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$pm['subject'] = htmlspecialchars_uni($parser->parse_badwords($pm['subject']));
$user = get_user($pm['fromid']);
$idtype = 'pmid';
$parser_options['allow_html'] = $mybb->settings['pmsallowhtml'];
$parser_options['allow_mycode'] = $mybb->settings['pmsallowmycode'];
$parser_options['allow_smilies'] = $mybb->settings['pmsallowsmilies'];
$parser_options['allow_imgcode'] = $mybb->settings['pmsallowimgcode'];
$parser_options['allow_videocode'] = $mybb->settings['pmsallowvideocode'];
$parser_options['me_username'] = $user['username'];
$parser_options['filter_badwords'] = 1;
$id = $pmid;
$pm['message'] = $parser->parse_message($pm['message'], $parser_options);
$pmdate = my_date($mybb->settings['dateformat'], $pm['dateline']);
$pmtime = my_date($mybb->settings['timeformat'], $pm['dateline']);
$pmsent = ' (' . $pmdate . ', ' . $pmtime . ')';
if (isset($mybb->settings['firstpreview_html']) && $mybb->settings['firstpreview_html'] != 1) {
$pm['message'] = strip_tags($pm['message'], "<br><p><ul><ol><li>");
}
if (!empty($mybb->settings['firstpreview_length']) && $mybb->settings['firstpreview_length'] != "0" && my_strlen($pm['message']) > (int) $mybb->settings['firstpreview_length']) {
$pm['message'] = preg_replace("!<a([^>]+)>!isU", "", $pm['message']);
$pm['message'] = str_replace("</a>", "", $pm['message']);
$pm['message'] = my_substr($pm['message'], 0, (int) $mybb->settings['firstpreview_length']) . '...<p><a href="private.php?action=read&pmid=' . (int) $pm['pmid'] . '">more</a></p>';
}
$preview = "<div class=\"fpreview\"><span id=\"close_preview\">❌</span>\n\t\t<div class=\"thead\" style=\"text-align:center; font-weight:bold; min-height:20px;\">" . $pm['subject'] . "</div>\n\t\t<div class=\"tcat\" style=\"padding-left:10px;\">" . build_profile_link(format_name(htmlspecialchars_uni($user['username']), (int) $user['usergroup'], (int) $user['displaygroup']), (int) $pm['fromid']) . "<span class=\"smalltext\">" . $pmsent . "</span></div>\n\t\t<div class=\"prev_content\">" . $pm['message'] . "</div>\n\t\t</div>";
header("Content-type: text/plain; charset={$charset}");
echo $preview;
exit;
}
}
示例8: ps_GetTopDownloads
function ps_GetTopDownloads($NumOfRows)
{
global $mybb, $db, $templates, $theme, $lang, $parser, $unviewables, $under_mod_forums_arr, $vcheck, $ps_align;
if (!is_object($parser)) {
require_once MYBB_ROOT . 'inc/class_parser.php';
$parser = new postParser();
}
$query = $db->query("\n\t\tSELECT p.subject,t.fid,t.visible,a.pid,a.downloads,a.filename \n\t\tFROM " . TABLE_PREFIX . "attachments a \n\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (p.pid = a.pid) \n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid = p.tid) \n\t\tWHERE (t.visible = '1' " . $vcheck . ") \n\t\t" . $unviewables['string'] . " \n\t\tAND t.closed NOT LIKE 'moved|%' \n\t\tAND t.visible != '-2' \n\t\tAND a.thumbnail = '' \n\t\tGROUP BY p.pid \n\t\tORDER BY a.downloads DESC \n\t\tLIMIT 0," . $NumOfRows);
$query_icon = $db->query("SELECT extension,icon FROM " . TABLE_PREFIX . "attachtypes");
while ($result_icon = $db->fetch_array($query_icon)) {
$mimicon[$result_icon['extension']] = $result_icon['icon'];
}
while ($top_downloads = $db->fetch_array($query)) {
$subject_long = htmlspecialchars_uni($parser->parse_badwords($top_downloads['subject']));
$pid = $top_downloads['pid'];
$subject = htmlspecialchars_uni(ps_SubjectLength($parser->parse_badwords($top_downloads['subject']), NULL, true));
$downloadnum = $top_downloads['downloads'];
$attach_icon = $mimicon[get_extension($top_downloads['filename'])];
$highlight = ps_GetHighlight($top_downloads);
$postlink = get_post_link($pid) . "#pid" . $pid;
eval("\$topdownloads_row .= \"" . $templates->get("prostats_topdownloads_row") . "\";");
}
eval("\$column_topdownloads = \"" . $templates->get("prostats_topdownloads") . "\";");
return $column_topdownloads;
}
示例9: asb_rand_quote_get_quote
function asb_rand_quote_get_quote($settings, $width)
{
global $db, $mybb, $templates, $lang, $theme;
if (!$lang->asb_addon) {
$lang->load('asb_addon');
}
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if ($unviewable) {
$unviewwhere = " AND p.fid NOT IN ({$unviewable})";
}
// get inactive forums
$inactive = get_inactive_forums();
if ($inactive) {
$inactivewhere = " AND p.fid NOT IN ({$inactive})";
}
if ($settings['important_threads_only']) {
$important_threads = ' AND NOT t.sticky=0';
}
// build the exclude conditions
$show['fids'] = asb_build_id_list($settings['forum_show_list'], 'p.fid');
$show['tids'] = asb_build_id_list($settings['thread_show_list'], 'p.tid');
$hide['fids'] = asb_build_id_list($settings['forum_hide_list'], 'p.fid');
$hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 'p.tid');
$where['show'] = asb_build_SQL_where($show, ' OR ');
$where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT ');
$query_where = $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND ');
$post_query = $db->query("\n\t\tSELECT\n\t\t\tp.pid, p.message, p.fid, p.tid, p.subject, p.uid,\n\t\t\tu.username, u.usergroup, u.displaygroup, u.avatar,\n\t\t\tt.sticky\n\t\tFROM {$db->table_prefix}posts p\n\t\tLEFT JOIN {$db->table_prefix}users u ON (u.uid=p.uid)\n\t\tLEFT JOIN {$db->table_prefix}threads t ON (t.tid=p.tid)\n\t\tWHERE\n\t\t\tp.visible='1'{$query_where}\n\t\tORDER BY\n\t\t\tRAND()\n\t\tLIMIT 1;");
// if there was 1 . . .
if ($db->num_rows($post_query) == 0) {
return false;
}
$rand_post = $db->fetch_array($post_query);
// build a post parser
require_once MYBB_ROOT . 'inc/class_parser.php';
$parser = new postParser();
// we just need the text and smilies (we'll parse them after we check length)
$pattern = "|[[\\/\\!]*?[^\\[\\]]*?]|si";
$new_message = asb_strip_url(preg_replace($pattern, '$1', $rand_post['message']));
// get some dimensions that make sense in relation to column width
$asb_width = (int) $width;
$asb_inner_size = $asb_width * 0.83;
$avatar_size = (int) ($asb_inner_size / 5);
$font_size = $asb_width / 4.5;
$font_size = max(10, min(16, $font_size));
$username_font_size = (int) ($font_size * 0.9);
$title_font_size = (int) ($font_size * 0.65);
$message_font_size = (int) $font_size;
if (strlen($new_message) < $settings['min_length']) {
if ($settings['default_text']) {
$new_message = $settings['default_text'];
} else {
// nothing to show
return false;
}
}
if ($settings['max_length'] && strlen($new_message) > $settings['max_length']) {
$new_message = substr($new_message, 0, $settings['max_length']) . ' . . .';
}
// set up the user name link so that it displays correctly for the display group of the user
$plain_text_username = htmlspecialchars_uni($rand_post['username']);
$username = format_name($plain_text_username, $rand_post['usergroup'], $rand_post['displaygroup']);
$author_link = get_profile_link($rand_post['uid']);
$post_link = get_post_link($rand_post['pid'], $rand_post['tid']) . '#pid' . $rand_post['pid'];
$thread_link = get_thread_link($rand_post['tid']);
// allow smilies, but kill
$parser_options = array("allow_smilies" => 1);
$new_message = str_replace(array('<br />', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message . ' ', $parser_options));
// if the user has an avatar then display it, otherwise force the default avatar.
$avatar_filename = "{$theme['imgdir']}/default_avatar.gif";
if ($rand_post['avatar'] != '') {
$avatar_filename = $rand_post['avatar'];
}
$avatar_alt = $lang->sprintf($lang->asb_random_quote_users_profile, $plain_text_username);
eval("\$read_more = \"" . $templates->get('asb_rand_quote_read_more') . "\";");
if (my_strlen($rand_post['subject']) > 40) {
$rand_post['subject'] = my_substr($rand_post['subject'], 0, 40) . ' . . .';
}
if (substr(strtolower($rand_post['subject']), 0, 3) == 're:') {
$rand_post['subject'] = substr($rand_post['subject'], 3);
}
$rand_post['subject'] = htmlspecialchars_uni($parser->parse_badwords($rand_post['subject']));
$thread_title_link = <<<EOF
<strong><a href="{$thread_link}" title="{$lang->asb_random_quotes_read_more_threadlink_title}"><span style="font-size: {$title_font_size}px;">{$rand_post['subject']}</span></a></strong>
EOF;
// eval() the template
eval("\$this_quote = \"" . $templates->get("asb_rand_quote_sidebox") . "\";");
return $this_quote;
}
示例10: get_announcement_list
function get_announcement_list($foruminfo, $fid)
{
// Gather forum stats
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $time, $mybbgroups, $cache;
$has_announcements = $has_modtools = false;
$forum_stats = $cache->read("forumsdisplay");
$parser = new postParser();
if (is_array($forum_stats)) {
if (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$fid]['modtools'])) {
// Mod tools are specific to forums, not parents
$has_modtools = true;
}
if (!empty($forum_stats[-1]['announcements']) || !empty($forum_stats[$fid]['announcements'])) {
// Global or forum-specific announcements
$has_announcements = true;
}
}
$parentlist = $foruminfo['parentlist'];
$parentlistexploded = explode(",", $parentlist);
foreach ($parentlistexploded as $mfid) {
if (!empty($forum_stats[$mfid]['announcements'])) {
$has_announcements = true;
}
}
$announcementlist = $topic_list = array();
if ($has_announcements == true) {
$limit = '';
$announcements = '';
if ($mybb->settings['announcementlimit']) {
$limit = "LIMIT 0, " . $mybb->settings['announcementlimit'];
}
$sql = build_parent_list($fid, "fid", "OR", $parentlist);
$time = TIME_NOW;
$query = $db->query("\n\t\t\tSELECT a.*, u.username\n\t\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND ({$sql} OR fid='-1')\n\t\t\tORDER BY a.startdate DESC {$limit}\n\t\t");
// See if this announcement has been read in our announcement array
$cookie = array();
if (isset($mybb->cookies['mybb']['announcements'])) {
$cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
}
$announcementlist = '';
$bgcolor = alt_trow(true);
// Reset the trow colors
while ($announcement = $db->fetch_array($query)) {
if ($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) {
$new_class = ' class="subject_new"';
$folder = "newfolder";
} else {
$new_class = ' class="subject_old"';
$folder = "folder";
}
// Mmm, eat those announcement cookies if they're older than our last visit
if (isset($cookie[$announcement['aid']]) && $cookie[$announcement['aid']] < $mybb->user['lastvisit']) {
unset($cookie[$announcement['aid']]);
}
$announcement['announcementlink'] = get_announcement_link($announcement['aid']);
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$postdate = my_date('relative', $announcement['startdate']);
$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
$announcementlist[] = $announcement;
}
if (empty($cookie)) {
// Clean up cookie crumbs
my_setcookie('mybb[announcements]', 0, TIME_NOW - 60 * 60 * 24 * 365);
} else {
if (!empty($cookie)) {
my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);
}
}
foreach ($announcementlist as $announce) {
$user_info = get_user($announce['uid']);
$icon_url = absolute_url($user_info['avatar']);
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($fid, 'string'), 'topic_id' => new xmlrpcval('ann_' . $announce['aid'], 'string'), 'topic_title' => new xmlrpcval(basic_clean($announce['subject']), 'base64'), 'topic_author_id' => new xmlrpcval($announce['uid'], 'string'), 'topic_author_name' => new xmlrpcval(basic_clean($announce['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($icon_url), 'string'), 'reply_number' => new xmlrpcval(0, 'int'), 'view_number' => new xmlrpcval(0, 'int'), 'short_content' => new xmlrpcval(process_short_content($announce['message'], $parser), 'base64')), 'struct');
$topic_list[] = $xmlrpc_topic;
}
}
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval(count($announcementlist), 'int'), 'forum_id' => new xmlrpcval($fid), 'forum_name' => new xmlrpcval(basic_clean($foruminfo['name']), 'base64'), 'can_post' => new xmlrpcval(false, 'boolean'), 'can_upload' => new xmlrpcval(false, 'boolean'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例11: intval
$load_all = intval($mybb->input['load_all_quotes']);
while ($quoted_post = $db->fetch_array($query)) {
// Only show messages for the current thread
if ($quoted_post['tid'] == $tid || $load_all == 1) {
// If this post was the post for which a quote button was clicked, set the subject
if ($pid == $quoted_post['pid']) {
$subject = preg_replace('#RE:\\s?#i', '', $quoted_post['subject']);
$subject = "RE: " . $subject;
}
if ($quoted_post['userusername']) {
$quoted_post['username'] = $quoted_post['userusername'];
}
$quoted_post['message'] = preg_replace('#(^|\\r|\\n)/me ([^\\r\\n<]*)#i', "\\1* {$quoted_post['username']} \\2", $quoted_post['message']);
$quoted_post['message'] = preg_replace('#(^|\\r|\\n)/slap ([^\\r\\n<]*)#i', "\\1* {$quoted_post['username']} {$lang->slaps} \\2 {$lang->with_trout}", $quoted_post['message']);
$quoted_post['message'] = preg_replace("#\\[attachment=([0-9]+?)\\]#i", '', $quoted_post['message']);
$quoted_post['message'] = $parser->parse_badwords($quoted_post['message']);
$message .= "[quote='{$quoted_post['username']}' pid='{$quoted_post['pid']}' dateline='{$quoted_post['dateline']}']\n{$quoted_post['message']}\n[/quote]\n\n";
$quoted_ids[] = $quoted_post['pid'];
} else {
++$external_quotes;
}
}
if ($external_quotes > 0) {
if ($external_quotes == 1) {
$multiquote_text = $lang->multiquote_external_one;
$multiquote_deselect = $lang->multiquote_external_one_deselect;
$multiquote_quote = $lang->multiquote_external_one_quote;
} else {
$multiquote_text = $lang->sprintf($lang->multiquote_external, $external_quotes);
$multiquote_deselect = $lang->multiquote_external_deselect;
$multiquote_quote = $lang->multiquote_external_quote;
示例12: array
$onlyusfids = array();
// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
foreach ($group_permissions as $fid => $forum_permissions) {
if ($forum_permissions['canonlyviewownthreads'] == 1) {
$onlyusfids[] = $fid;
}
}
if (!empty($onlyusfids)) {
$permsql .= "AND ((fid IN(" . implode(',', $onlyusfids) . ") AND uid='{$mybb->user['uid']}') OR fid NOT IN(" . implode(',', $onlyusfids) . "))";
}
// Get the threads to syndicate.
$query = $db->simple_select("threads", "subject, tid, dateline, firstpost", "visible='1' AND closed NOT LIKE 'moved|%' {$permsql} {$forumlist}", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => $thread_limit));
// Loop through all the threads.
while ($thread = $db->fetch_array($query)) {
$items[$thread['tid']] = array("title" => $parser->parse_badwords($thread['subject']), "link" => $channel['link'] . get_thread_link($thread['tid']), "date" => $thread['dateline']);
$firstposts[] = $thread['firstpost'];
}
if (!empty($firstposts)) {
$firstpostlist = "pid IN(" . $db->escape_string(implode(',', $firstposts)) . ")";
$attachments = array();
$query = $db->simple_select("attachments", "*", $firstpostlist);
while ($attachment = $db->fetch_array($query)) {
if (!isset($attachments[$attachment['pid']])) {
$attachments[$attachment['pid']] = array();
}
$attachments[$attachment['pid']][] = $attachment;
}
$query = $db->simple_select("posts", "message, edittime, tid, fid, pid", $firstpostlist, array('order_by' => 'dateline', 'order_dir' => 'desc'));
while ($post = $db->fetch_array($query)) {
$parser_options = array("allow_html" => $forumcache[$post['fid']]['allowhtml'], "allow_mycode" => $forumcache[$post['fid']]['allowmycode'], "allow_smilies" => $forumcache[$post['fid']]['allowsmilies'], "allow_imgcode" => $forumcache[$post['fid']]['allowimgcode'], "allow_videocode" => $forumcache[$post['fid']]['allowvideocode'], "filter_badwords" => 1, "filter_cdata" => 1);
示例13: while
$bgcolor = alt_trow(true);
// Reset the trow colors
while ($announcement = $db->fetch_array($query)) {
if ($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) {
$new_class = ' class="subject_new"';
$folder = "newfolder";
} else {
$new_class = ' class="subject_old"';
$folder = "folder";
}
// Mmm, eat those announcement cookies if they're older than our last visit
if (isset($cookie[$announcement['aid']]) && $cookie[$announcement['aid']] < $mybb->user['lastvisit']) {
unset($cookie[$announcement['aid']]);
}
$announcement['announcementlink'] = get_announcement_link($announcement['aid']);
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$postdate = my_date('relative', $announcement['startdate']);
$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
if ($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0) {
eval("\$rating = \"" . $templates->get("forumdisplay_announcement_rating") . "\";");
$lpbackground = "trow2";
} else {
$rating = '';
$lpbackground = "trow1";
}
if ($ismod) {
eval("\$modann = \"" . $templates->get("forumdisplay_announcements_announcement_modbit") . "\";");
} else {
$modann = '';
}
示例14: get_subscribed_topic_func
function get_subscribed_topic_func($xmlrpc_params)
{
global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
$lang->load("usercp");
$parser = new postParser();
$input = Tapatalk_Input::filterXmlInput(array('start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT), $xmlrpc_params);
if ($mybb->user['uid'] == 0 || $mybb->usergroup['canusercp'] == 0) {
return tt_no_permission();
}
$query = $db->simple_select("forumpermissions", "*", "gid='" . $db->escape_string($mybb->user['usergroup']) . "'");
while ($permissions = $db->fetch_array($query)) {
$permissioncache[$permissions['gid']][$permissions['fid']] = $permissions;
}
while ($forum = $db->fetch_array($query)) {
if ($mybb->user['uid'] == 0) {
if ($forumsread[$forum['fid']]) {
$forum['lastread'] = $forumsread[$forum['fid']];
}
}
$readforums[$forum['fid']] = $forum['lastread'];
}
require_once MYBB_ROOT . "inc/functions_forumlist.php";
$fpermissions = forum_permissions();
list($start, $limit) = process_page($input['start_num'], $input['last_num']);
// Thread visiblity
$visible = "AND t.visible != 0";
if (is_moderator() == true) {
$visible = '';
}
// Do Multi Pages
$query = $db->query("\n\t\tSELECT COUNT(ts.tid) as threads\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions ts\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid = ts.tid)\n\t\tWHERE ts.uid = '" . $mybb->user['uid'] . "' {$visible}\n\t");
$threadcount = $db->fetch_field($query, "threads");
// Fetch subscriptions
$query = $db->query("\n\t\tSELECT s.*, t.*, t.username AS threadusername, u.username, u.username, u.avatar, if({$mybb->user['uid']} > 0 and s.uid = {$mybb->user['uid']}, 1, 0) as subscribed, po.message, f.name as forumname, IF(b.lifted > UNIX_TIMESTAMP() OR b.lifted = 0, 1, 0) as isbanned\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions s\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (s.tid=t.tid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid = t.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "banned b ON (b.uid = t.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "posts po ON (po.pid = t.firstpost)\n\t\tleft join " . TABLE_PREFIX . "forums f on f.fid = t.fid\n\t\tWHERE s.uid='" . $mybb->user['uid'] . "' {$visible}\n\t\tORDER BY t.lastpost DESC\n\t\tLIMIT {$start}, {$limit}\n\t");
while ($subscription = $db->fetch_array($query)) {
$forumpermissions = $fpermissions[$subscription['fid']];
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
// Hmm, you don't have permission to view this thread - unsubscribe!
$del_subscriptions[] = $subscription['tid'];
} else {
if ($subscription['tid']) {
$subscriptions[$subscription['tid']] = $subscription;
}
}
}
if (is_array($del_subscriptions)) {
$tids = implode(',', $del_subscriptions);
if ($tids) {
$db->delete_query("threadsubscriptions", "tid IN ({$tids}) AND uid='{$mybb->user['uid']}'");
}
}
$topic_list = array();
if (is_array($subscriptions)) {
$tids = implode(",", array_keys($subscriptions));
// Build a forum cache.
$query = $db->query("\n\t\t\tSELECT f.fid, fr.dateline AS lastread\n\t\t\tFROM " . TABLE_PREFIX . "forums f\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\t\tWHERE f.active != 0\n\t\t\tORDER BY pid, disporder\n\t\t");
while ($forum = $db->fetch_array($query)) {
if ($mybb->user['uid'] == 0) {
if ($forumsread[$forum['fid']]) {
$forum['lastread'] = $forumsread[$forum['fid']];
}
}
$readforums[$forum['fid']] = $forum['lastread'];
}
// Read threads
if ($mybb->settings['threadreadcut'] > 0) {
$query = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");
while ($readthread = $db->fetch_array($query)) {
$subscriptions[$readthread['tid']]['lastread'] = $readthread['dateline'];
}
}
// Now we can build our subscription list
foreach ($subscriptions as $thread) {
$bgcolor = alt_trow();
$folder = '';
$prefix = '';
// If this thread has a prefix, insert a space between prefix and subject
if ($thread['prefix'] != 0) {
$thread['threadprefix'] .= ' ';
}
// Sanitize
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;
$unreadpost = 0;
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
$forum_read = $readforums[$thread['fid']];
$read_cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($forum_read == 0 || $forum_read < $read_cutoff) {
$forum_read = $read_cutoff;
}
} else {
$forum_read = $forumsread[$thread['fid']];
}
if ($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read) {
$cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
}
if ($thread['lastpost'] > $cutoff) {
//.........这里部分代码省略.........
示例15: eval
$status_class = "trow_reputation_positive";
$vote_type_class = "reputation_positive";
$vote_type = $lang->positive;
}
}
$vote_reputation = "({$vote_reputation})";
// Format the date this reputation was last modified
$last_updated_date = my_date('relative', $reputation_vote['dateline']);
$last_updated = $lang->sprintf($lang->last_updated, $last_updated_date);
// Is this rating specific to a post?
$postrep_given = '';
if ($reputation_vote['pid']) {
$postrep_given = $lang->sprintf($lang->postrep_given_nolink, $user['username']);
if (isset($post_reputation[$reputation_vote['pid']])) {
$thread_link = get_thread_link($post_reputation[$reputation_vote['pid']]['tid']);
$subject = htmlspecialchars_uni($parser->parse_badwords($post_reputation[$reputation_vote['pid']]['subject']));
$thread_link = $lang->sprintf($lang->postrep_given_thread, $thread_link, $subject);
$link = get_post_link($reputation_vote['pid']) . "#pid{$reputation_vote['pid']}";
$postrep_given = $lang->sprintf($lang->postrep_given, $link, $user['username'], $thread_link);
}
}
// Does the current user have permission to delete this reputation? Show delete link
$delete_link = '';
if ($mybb->usergroup['issupermod'] == 1 || $mybb->usergroup['candeletereputations'] == 1 && $reputation_vote['adduid'] == $mybb->user['uid'] && $mybb->user['uid'] != 0) {
eval("\$delete_link = \"" . $templates->get("reputation_vote_delete") . "\";");
}
$report_link = '';
if ($mybb->user['uid'] != 0) {
eval("\$report_link = \"" . $templates->get("reputation_vote_report") . "\";");
}
// Parse smilies in the reputation vote