本文整理汇总了PHP中postParser::parse_message方法的典型用法代码示例。如果您正苦于以下问题:PHP postParser::parse_message方法的具体用法?PHP postParser::parse_message怎么用?PHP postParser::parse_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类postParser
的用法示例。
在下文中一共展示了postParser::parse_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: task_versioncheck
/**
* MyBB 1.8
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/about/license
*
*/
function task_versioncheck($task)
{
global $cache, $lang, $mybb;
$current_version = rawurlencode($mybb->version_code);
$updated_cache = array('last_check' => TIME_NOW);
// Check for the latest version
require_once MYBB_ROOT . 'inc/class_xml.php';
$contents = fetch_remote_file("http://www.mybb.com/version_check.php");
if (!$contents) {
add_task_log($task, $lang->task_versioncheck_ran_errors);
return false;
}
$pos = strpos($contents, "<");
if ($pos > 1) {
$contents = substr($contents, $pos);
}
$pos = strpos(strrev($contents), ">");
if ($pos > 1) {
$contents = substr($contents, 0, -1 * ($pos - 1));
}
$parser = new XMLParser($contents);
$tree = $parser->get_tree();
$latest_code = (int) $tree['mybb']['version_code']['value'];
$latest_version = "<strong>" . htmlspecialchars_uni($tree['mybb']['latest_version']['value']) . "</strong> (" . $latest_code . ")";
if ($latest_code > $mybb->version_code) {
$latest_version = "<span style=\"color: #C00;\">" . $latest_version . "</span>";
$version_warn = 1;
$updated_cache['latest_version'] = $latest_version;
$updated_cache['latest_version_code'] = $latest_code;
} else {
$latest_version = "<span style=\"color: green;\">" . $latest_version . "</span>";
}
// Check for the latest news
require_once MYBB_ROOT . "inc/class_feedparser.php";
$feed_parser = new FeedParser();
$feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog");
$updated_cache['news'] = array();
require_once MYBB_ROOT . '/inc/class_parser.php';
$post_parser = new postParser();
if ($feed_parser->error == '') {
foreach ($feed_parser->items as $item) {
if (isset($updated_cache['news'][2])) {
break;
}
$description = $item['description'];
$description = $post_parser->parse_message($description, array('allow_html' => true));
$description = preg_replace('#<img(.*)/>#', '', $description);
$updated_cache['news'][] = array('title' => htmlspecialchars_uni($item['title']), 'description' => $description, 'link' => htmlspecialchars_uni($item['link']), 'author' => htmlspecialchars_uni($item['author']), 'dateline' => $item['date_timestamp']);
}
}
$cache->update("update_check", $updated_cache);
add_task_log($task, $lang->task_versioncheck_ran);
}
示例2: LoadFromBeforeStartDate
static function LoadFromBeforeStartDate(DateTime $startDate, $count)
{
global $db, $parser, $mybb;
$messages = array();
$formattedStartDate = $startDate->format("'Y-m-d H:i:s'");
$TABLE_PREFIX = TABLE_PREFIX;
$query = $db->query("SELECT * FROM(\n SELECT m.`Id`, m.`SentAt`, m.`uid`, m.`Ip`, m.`Message`,\n u.`username`, u.`usergroup`, u.`displaygroup`\n FROM {$TABLE_PREFIX}badgerchat_messages m\n INNER JOIN {$TABLE_PREFIX}users u ON u.uid = m.uid\n WHERE m.`SentAt` < {$formattedStartDate}\n ORDER BY m.`SentAt` DESC LIMIT {$count}\n ) messages\n ORDER BY SentAt ASC");
$parser = new postParser();
$parser_options = array('allow_mycode' => 1, 'allow_smilies' => 1, 'allow_imgcode' => 0, 'allow_html' => 0, "allow_videocode" => 0);
//TODO: Get back more info on the user (name styling)
while ($row = $db->fetch_array($query)) {
$parsedMessage = $parser->parse_message($row['Message'], $parser_options);
$displayName = UsernameFormatter::Format($row['uid'], $row['username'], $row['usergroup'], $row['displaygroup']);
array_push($messages, new Message($row["Id"], $row["SentAt"], $displayName, $row["Ip"], $parsedMessage));
}
return $messages;
}
示例3: build_postbit
//.........这里部分代码省略.........
if ($post['visible'] == 0) {
$invisiblepost = 1;
}
} else {
$post['inlinecheck'] = "";
}
$post['postlink'] = get_post_link($post['pid'], $post['tid']);
eval("\$post['posturl'] = \"" . $templates->get("postbit_posturl") . "\";");
global $forum, $thread;
if ($forum['open'] != 0 && ($thread['closed'] != 1 || is_moderator($forum['fid']))) {
eval("\$post['button_quote'] = \"" . $templates->get("postbit_quote") . "\";");
}
if ($forumpermissions['canpostreplys'] != 0 && ($thread['closed'] != 1 || is_moderator($fid)) && $mybb->settings['multiquote'] != 0 && $forum['open'] != 0 && !$post_type) {
eval("\$post['button_multiquote'] = \"" . $templates->get("postbit_multiquote") . "\";");
}
if ($mybb->user['uid'] != "0") {
eval("\$post['button_report'] = \"" . $templates->get("postbit_report") . "\";");
}
if ($mybb->settings['logip'] != "no") {
if ($mybb->settings['logip'] == "show") {
eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_show") . "\";");
} else {
if ($mybb->settings['logip'] == "hide" && is_moderator($fid, "canviewips")) {
eval("\$post['iplogged'] = \"" . $templates->get("postbit_iplogged_hiden") . "\";");
} else {
$post['iplogged'] = "";
}
}
} else {
$post['iplogged'] = "";
}
} elseif ($post_type == 3) {
if ($mybb->usergroup['issupermod'] == 1 || is_moderator($fid)) {
eval("\$post['button_edit'] = \"" . $templates->get("announcement_edit") . "\";");
eval("\$post['button_quickdelete'] = \"" . $templates->get("announcement_quickdelete") . "\";");
}
}
if ($post['smilieoff'] == 1) {
$parser_options['allow_smilies'] = 0;
}
// If we have incoming search terms to highlight - get it done.
if (!empty($mybb->input['highlight'])) {
$parser_options['highlight'] = $mybb->input['highlight'];
$post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']);
}
$post['message'] = $parser->parse_message($post['message'], $parser_options);
get_post_attachments($id, $post);
if ($post['includesig'] != 0 && $post['username'] && $post['signature'] != "" && ($mybb->user['uid'] == 0 || $mybb->user['showsigs'] != 0) && ($post['suspendsignature'] == 0 || $post['suspendsignature'] == 1 && $post['suspendsigtime'] != 0 && $post['suspendsigtime'] < TIME_NOW) && $usergroup['canusesig'] == 1 && ($usergroup['canusesigxposts'] == 0 || $usergroup['canusesigxposts'] > 0 && $postnum > $usergroup['canusesigxposts'])) {
$sig_parser = array("allow_html" => $mybb->settings['sightml'], "allow_mycode" => $mybb->settings['sigmycode'], "allow_smilies" => $mybb->settings['sigsmilies'], "allow_imgcode" => $mybb->settings['sigimgcode'], "me_username" => $post['username'], "filter_badwords" => 1);
if ($usergroup['signofollow']) {
$sig_parser['nofollow_on'] = 1;
}
$post['signature'] = $parser->parse_message($post['signature'], $sig_parser);
eval("\$post['signature'] = \"" . $templates->get("postbit_signature") . "\";");
} else {
$post['signature'] = "";
}
$icon_cache = $cache->read("posticons");
if ($post['icon'] > 0 && $icon_cache[$post['icon']]) {
$icon = $icon_cache[$post['icon']];
$icon['path'] = htmlspecialchars_uni($icon['path']);
$icon['name'] = htmlspecialchars_uni($icon['name']);
$post['icon'] = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" style=\"vertical-align: middle;\" /> ";
} else {
$post['icon'] = "";
}
$post_visibility = '';
switch ($post_type) {
case 1:
// Message preview
$post = $plugins->run_hooks("postbit_prev", $post);
break;
case 2:
// Private message
$post = $plugins->run_hooks("postbit_pm", $post);
break;
case 3:
// Announcement
$post = $plugins->run_hooks("postbit_announcement", $post);
break;
default:
// Regular post
$post = $plugins->run_hooks("postbit", $post);
// Is this author on the ignore list of the current user? Hide this post
$ignore_bit = '';
if (is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1) {
$ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']);
eval("\$ignore_bit = \"" . $templates->get("postbit_ignored") . "\";");
$post_visibility = "display: none;";
}
break;
}
if ($mybb->settings['postlayout'] == "classic") {
eval("\$postbit = \"" . $templates->get("postbit_classic") . "\";");
} else {
eval("\$postbit = \"" . $templates->get("postbit") . "\";");
}
$GLOBALS['post'] = "";
return $postbit;
}
示例4: eval
eval('$contact_fields[\'' . $field . '\'] = "' . $templates->get($tmpl) . '";');
}
}
if ($any_contact_field || $sendemail || $sendpm || $website) {
eval('$contact_details = "' . $templates->get("member_profile_contact_details") . '";');
}
$signature = '';
if ($memprofile['signature'] && ($memprofile['suspendsignature'] == 0 || $memprofile['suspendsigtime'] < TIME_NOW) && !is_member($mybb->settings['hidesignatures']) && $memperms['canusesig'] && $memperms['canusesigxposts'] <= $memprofile['postnum']) {
$sig_parser = array("allow_html" => $mybb->settings['sightml'], "allow_mycode" => $mybb->settings['sigmycode'], "allow_smilies" => $mybb->settings['sigsmilies'], "allow_imgcode" => $mybb->settings['sigimgcode'], "me_username" => $memprofile['username'], "filter_badwords" => 1);
if ($memperms['signofollow']) {
$sig_parser['nofollow_on'] = 1;
}
if ($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) {
$sig_parser['allow_imgcode'] = 0;
}
$memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
eval("\$signature = \"" . $templates->get("member_profile_signature") . "\";");
}
$daysreg = (TIME_NOW - $memprofile['regdate']) / (24 * 3600);
if ($daysreg < 1) {
$daysreg = 1;
}
$stats = $cache->read("stats");
// Format post count, per day count and percent of total
$ppd = $memprofile['postnum'] / $daysreg;
$ppd = round($ppd, 2);
if ($ppd > $memprofile['postnum']) {
$ppd = $memprofile['postnum'];
}
$numposts = $stats['numposts'];
if ($numposts == 0) {
示例5: array
if (isset($mybb->input['preview'])) {
$parser_options = array();
$parser_options['allow_html'] = $mybb->get_input('allowhtml', MyBB::INPUT_INT);
$parser_options['allow_mycode'] = $mybb->get_input('allowmycode', MyBB::INPUT_INT);
$parser_options['allow_smilies'] = $mybb->get_input('allowsmilies', MyBB::INPUT_INT);
$parser_options['allow_imgcode'] = 1;
$parser_options['allow_videocode'] = 1;
$parser_options['me_username'] = htmlspecialchars_uni($mybb->user['username']);
$parser_options['filter_badwords'] = 1;
// Set up the message parser if it doesn't already exist.
if (!is_object($parser)) {
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
}
$preview = array();
$preview['message'] = $parser->parse_message($mybb->input['message'], $parser_options);
$preview['subject'] = htmlspecialchars_uni($mybb->input['title']);
} else {
$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
if (!in_array($mybb->input['starttime_month'], $months)) {
$mybb->input['starttime_month'] = 1;
}
if ($mybb->input['endtime_type'] == "2") {
$enddate = '0';
} else {
if (!in_array($mybb->input['endtime_month'], $months)) {
$mybb->input['endtime_month'] = 1;
}
}
$update_announcement = array("fid" => $mybb->input['fid'], "subject" => $db->escape_string($mybb->input['title']), "message" => $db->escape_string($mybb->input['message']), "startdate" => $startdate, "enddate" => $enddate, "allowhtml" => $mybb->get_input('allowhtml', MyBB::INPUT_INT), "allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT), "allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT));
$plugins->run_hooks("admin_forum_announcements_edit_commit");
示例6: build_postbit
//.........这里部分代码省略.........
}
if ($post_type != 3 && $post_type != 1 && purgespammer_show($post['postnum'], $post['usergroup'], $post['uid'])) {
eval("\$post['button_purgespammer'] = \"" . $templates->get('postbit_purgespammer') . "\";");
}
// Display profile fields on posts - only if field is filled in
if (is_array($profile_fields)) {
foreach ($profile_fields as $field) {
$fieldfid = "fid{$field['fid']}";
if (!empty($post[$fieldfid])) {
$post['fieldvalue'] = '';
$post['fieldname'] = htmlspecialchars_uni($field['name']);
$thing = explode("\n", $field['type'], "2");
$type = trim($thing[0]);
$useropts = explode("\n", $post[$fieldfid]);
if (is_array($useropts) && ($type == "multiselect" || $type == "checkbox")) {
foreach ($useropts as $val) {
if ($val != '') {
eval("\$post['fieldvalue_option'] .= \"" . $templates->get("postbit_profilefield_multiselect_value") . "\";");
}
}
if ($post['fieldvalue_option'] != '') {
eval("\$post['fieldvalue'] .= \"" . $templates->get("postbit_profilefield_multiselect") . "\";");
}
} else {
$field_parser_options = array("allow_html" => $field['allowhtml'], "allow_mycode" => $field['allowmycode'], "allow_smilies" => $field['allowsmilies'], "allow_imgcode" => $field['allowimgcode'], "allow_videocode" => $field['allowvideocode'], "filter_badwords" => 1);
if ($customfield['type'] == "textarea") {
$field_parser_options['me_username'] = $post['username'];
} else {
$field_parser_options['nl2br'] = 0;
}
if ($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) {
$field_parser_options['allow_imgcode'] = 0;
}
$post['fieldvalue'] = $parser->parse_message($post[$fieldfid], $field_parser_options);
}
eval("\$post['profilefield'] .= \"" . $templates->get("postbit_profilefield") . "\";");
}
}
}
eval("\$post['user_details'] = \"" . $templates->get("postbit_author_user") . "\";");
} else {
// Message was posted by a guest or an unknown user
$post['profilelink'] = format_name($post['username'], 1);
if ($usergroup['usertitle']) {
$post['usertitle'] = $usergroup['usertitle'];
} else {
$post['usertitle'] = $lang->guest;
}
$post['usertitle'] = htmlspecialchars_uni($post['usertitle']);
$usergroup['title'] = $lang->na;
$post['userregdate'] = $lang->na;
$post['postnum'] = $lang->na;
$post['button_profile'] = '';
$post['button_email'] = '';
$post['button_www'] = '';
$post['signature'] = '';
$post['button_pm'] = $lang->na;
$post['button_find'] = '';
$post['onlinestatus'] = '';
$post['replink'] = '';
eval("\$post['user_details'] = \"" . $templates->get("postbit_author_guest") . "\";");
}
$post['button_edit'] = '';
$post['button_quickdelete'] = '';
$post['button_quickrestore'] = '';
$post['button_quote'] = '';
示例7: newpoints_shop_page
//.........这里部分代码省略.........
while ($item = $db->fetch_array($query)) {
if ($newrow === true) {
$trstart = '<tr>';
$trend = '';
$newrow = false;
} elseif ($newrow === false) {
$trstart = '';
$trend = '</tr>';
$newrow = true;
}
if ($sellable === true && $item['sellable']) {
if ($sendable === true && $item['sendable']) {
$tdstart = '<td width="50%">';
} else {
$tdstart = '<td width="100%">';
}
$sell = $tdstart . '<form action="newpoints.php" method="POST"><input type="hidden" name="action" value="do_shop"><input type="hidden" name="shop_action" value="sell"><input type="hidden" name="iid" value="' . $item['iid'] . '"><input type="hidden" name="postcode" value="' . $mybb->post_code . '"><input type="submit" name="submit" value="' . $lang->newpoints_shop_sell . '"></form></td>';
} else {
$sell = '';
}
if ($sendable === true && $item['sendable']) {
if ($sell == '') {
$tdstart = '<td width="100%">';
} else {
$tdstart = '<td width="50%">';
}
$send = $tdstart . '<form action="newpoints.php" method="POST"><input type="hidden" name="action" value="do_shop"><input type="hidden" name="shop_action" value="send"><input type="hidden" name="iid" value="' . $item['iid'] . '"><input type="hidden" name="postcode" value="' . $mybb->post_code . '"><input type="submit" name="submit" value="' . $lang->newpoints_shop_send . '"></form></td>';
} else {
$send = '';
}
if (!$send && !$sell) {
$send = $lang->newpoints_shop_no_options;
}
$item['description'] = $parser->parse_message($item['description'], $parser_options);
// check group rules - primary group check
$grouprules = newpoints_getrules('group', $mybb->user['usergroup']);
if (!$grouprules) {
$grouprules['items_rate'] = 1.0;
}
// no rule set so default income rate is 1
// if the group items rate is 0, the price of the item is 0
if (floatval($grouprules['items_rate']) == 0) {
$item['price'] = 0;
} else {
$item['price'] = $item['price'] * floatval($grouprules['items_rate']);
}
$item['price'] = newpoints_format_points($item['price']);
$item['quantity'] = count(array_keys($myitems, $item['iid']));
// build icon
if ($item['icon'] != '') {
$item['icon'] = htmlspecialchars_uni($item['icon']);
$item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/' . $item['icon'] . '">';
} else {
$item['icon'] = '<img src="' . $mybb->settings['bburl'] . '/images/newpoints/default.png">';
}
$bgcolor = alt_trow();
$invert_bgcolor = alt_trow();
eval("\$items .= \"" . $trstart . $templates->get('newpoints_shop_myitems_item') . $trend . "\";");
}
if (!$items) {
eval("\$items = \"" . $templates->get('newpoints_shop_myitems_no_items') . "\";");
} else {
if ($newrow === false) {
eval("\$items .= \"" . $templates->get('newpoints_shop_myitems_item_empty') . "</tr>" . "\";");
$newrow = true;
}
示例8: eval
$avatar = '';
}
$anndate = my_date($mybb->settings['dateformat'], $announcement['dateline']);
$anntime = my_date($mybb->settings['timeformat'], $announcement['dateline']);
if ($announcement['replies']) {
eval("\$numcomments = \"" . $templates->get("portal_announcement_numcomments") . "\";");
} else {
eval("\$numcomments = \"" . $templates->get("portal_announcement_numcomments_no") . "\";");
$lastcomment = '';
}
$plugins->run_hooks("portal_announcement");
$parser_options = array("allow_html" => $forum[$announcement['fid']]['allowhtml'], "allow_mycode" => $forum[$announcement['fid']]['allowmycode'], "allow_smilies" => $forum[$announcement['fid']]['allowsmilies'], "allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'], "allow_videocode" => $forum[$announcement['fid']]['allowvideocode'], "filter_badwords" => 1);
if ($announcement['smilieoff'] == 1) {
$parser_options['allow_smilies'] = 0;
}
$message = $parser->parse_message($announcement['message'], $parser_options);
if (is_array($attachcache[$announcement['pid']])) {
// This post has 1 or more attachments
$validationcount = 0;
$id = $announcement['pid'];
foreach ($attachcache[$id] as $aid => $attachment) {
if ($attachment['visible']) {
// There is an attachment thats visible!
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
$attachment['filesize'] = get_friendly_size($attachment['filesize']);
$ext = get_extension($attachment['filename']);
if ($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg") {
$isimage = true;
} else {
$isimage = false;
}
示例9: date
if ($page > $pages || $page <= 0) {
$page = 1;
}
if ($page) {
$start = ($page - 1) * $perpage;
} else {
$start = 0;
$page = 1;
}
$upper = $start + $perpage;
$query = "SELECT * FROM mybb_ajaxchat{$where} LIMIT {$start},{$perpage}";
$result = db_query($query);
while ($row = mysqli_fetch_array($result)) {
$date = date('n/j/y G:i', $row["date"]);
$name = $row['username'] ? $row['username'] : 'Guest ' . $row['uid'];
$msg = $parser->parse_message($row["message"], array('filter_badwords' => 1, 'allow_mycode' => 1, 'allow_smilies' => 0, 'me_username' => 1, 'nl2br' => 0));
echo '<table id="m' . $row['id'] . '"><tr><td class="left">' . $name . '<br/><a href="logs?page=' . (floor(($row['id'] - 12) / $perpage) + 1) . '#m' . $row['id'] . '" target="_blank">→ ' . $date . '</a></td><td>' . $msg . '</td></tr></table>';
}
?>
</div>
<form action="logs" style="width: 250px; float: left;">
<input type="text" name="search" value="<?php
echo $search;
?>
" />
<input type="submit" value="Search" />
</form>
<?php
$multipage = multipage($count, $perpage, $page, $url);
if ($count > $perpage) {
echo $multipage;
示例10: save_raw_post_func
//.........这里部分代码省略.........
$tid = $post['tid'];
$thread = get_thread($tid);
if (!$thread['tid']) {
return xmlrespfalse($lang->error_invalidthread);
}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
// Get forum info
$fid = $post['fid'];
$forum = get_forum($fid);
if (!$forum || $forum['type'] != "f") {
return xmlrespfalse($lang->error_closedinvalidforum);
}
if ($forum['open'] == 0 || $mybb->user['suspendposting'] == 1) {
return tt_no_permission();
}
$forumpermissions = forum_permissions($fid);
if (!is_moderator($fid, "caneditposts")) {
if ($thread['closed'] == 1) {
return xmlrespfalse($lang->redirect_threadclosed);
}
if ($forumpermissions['caneditposts'] == 0) {
return tt_no_permission();
}
if ($mybb->user['uid'] != $post['uid']) {
return tt_no_permission();
}
// Edit time limit
$time = TIME_NOW;
if ($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < $time - $mybb->settings['edittimelimit'] * 60) {
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
return xmlrespfalse($lang->edit_time_limit);
}
}
// Check if this forum is password protected and we have a valid password
tt_check_forum_password($forum['fid']);
// Set up posthandler.
require_once MYBB_ROOT . "inc/datahandlers/post.php";
$posthandler = new PostDataHandler("update");
$posthandler->action = "post";
// Set the post data that came from the input to the $post array.
$post = array("pid" => $pid, "subject" => $input['post_title'], "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "edit_uid" => $mybb->user['uid'], "message" => $input['post_content']);
if (version_compare($mybb->version, '1.8.0', '>=') && !empty($input['editreason'])) {
$post["editreason"] = $input['editreason'];
}
// get subscription status
$query = $db->simple_select("threadsubscriptions", 'notification', "uid='" . intval($mybb->user['uid']) . "' AND tid='" . intval($tid) . "'");
$substatus = $db->fetch_array($query);
// Set up the post options from the input.
$post['options'] = array("signature" => 1, "subscriptionmethod" => isset($substatus['notification']) ? $substatus['notification'] == 1 ? 'instant' : 'none' : '', "disablesmilies" => 0);
$posthandler->set_data($post);
// Now let the post handler do all the hard work.
if (!$posthandler->validate_post()) {
$post_errors = $posthandler->get_friendly_errors();
return xmlrespfalse(implode(" :: ", $post_errors));
} else {
$postinfo = $posthandler->update_post();
$visible = $postinfo['visible'];
$first_post = $postinfo['first_post'];
// Help keep our attachments table clean.
$db->delete_query("attachments", "filename='' OR filesize<1");
if ($visible == 0 && $first_post && !is_moderator($fid, "", $mybb->user['uid'])) {
$state = 1;
} else {
if ($visible == 0 && !is_moderator($fid, "", $mybb->user['uid'])) {
$state = 1;
} else {
$state = 0;
}
}
}
$pid = intval($pid);
if (!empty($input['group_id_esc'])) {
$db->update_query("attachments", array("pid" => $pid), "posthash='{$input['group_id_esc']}'");
}
// update thread attachment account
if (count($input['attachment_id_array']) > 0) {
update_thread_counters($tid, array("attachmentcount" => "+" . count($input['attachment_id_array'])));
}
$post = get_post($pid);
$parser_options = array();
$parser_options['allow_html'] = false;
$parser_options['allow_mycode'] = true;
$parser_options['allow_smilies'] = false;
$parser_options['allow_imgcode'] = true;
$parser_options['allow_videocode'] = true;
$parser_options['nl2br'] = (bool) $input['return_html'];
$parser_options['filter_badwords'] = 1;
if (!$post['username']) {
$post['username'] = $lang->guest;
}
if ($post['userusername']) {
$parser_options['me_username'] = $post['userusername'];
} else {
$parser_options['me_username'] = $post['username'];
}
$post['message'] = $parser->parse_message($post['message'], $parser_options);
$post['subject'] = $parser->parse_badwords($post['subject']);
$result = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'state' => new xmlrpcval($state, 'int'), 'post_title' => new xmlrpcval($post['subject'], 'base64'), 'post_content' => new xmlrpcval(process_post($post['message'], $input['return_html']), 'base64')), 'struct');
return new xmlrpcresp($result);
}
示例11: unset
$page->output_footer();
exit;
}
if (!empty($tree['results']['result'])) {
if (array_key_exists("tag", $tree['results']['result'])) {
$only_theme = $tree['results']['result'];
unset($tree['results']['result']);
$tree['results']['result'][0] = $only_theme;
}
require_once MYBB_ROOT . '/inc/class_parser.php';
$post_parser = new postParser();
foreach ($tree['results']['result'] as $result) {
$result['thumbnail']['value'] = htmlspecialchars_uni($result['thumbnail']['value']);
$result['name']['value'] = htmlspecialchars_uni($result['name']['value']);
$result['description']['value'] = htmlspecialchars_uni($result['description']['value']);
$result['author']['value'] = $post_parser->parse_message($result['author']['value'], array('allow_html' => true));
$result['download_url']['value'] = htmlspecialchars_uni(html_entity_decode($result['download_url']['value']));
$table->construct_cell("<img src=\"http://community.mybb.com/{$result['thumbnail']['value']}\" alt=\"{$lang->theme_thumbnail}\" title=\"{$lang->theme_thumbnail}\"/>", array("class" => "align_center", "width" => 100));
$table->construct_cell("<strong>{$result['name']['value']}</strong><br /><small>{$result['description']['value']}</small><br /><i><small>{$lang->created_by} {$result['author']['value']}</small></i>");
$table->construct_cell("<strong><a href=\"http://community.mybb.com/{$result['download_url']['value']}\" target=\"_blank\">{$lang->download}</a></strong>", array("class" => "align_center"));
$table->construct_row();
}
}
if ($table->num_rows() == 0) {
$table->construct_cell($lang->error_no_results_found, array("colspan" => 3));
$table->construct_row();
}
$search = new Form("index.php?module=style-themes&action=browse", 'post', 'search_form');
echo "<div style=\"padding-bottom: 3px; margin-top: -9px; text-align: right;\">";
if ($mybb->input['keywords']) {
$default_class = '';
示例12: catch
if ($stop_forum_spam_checker->is_user_a_spammer('', $mybb->input['email'], get_ip())) {
$errors[] = $lang->sprintf($lang->error_stop_forum_spam_spammer, $stop_forum_spam_checker->getErrorText(array('stopforumspam_check_emails', 'stopforumspam_check_ips')));
}
} catch (Exception $e) {
if ($mybb->settings['stopforumspam_block_on_error']) {
$errors[] = $lang->error_stop_forum_spam_fetching;
}
}
}
if (empty($errors)) {
if ($mybb->settings['contact_badwords'] == 1) {
// Load the post parser
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$parser_options = array('filter_badwords' => 1);
$mybb->input['subject'] = $parser->parse_message($mybb->input['subject'], $parser_options);
$mybb->input['message'] = $parser->parse_message($mybb->input['message'], $parser_options);
}
$user = $lang->na;
if ($mybb->user['uid']) {
$user = $mybb->user['username'] . ' - ' . $mybb->settings['bburl'] . '/' . get_profile_link($mybb->user['uid']);
}
$subject = $lang->sprintf($lang->email_contact_subject, $mybb->input['subject']);
$message = $lang->sprintf($lang->email_contact, $mybb->input['email'], $user, $session->ipaddress, $mybb->input['message']);
// Email the administrator
my_mail($contactemail, $subject, $message, $mybb->input['email']);
$plugins->run_hooks('contact_do_end');
if ($mybb->settings['mail_logging'] > 0) {
// Log the message
$log_entry = array("subject" => $db->escape_string($subject), "message" => $db->escape_string($message), "dateline" => TIME_NOW, "fromuid" => $mybb->user['uid'], "fromemail" => $db->escape_string($mybb->input['email']), "touid" => 0, "toemail" => $db->escape_string($contactemail), "tid" => 0, "ipaddress" => $db->escape_binary($session->packedip), "type" => 3);
$db->insert_query("maillogs", $log_entry);
示例13: multipage
$upper = $helpcount;
}
$multipage = multipage($helpcount['total'], $perpage, $page, "misc.php?action=helpresults&sid='" . htmlspecialchars_uni($mybb->get_input('sid')) . "'");
$helpdoclist = '';
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$query = $db->query("\n\t\tSELECT h.*, s.enabled\n\t\tFROM " . TABLE_PREFIX . "helpdocs h\n\t\tLEFT JOIN " . TABLE_PREFIX . "helpsections s ON (s.sid=h.sid)\n\t\tWHERE h.hid IN(" . $db->escape_string($search['querycache']) . ") AND h.enabled='1' AND s.enabled='1'\n\t\tLIMIT {$start}, {$perpage}\n\t");
while ($helpdoc = $db->fetch_array($query)) {
$bgcolor = alt_trow();
if (my_strlen($helpdoc['name']) > 50) {
$helpdoc['name'] = htmlspecialchars_uni(my_substr($helpdoc['name'], 0, 50) . "...");
} else {
$helpdoc['name'] = htmlspecialchars_uni($helpdoc['name']);
}
$parser_options = array('allow_html' => 1, 'allow_mycode' => 0, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
$helpdoc['helpdoc'] = strip_tags($parser->parse_message($helpdoc['document'], $parser_options));
if (my_strlen($helpdoc['helpdoc']) > 350) {
$prev = my_substr($helpdoc['helpdoc'], 0, 350) . "...";
} else {
$prev = $helpdoc['helpdoc'];
}
$plugins->run_hooks("misc_helpresults_bit");
eval("\$helpdoclist .= \"" . $templates->get("misc_helpresults_bit") . "\";");
}
if ($db->num_rows($query) == 0) {
eval("\$helpdoclist = \"" . $templates->get("misc_helpresults_noresults") . "\";");
}
$plugins->run_hooks("misc_helpresults_end");
eval("\$helpresults = \"" . $templates->get("misc_helpresults") . "\";");
output_page($helpresults);
} elseif ($mybb->input['action'] == "help") {
示例14: makeprintablenav
$visible = "AND p.visible='1'";
}
$query = $db->query("\r\n SELECT u.*, u.username AS userusername, p.*\r\n FROM " . TABLE_PREFIX . "posts p\r\n LEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n WHERE p.tid='{$tid}' {$visible}\r\n ORDER BY p.dateline\r\n\tLIMIT {$start}, {$perpage}\r\n");
while ($postrow = $db->fetch_array($query)) {
if ($postrow['userusername']) {
$postrow['username'] = $postrow['userusername'];
}
$postrow['subject'] = htmlspecialchars_uni($parser->parse_badwords($postrow['subject']));
$postrow['date'] = my_date($mybb->settings['dateformat'], $postrow['dateline']);
$postrow['time'] = my_date($mybb->settings['timeformat'], $postrow['dateline']);
$postrow['profilelink'] = build_profile_link($postrow['username'], $postrow['uid']);
$parser_options = array("allow_html" => $forum['allowhtml'], "allow_mycode" => $forum['allowmycode'], "allow_smilies" => $forum['allowsmilies'], "allow_imgcode" => $forum['allowimgcode'], "allow_videocode" => $forum['allowvideocode'], "me_username" => $postrow['username'], "shorten_urls" => 0, "filter_badwords" => 1);
if ($postrow['smilieoff'] == 1) {
$parser_options['allow_smilies'] = 0;
}
$postrow['message'] = $parser->parse_message($postrow['message'], $parser_options);
$plugins->run_hooks("printthread_post");
eval("\$postrows .= \"" . $templates->get("printthread_post") . "\";");
}
$plugins->run_hooks("printthread_end");
eval("\$printable = \"" . $templates->get("printthread") . "\";");
output_page($printable);
function makeprintablenav($pid = "0", $depth = "--")
{
global $db, $pforumcache, $fid, $forum, $lang;
if (!is_array($pforumcache)) {
$parlist = build_parent_list($fid, "fid", "OR", $forum['parentlist']);
$query = $db->simple_select("forums", "name, fid, pid", "{$parlist}", array('order_by' => 'pid, disporder'));
while ($forumnav = $db->fetch_array($query)) {
$pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav;
}
示例15: parse
static function parse($message, $me_username)
{
global $mybb;
require_once MYBB_ROOT . 'inc/class_parser.php';
$parser = new postParser();
$options = ['allow_mycode' => $mybb->settings['dvz_sb_mycode'], 'allow_smilies' => $mybb->settings['dvz_sb_smilies'], 'allow_imgcode' => 0, 'filter_badwords' => 1, 'me_username' => $me_username];
return $parser->parse_message($message, $options);
}