本文整理汇总了PHP中postParser类的典型用法代码示例。如果您正苦于以下问题:PHP postParser类的具体用法?PHP postParser怎么用?PHP postParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了postParser类的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: postParser
$templatelist .= ",codebuttons,smilieinsert,modcp_announcements_new,modcp_modqueue_empty,forumjump_bit,forumjump_special,modcp_warninglogs_warning_revoked,modcp_warninglogs_warning,modcp_ipsearch_result,modcp_nav_modqueue,modcp_banuser_liftlist";
$templatelist .= ",modcp_modlogs,modcp_finduser_user,modcp_finduser,usercp_profile_customfield,usercp_profile_profilefields,modcp_ipsearch_noresults,modcp_ipsearch_results,modcp_ipsearch_misc_info,modcp_nav_announcements,modcp_modqueue_post_link";
$templatelist .= ",modcp_editprofile,modcp_ipsearch,modcp_banuser_addusername,modcp_banuser,modcp_warninglogs_nologs,modcp_banuser_editusername,modcp_lastattachment,modcp_lastpost,modcp_lastthread,modcp_nobanned,modcp_modqueue_thread_link";
$templatelist .= ",modcp_warninglogs,modcp_modlogs_result,modcp_editprofile_signature,forumjump_advanced,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,modcp_announcements_forum_nomod,modcp_announcements_announcement";
$templatelist .= ",multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,modcp_editprofile_away,modcp_awaitingattachments,modcp_modqueue_attachment_link,modcp_latestfivemodactions,modcp_nav_banning";
$templatelist .= ",postbit_groupimage,postbit_userstar,postbit_online,postbit_offline,postbit_away,postbit_avatar,postbit_find,postbit_pm,postbit_email,postbit_www,postbit_author_user,announcement_edit,announcement_quickdelete,postbit,preview,postmodcp_nav_announcements,modcp_nav_reportcenter,modcp_nav_modlogs";
$templatelist .= ",modcp_awaitingmoderation_none,modcp_banning_edit,modcp_banuser_bangroups_group,modcp_banuser_lift,modcp_modlogs_result_announcement,modcp_modlogs_result_forum,modcp_modlogs_result_post,modcp_modlogs_result_thread,modcp_modlogs_user";
$templatelist .= ",modcp_nav_warninglogs,modcp_nav_ipsearch,modcp_nav_users,modcp_announcements_day,modcp_announcements_month_start,modcp_announcements_month_end,modcp_announcements_announcement_expired,modcp_announcements_announcement_active";
$templatelist .= ",modcp_modqueue_link_forum,modcp_modqueue_link_thread,usercp_profile_day,usercp_profile_away,modcp_ipsearch_result_regip,modcp_ipsearch_result_lastip,modcp_ipsearch_result_post,modcp_ipsearch_results_information,usercp_profile_profilefields_text";
$templatelist .= ",usercp_profile_profilefields_select_option,usercp_profile_profilefields_multiselect,usercp_profile_profilefields_select,usercp_profile_profilefields_textarea,usercp_profile_profilefields_radio,usercp_profile_profilefields_checkbox";
require_once "./global.php";
require_once MYBB_ROOT . "inc/functions_user.php";
require_once MYBB_ROOT . "inc/functions_upload.php";
require_once MYBB_ROOT . "inc/functions_modcp.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Set up the array of ban times.
$bantimes = fetch_ban_times();
// Load global language phrases
$lang->load("modcp");
$lang->load("announcements");
if ($mybb->user['uid'] == 0 || $mybb->usergroup['canmodcp'] != 1) {
error_no_permission();
}
if (!$mybb->settings['threadsperpage'] || (int) $mybb->settings['threadsperpage'] < 1) {
$mybb->settings['threadsperpage'] = 20;
}
$tflist = $flist = $tflist_queue_threads = $flist_queue_threads = $tflist_queue_posts = $flist_queue_posts = $tflist_queue_attach = $flist_queue_attach = $wflist_reports = $tflist_reports = $flist_reports = $tflist_modlog = $flist_modlog = $errors = '';
// SQL for fetching items only related to forums this user moderates
$moderated_forums = array();
if ($mybb->usergroup['issupermod'] != 1) {
示例4: postParser
td.spacer {
height: 10px;
}
.char {
float: left;
margin-right: 1px;
}
</style>
<table width="100%" cellpadding="0" cellspacing="0" style="padding-top:10px;">
<tbody><tr>
<td>
<div id="chat_table">
<?php
require_once 'forum/inc/class_parser.php';
$parser = new postParser();
$url = '/logs';
$where = '';
if (!empty($_GET['search'])) {
$search = trim(db_escape_string($_GET['search']));
$result = db_query('SELECT uid FROM mybb_users WHERE username="' . $search . '"');
if (mysqli_num_rows($result) == 0) {
$uid = -1;
} else {
$uid = mysqli_fetch_array($result);
$uid = $uid['uid'];
}
$where = " WHERE uid={$uid} OR username LIKE \"%{$search}%\"OR message LIKE \"%{$search}%\"";
$url .= '?search=' . htmlspecialchars($search);
} else {
$search = '';
示例5: admin_redirect
admin_redirect("index.php?module=tools-warninglog");
}
$user = get_user(intval($warning['uid']));
$page->add_breadcrumb_item($lang->warning_details, "index.php?module=tools-warninglog&action=view&wid={$warning['wid']}");
$page->output_header($lang->warning_details);
$user_link = build_profile_link($user['username'], $user['uid'], "_blank");
if (is_array($warn_errors)) {
$page->output_inline_error($warn_errors);
$mybb->input['reason'] = htmlspecialchars_uni($mybb->input['reason']);
}
$table = new Table();
$post_link = "";
if ($warning['post_subject']) {
if (!is_object($parser)) {
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
}
$warning['post_subject'] = $parser->parse_badwords($warning['post_subject']);
$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
$post_link = get_post_link($warning['pid']);
$table->construct_cell("<strong>{$lang->warned_user}</strong><br /><br />{$user_link}");
$table->construct_cell("<strong>{$lang->post}</strong><br /><br /><a href=\"{$mybb->settings['bburl']}/{$post_link}\" target=\"_blank\">{$warning['post_subject']}</a>");
$table->construct_row();
} else {
$table->construct_cell("<strong>{$lang->warned_user}</strong><br /><br />{$user_link}", array('colspan' => 2));
$table->construct_row();
}
$issuedby = build_profile_link($warning['username'], $warning['issuedby'], "_blank");
$notes = nl2br(htmlspecialchars_uni($warning['notes']));
$date_issued = my_date($mybb->settings['dateformat'], $warning['dateline']) . ", " . my_date($mybb->settings['timeformat'], $warning['dateline']);
if ($warning['type_title']) {
示例6: define
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id$
*/
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'calendar.php');
$templatelist = "calendar_weekdayheader,calendar_weekrow_day,calendar_weekrow,calendar,calendar_addevent,calendar_move";
$templatelist .= ",calendar_weekview_day,calendar_weekview_day_event,calendar_mini_weekdayheader,calendar_mini_weekrow_day,calendar_mini_weekrow,calendar_mini,calendar_weekview_month,calendar_weekview,calendar_eventbit,calendar_addeventlink";
$templatelist .= ",calendar_event_editbutton,calendar_event_modoptions,calendar_event,calendar_dayview_event,calendar_dayview,codebuttons,smilieinsert,smilieinsert_getmore,calendar_editevent,calendar_dayview_birthdays_bday,calendar_dayview_birthdays,calendar_dayview_noevents";
require_once "./global.php";
require_once MYBB_ROOT . "inc/functions_calendar.php";
require_once MYBB_ROOT . "inc/functions_post.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Load global language phrases
$lang->load("calendar");
if ($mybb->settings['enablecalendar'] == 0) {
error($lang->calendar_disabled);
}
if ($mybb->usergroup['canviewcalendar'] == 0) {
error_no_permission();
}
$monthnames = array("offset", $lang->alt_month_1, $lang->alt_month_2, $lang->alt_month_3, $lang->alt_month_4, $lang->alt_month_5, $lang->alt_month_6, $lang->alt_month_7, $lang->alt_month_8, $lang->alt_month_9, $lang->alt_month_10, $lang->alt_month_11, $lang->alt_month_12);
// Make navigation
add_breadcrumb($lang->nav_calendar, "calendar.php");
$calendar_jump = build_calendar_jump($mybb->input['calendar']);
// Add an event
if ($mybb->input['action'] == "do_addevent" && $mybb->request_method == "post") {
$query = $db->simple_select("calendars", "*", "cid='" . intval($mybb->input['calendar']) . "'");
示例7: build_postbit
/**
* Build a post bit
*
* @param array The post data
* @param int The type of post bit we're building (1 = preview, 2 = pm, 3 = announcement, else = post)
* @return string The built post bit
*/
function build_postbit($post, $post_type = 0)
{
global $db, $altbg, $theme, $mybb, $postcounter;
global $titlescache, $page, $templates, $forumpermissions, $attachcache;
global $lang, $ismod, $inlinecookie, $inlinecount, $groupscache, $fid;
global $plugins, $parser, $cache, $ignored_users, $hascustomtitle;
$hascustomtitle = 0;
// Set default values for any fields not provided here
foreach (array('subject_extra', 'attachments', 'button_rep', 'button_warn', 'button_reply_pm', 'button_replyall_pm', 'button_forward_pm', 'button_delete_pm') as $post_field) {
if (empty($post[$post_field])) {
$post[$post_field] = '';
}
}
// Set up the message parser if it doesn't already exist.
if (!$parser) {
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
}
$unapproved_shade = '';
if ($post['visible'] == 0 && $post_type == 0) {
$altbg = $unapproved_shade = 'trow_shaded';
} elseif ($altbg == 'trow1') {
$altbg = 'trow2';
} else {
$altbg = 'trow1';
}
$post['fid'] = $fid;
switch ($post_type) {
case 1:
// Message preview
global $forum;
$parser_options['allow_html'] = $forum['allowhtml'];
$parser_options['allow_mycode'] = $forum['allowmycode'];
$parser_options['allow_smilies'] = $forum['allowsmilies'];
$parser_options['allow_imgcode'] = $forum['allowimgcode'];
$parser_options['allow_videocode'] = $forum['allowvideocode'];
$parser_options['me_username'] = $post['username'];
$parser_options['filter_badwords'] = 1;
$id = 0;
break;
case 2:
// Private message
global $message, $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'] = $post['username'];
$parser_options['filter_badwords'] = 1;
$id = $pmid;
break;
case 3:
// Announcement
global $announcementarray, $message;
$parser_options['allow_html'] = $announcementarray['allowhtml'];
$parser_options['allow_mycode'] = $announcementarray['allowmycode'];
$parser_options['allow_smilies'] = $announcementarray['allowsmilies'];
$parser_options['allow_imgcode'] = 1;
$parser_options['allow_videocode'] = 1;
$parser_options['me_username'] = $post['username'];
$parser_options['filter_badwords'] = 1;
break;
default:
// Regular post
global $forum, $thread, $tid;
$oldforum = $forum;
$id = intval($post['pid']);
$parser_options['allow_html'] = $forum['allowhtml'];
$parser_options['allow_mycode'] = $forum['allowmycode'];
$parser_options['allow_smilies'] = $forum['allowsmilies'];
$parser_options['allow_imgcode'] = $forum['allowimgcode'];
$parser_options['allow_videocode'] = $forum['allowvideocode'];
$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'];
}
break;
}
// 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
//.........这里部分代码省略.........
示例8: define
/**
* MyBB 1.6
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id$
*/
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'sendthread.php');
$templatelist = "sendthread,forumdisplay_password_wrongpass,forumdisplay_password";
require_once "./global.php";
require_once MYBB_ROOT . "inc/functions_post.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Load global language phrases
$lang->load("sendthread");
// Get thread info
$tid = intval($mybb->input['tid']);
$thread = get_thread($tid);
// Get thread prefix
$breadcrumbprefix = '';
if ($thread['prefix']) {
$threadprefix = build_prefixes($thread['prefix']);
if (isset($threadprefix['displaystyle'])) {
$breadcrumbprefix = $threadprefix['displaystyle'] . ' ';
}
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
// Invalid thread
示例9: define
/**
* MyBB 1.8
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/about/license
*
*/
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'reputation.php');
$templatelist = "reputation_addlink,reputation_no_votes,reputation,reputation_vote,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,reputation_vote_delete";
$templatelist .= ",reputation_add_delete,reputation_add_neutral,reputation_add_positive,reputation_add_negative,reputation_add_error,reputation_add_error_nomodal,reputation_add,reputation_added,reputation_deleted,reputation_vote_report,postbit_reputation_formatted_link";
require_once "./global.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Load global language phrases
$lang->load("reputation");
$plugins->run_hooks("reputation_start");
// Check if the reputation system is globally disabled or not.
if ($mybb->settings['enablereputation'] != 1) {
error($lang->reputation_disabled);
}
// Does this user have permission to view the board?
if ($mybb->usergroup['canview'] != 1) {
error_no_permission();
}
// If we have a specified incoming username, validate it and fetch permissions for it
$uid = $mybb->get_input('uid', MyBB::INPUT_INT);
$user = get_user($uid);
if (!$user) {
示例10: error
// Make sure we are looking at a real thread here.
if ($thread['visible'] != 1 && $ismod == false || $thread['visible'] > 1 && $ismod == true) {
error($lang->error_invalidthread);
}
add_breadcrumb($lang->nav_subthreads, "usercp.php?action=subscriptions");
add_breadcrumb($lang->nav_addsubscription);
$forumpermissions = forum_permissions($thread['fid']);
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']) {
error_no_permission();
}
$referrer = '';
if ($server_http_referer) {
$referrer = $server_http_referer;
}
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$lang->subscribe_to_thread = $lang->sprintf($lang->subscribe_to_thread, $thread['subject']);
$notification_none_checked = $notification_email_checked = $notification_pm_checked = '';
if ($mybb->user['subscriptionmethod'] == 1 || $mybb->user['subscriptionmethod'] == 0) {
$notification_none_checked = "checked=\"checked\"";
} else {
if ($mybb->user['subscriptionmethod'] == 2) {
$notification_email_checked = "checked=\"checked\"";
} else {
if ($mybb->user['subscriptionmethod'] == 3) {
$notification_pm_checked = "checked=\"checked\"";
}
}
}
示例11: process_short_content
function process_short_content($post_text, $parser = null, $length = 200)
{
global $parser, $mybb;
require_once MYBB_ROOT . $mybb->settings['tapatalk_directory'] . '/emoji/emoji.class.php';
$post_text = tapatalkEmoji::covertNameToEmpty($post_text);
if ($parser === null) {
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
}
$array_reg = array(array('reg' => '/\\[color=(.*?)\\](.*?)\\[\\/color\\]/sei', 'replace' => "mobi_color_convert('\$1','\$2' ,false)"), array('reg' => '/\\[php\\](.*?)\\[\\/php\\]/si', 'replace' => '[php]'), array('reg' => '/\\[align=(.*?)\\](.*?)\\[\\/align\\]/si', replace => " \$2 "), array('reg' => '/\\[email\\](.*?)\\[\\/email\\]/si', replace => "[url]"), array('reg' => '/\\[quote(.*?)\\](.*?)\\[\\/quote\\]/si', 'replace' => '[quote]'), array('reg' => '/\\[code\\](.*?)\\[\\/code\\]/si', 'replace' => ''), array('reg' => '/\\[url=(.*?)\\](.*?)\\[\\/url\\]/sei', 'replace' => "mobi_url_convert('\$1','\$2')"), array('reg' => '/\\[img(.*?)\\](.*?)\\[\\/img\\]/si', 'replace' => '[img]'), array('reg' => '/\\[video=(.*?)\\](.*?)\\[\\/video\\]/si', 'replace' => '[V]'), array('reg' => '/\\[attachment=(.*?)\\]/si', 'replace' => '[attach]'));
foreach ($array_reg as $arr) {
$post_text = preg_replace($arr['reg'], $arr['replace'], $post_text);
}
//$post_text = tt_covert_list($post_text, '/\[list=1\](.*?)\[\/list\]/si', '2');
//$post_text = tt_covert_list($post_text, '/\[list\](.*?)\[\/list\]/si', '1');
$parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1);
$post_text = strip_tags($parser->parse_message($post_text, $parser_options));
$post_text = preg_replace('/\\s+/', ' ', $post_text);
$post_text = html_entity_decode($post_text);
if (my_strlen($post_text) > $length) {
$post_text = my_substr(trim($post_text), 0, $length);
}
return $post_text;
}
示例12: postParser
$templatelist .= ",usercp_nav_editsignature,usercp_referrals,usercp_notepad,usercp_latest_threads_threads,forumdisplay_thread_gotounread,usercp_latest_threads,usercp_subscriptions_remove,usercp_nav_messenger_folder,usercp_profile_profilefields_text";
$templatelist .= ",usercp_editsig_suspended,usercp_editsig,usercp_avatar_current,usercp_options_timezone_option,usercp_drafts";
$templatelist .= ",usercp_avatar,usercp_editlists_userusercp_editlists,usercp_drafts_draft,usercp_usergroups_joingroup,usercp_attachments_none,usercp_avatar_upload,usercp_options_timezone,usercp_usergroups_joinable_usergroup_join";
$templatelist .= ",usercp_warnings_warning,usercp_warnings,usercp_latest_subscribed_threads,usercp_latest_subscribed,usercp_nav_messenger_tracking,multipage,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,usercp_options_language,usercp_options_date_format";
$templatelist .= ",codebuttons,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,smilieinsert,usercp_nav_messenger_compose,usercp_options_language_option,usercp_editlists";
$templatelist .= ",usercp_profile_profilefields_select_option,usercp_profile_profilefields_multiselect,usercp_profile_profilefields_select,usercp_profile_profilefields_textarea,usercp_profile_profilefields_radio,usercp_profile_profilefields_checkbox";
$templatelist .= ",usercp_options_tppselect_option,usercp_options_pppselect_option,forumbit_depth2_forum_lastpost_never,forumbit_depth2_forum_lastpost_hidden,usercp_avatar_auto_resize_auto,usercp_avatar_auto_resize_user,usercp_options";
$templatelist .= ",usercp_editlists_no_buddies,usercp_editlists_no_ignored,usercp_editlists_no_requests,usercp_editlists_received_requests,usercp_editlists_sent_requests,usercp_drafts_draft_thread,usercp_drafts_draft_forum";
$templatelist .= ",usercp_usergroups_leader_usergroup_memberlist,usercp_usergroups_leader_usergroup_moderaterequests,usercp_usergroups_memberof_usergroup_leaveprimary,usercp_usergroups_memberof_usergroup_display,usercp_email";
$templatelist .= ",usercp_usergroups_memberof_usergroup_leaveleader,usercp_usergroups_memberof_usergroup_leaveother,usercp_usergroups_memberof_usergroup_leave,usercp_usergroups_joinable_usergroup_description,usercp_options_time_format";
$templatelist .= ",usercp_editlists_sent_request,usercp_editlists_received_request,usercp_drafts_none,usercp_usergroups_memberof_usergroup_setdisplay,usercp_usergroups_memberof_usergroup_description,usercp_editlists_user,usercp_profile_day,usercp_profile_contact_fields,usercp_profile_contact_fields_field,usercp_profile_website";
require_once "./global.php";
require_once MYBB_ROOT . "inc/functions_post.php";
require_once MYBB_ROOT . "inc/functions_user.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Load global language phrases
$lang->load("usercp");
if ($mybb->user['uid'] == 0 || $mybb->usergroup['canusercp'] == 0) {
error_no_permission();
}
if (!$mybb->user['pmfolders']) {
$mybb->user['pmfolders'] = "1**" . $lang->folder_inbox . "\$%%\$2**" . $lang->folder_sent_items . "\$%%\$3**" . $lang->folder_drafts . "\$%%\$4**" . $lang->folder_trash;
$db->update_query("users", array('pmfolders' => $mybb->user['pmfolders']), "uid='" . $mybb->user['uid'] . "'");
}
$errors = '';
$mybb->input['action'] = $mybb->get_input('action');
usercp_menu();
$plugins->run_hooks("usercp_start");
if ($mybb->input['action'] == "do_editsig" && $mybb->request_method == "post") {
$parser_options = array('allow_html' => $mybb->settings['sightml'], 'filter_badwords' => 1, 'allow_mycode' => $mybb->settings['sigmycode'], 'allow_smilies' => $mybb->settings['sigsmilies'], 'allow_imgcode' => $mybb->settings['sigimgcode'], "filter_badwords" => 1);
示例13: insert_thread
//.........这里部分代码省略.........
$db->update_query('threads', $modoptions_update, "tid='{$this->tid}'");
}
}
if ($visible == 1) {
// If we have a registered user then update their post count and last post times.
if ($thread['uid'] > 0) {
$user = get_user($thread['uid']);
$update_query = array();
// Only update the lastpost column of the user if the date of the thread is newer than their last post.
if ($thread['dateline'] > $user['lastpost']) {
// Yes this has a single quote within a double quote. It's not a bug.
$update_query['lastpost'] = "'{$thread['dateline']}'";
}
// Update the post count if this forum allows post counts to be tracked
if ($forum['usepostcounts'] != 0) {
$update_query['postnum'] = "postnum+1";
}
if ($forum['usethreadcounts'] != 0) {
$update_query['threadnum'] = 'threadnum+1';
}
// Only update the table if we need to.
if (!empty($update_query)) {
$db->update_query("users", $update_query, "uid='{$thread['uid']}'", 1, true);
}
}
if (!isset($forum['lastpost'])) {
$forum['lastpost'] = 0;
}
$done_users = array();
// Queue up any forum subscription notices to users who are subscribed to this forum.
$excerpt = my_substr($thread['message'], 0, $mybb->settings['subscribeexcerpt']) . $lang->emailbit_viewthread;
// Parse badwords
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$excerpt = $parser->parse_badwords($excerpt);
$query = $db->query("\n\t\t\t\t\tSELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate\n\t\t\t\t\tFROM " . TABLE_PREFIX . "forumsubscriptions fs\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=fs.uid)\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (g.gid=u.usergroup)\n\t\t\t\t\tWHERE fs.fid='" . (int) $thread['fid'] . "'\n\t\t\t\t\tAND fs.uid != '" . (int) $thread['uid'] . "'\n\t\t\t\t\tAND u.lastactive > '{$forum['lastpost']}'\n\t\t\t\t\tAND g.isbannedgroup != 1\n\t\t\t\t");
while ($subscribedmember = $db->fetch_array($query)) {
if ($done_users[$subscribedmember['uid']]) {
continue;
}
$done_users[$subscribedmember['uid']] = 1;
$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
continue;
}
if (!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1) {
// In a 'view own only' forum and not a moderator
continue;
}
// Determine the language pack we'll be using to send this email in and load it if it isn't already.
if ($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) {
$uselang = $subscribedmember['language'];
} else {
if ($mybb->settings['bblanguage']) {
$uselang = $mybb->settings['bblanguage'];
} else {
$uselang = "english";
}
}
if ($uselang == $mybb->settings['bblanguage']) {
$emailsubject = $lang->emailsubject_forumsubscription;
$emailmessage = $lang->email_forumsubscription;
} else {
if (!isset($langcache[$uselang]['emailsubject_forumsubscription'])) {
$userlang = new MyLanguage();
$userlang->set_path(MYBB_ROOT . "inc/languages");
示例14: define
* License: http://mybb.com/about/license
*
* $Id$
*/
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'moderation.php');
$templatelist = 'changeuserbox,loginbox,moderation_delayedmoderation_custommodtool,moderation_delayedmodaction_notes,moderation_delayedmoderation_merge,moderation_delayedmoderation_move';
$templatelist .= ',moderation_delayedmoderation,moderation_deletethread,moderation_deletepoll,moderation_deleteposts_post,moderation_deleteposts,moderation_mergeposts_post,moderation_mergeposts';
$templatelist .= ',moderation_move,moderation_threadnotes_modaction,moderation_threadnotes_delayedmodaction,moderation_threadnotes,moderation_getip_modoptions,moderation_getip,moderation_merge';
$templatelist .= ',moderation_split_post,moderation_split,moderation_inline_deletethreads,moderation_inline_movethreads,moderation_inline_deleteposts,moderation_inline_mergeposts';
$templatelist .= ',moderation_inline_splitposts,forumjump_bit,forumjump_special,forumjump_advanced,forumdisplay_password_wrongpass,forumdisplay_password';
require_once "./global.php";
require_once MYBB_ROOT . "inc/functions_post.php";
require_once MYBB_ROOT . "inc/functions_upload.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
require_once MYBB_ROOT . "inc/class_moderation.php";
$moderation = new Moderation();
// Load global language phrases
$lang->load("moderation");
$plugins->run_hooks("moderation_start");
// Get some navigation if we need it
switch ($mybb->input['action']) {
case "reports":
add_breadcrumb($lang->reported_posts);
break;
case "allreports":
add_breadcrumb($lang->all_reported_posts);
break;
}
$tid = intval($mybb->input['tid']);
示例15: parse_quoted_message
/**
* Performs cleanup of a quoted message, such as replacing /me commands, before presenting quoted post to the user.
*
* @param array quoted post info, taken from the DB (requires the 'message', 'username', 'pid' and 'dateline' entries to be set; will use 'userusername' if present)
* @param boolean whether to call remove_message_quotes() on the quoted message
* @return string the cleaned up message, wrapped in a quote tag
*/
function parse_quoted_message(&$quoted_post, $remove_message_quotes = true)
{
global $parser, $lang, $plugins;
if (!isset($parser)) {
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
}
// Swap username over if we have a registered user
if ($quoted_post['userusername']) {
$quoted_post['username'] = $quoted_post['userusername'];
}
// Clean up the message
$quoted_post['message'] = preg_replace(array('#(^|\\r|\\n)/me ([^\\r\\n<]*)#i', '#(^|\\r|\\n)/slap ([^\\r\\n<]*)#i', '#\\[attachment=([0-9]+?)\\]#i'), array("\\1* {$quoted_post['username']} \\2", "\\1* {$quoted_post['username']} {$lang->slaps} \\2 {$lang->with_trout}", ""), $quoted_post['message']);
$quoted_post['message'] = $parser->parse_badwords($quoted_post['message']);
if ($remove_message_quotes) {
global $mybb;
$max_quote_depth = intval($mybb->settings['maxquotedepth']);
if ($max_quote_depth) {
$quoted_post['message'] = remove_message_quotes($quoted_post['message'], $max_quote_depth - 1);
// we're wrapping the message in a [quote] tag, so take away one quote depth level
}
}
$quoted_post = $plugins->run_hooks("parse_quoted_message", $quoted_post);
return "[quote='{$quoted_post['username']}' pid='{$quoted_post['pid']}' dateline='{$quoted_post['dateline']}']\n{$quoted_post['message']}\n[/quote]\n\n";
}