本文整理汇总了PHP中build_postbit函数的典型用法代码示例。如果您正苦于以下问题:PHP build_postbit函数的具体用法?PHP build_postbit怎么用?PHP build_postbit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_postbit函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
while ($attachment = $db->fetch_array($query)) {
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}
}
} else {
// If there are no pid's the thread is probably awaiting approval.
error($lang->error_invalidthread);
}
// Get the actual posts from the database here.
$posts = '';
$query = $db->query("\r\n\t\t\tSELECT u.*, u.username AS userusername, p.*, f.*, eu.username AS editusername\r\n\t\t\tFROM " . TABLE_PREFIX . "posts p\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users eu ON (eu.uid=p.edituid)\r\n\t\t\tWHERE {$pids}\r\n\t\t\tORDER BY p.dateline\r\n\t\t");
while ($post = $db->fetch_array($query)) {
if ($thread['firstpost'] == $post['pid'] && $thread['visible'] == 0) {
$post['visible'] = 0;
}
$posts .= build_postbit($post);
$post = '';
}
$plugins->run_hooks("showthread_linear");
}
// Show the similar threads table if wanted.
$similarthreads = '';
if ($mybb->settings['showsimilarthreads'] != 0) {
switch ($db->type) {
case "pgsql":
$query = $db->query("\r\n\t\t\t\t\tSELECT t.*, t.username AS threadusername, u.username\r\n\t\t\t\t\tFROM " . TABLE_PREFIX . "threads t\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid = t.uid), plainto_tsquery ('" . $db->escape_string($thread['subject']) . "') AS query\r\n\t\t\t\t\tWHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.subject @@ query\r\n\t\t\t\t\tORDER BY t.lastpost DESC\r\n\t\t\t\t\tOFFSET 0 LIMIT {$mybb->settings['similarlimit']}\r\n\t\t\t\t");
break;
default:
$query = $db->query("\r\n\t\t\t\t\tSELECT t.*, t.username AS threadusername, u.username, MATCH (t.subject) AGAINST ('" . $db->escape_string($thread['subject']) . "') AS relevance\r\n\t\t\t\t\tFROM " . TABLE_PREFIX . "threads t\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid = t.uid)\r\n\t\t\t\t\tWHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('" . $db->escape_string($thread['subject']) . "') >= '{$mybb->settings['similarityrating']}'\r\n\t\t\t\t\tORDER BY t.lastpost DESC\r\n\t\t\t\t\tLIMIT 0, {$mybb->settings['similarlimit']}\r\n\t\t\t\t");
}
$count = 0;
示例2: eval
eval("\$bcc = \"" . $templates->get("private_read_bcc") . "\";");
} else {
$bcc_form_val = '';
}
$replyall = false;
if (count($to_recipients) > 1) {
$replyall = true;
}
if (count($to_recipients) > 0) {
$to_recipients = implode($lang->comma, $to_recipients);
} else {
$to_recipients = $lang->nobody;
}
eval("\$pm['subject_extra'] = \"" . $templates->get("private_read_to") . "\";");
add_breadcrumb($pm['subject']);
$message = build_postbit($pm, 2);
// Decide whether or not to show quick reply.
$quickreply = '';
if ($mybb->settings['pmquickreply'] != 0 && $mybb->user['showquickreply'] != 0 && $mybb->usergroup['cansendpms'] != 0 && $pm['fromid'] != 0 && $pm['folder'] != 3) {
$trow = alt_trow();
$optionschecked = array('savecopy' => 'checked="checked"');
if (!empty($mybb->user['signature'])) {
$optionschecked['signature'] = 'checked="checked"';
}
if ($mybb->usergroup['cantrackpms'] == 1) {
$optionschecked['readreceipt'] = 'checked="checked"';
}
require_once MYBB_ROOT . 'inc/functions_posting.php';
$quoted_message = array('message' => htmlspecialchars_uni($parser->parse_badwords($pm['message'])), 'username' => $pm['username'], 'quote_is_pm' => true);
$quoted_message = parse_quoted_message($quoted_message);
if ($mybb->settings['maxpmquotedepth'] != '0') {
示例3: build_mycode_inserter
$codebuttons = build_mycode_inserter();
$smilieinserter = build_clickable_smilies();
if (isset($preview)) {
$announcementarray = array('aid' => $announcement['aid'], 'fid' => $announcement['fid'], 'uid' => $mybb->user['uid'], 'subject' => $mybb->input['title'], 'message' => $mybb->input['message'], 'allowhtml' => $mybb->get_input('allowhtml', MyBB::INPUT_INT), 'allowmycode' => $mybb->get_input('allowmycode', MyBB::INPUT_INT), 'allowsmilies' => $mybb->get_input('allowsmilies', MyBB::INPUT_INT), 'dateline' => TIME_NOW, 'userusername' => $mybb->user['username']);
$array = $mybb->user;
foreach ($array as $key => $element) {
$announcementarray[$key] = $element;
}
// Gather usergroup data from the cache
// Field => Array Key
$data_key = array('title' => 'grouptitle', 'usertitle' => 'groupusertitle', 'stars' => 'groupstars', 'starimage' => 'groupstarimage', 'image' => 'groupimage', 'namestyle' => 'namestyle', 'usereputationsystem' => 'usereputationsystem');
foreach ($data_key as $field => $key) {
$announcementarray[$key] = $groupscache[$announcementarray['usergroup']][$field];
}
require_once MYBB_ROOT . "inc/functions_post.php";
$postbit = build_postbit($announcementarray, 3);
eval("\$preview = \"" . $templates->get("previewpost") . "\";");
} else {
$preview = '';
}
$plugins->run_hooks("modcp_edit_announcement");
eval("\$announcements = \"" . $templates->get("modcp_announcements_edit") . "\";");
output_page($announcements);
}
if ($mybb->input['action'] == "announcements") {
if ($mybb->usergroup['canmanageannounce'] == 0) {
error_no_permission();
}
if ($numannouncements == 0 && $mybb->usergroup['issupermod'] != 1) {
error($lang->you_cannot_manage_announcements);
}
示例4: while
$post['includesig'] = $mybb->input['postoptions']['signature'];
}
if (!isset($post['includesig']) || $post['includesig'] != 1) {
$post['includesig'] = 0;
}
// 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 {
示例5: get_announcement_func
function get_announcement_func($xmlrpc_params)
{
global $db, $lang, $mybb, $position, $plugins, $pids, $groupscache;
$input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::STRING, 'start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
$parser = new Tapatalk_Parser();
// Load global language phrases
$lang->load("announcements");
$aid = intval($_GET['aid']);
// Get announcement fid
$query = $db->simple_select("announcements", "fid", "aid='{$aid}'");
$announcement = $db->fetch_array($query);
$plugins->run_hooks("announcements_start");
if (!$announcement) {
error($lang->error_invalidannouncement);
}
// Get forum info
$fid = $announcement['fid'];
if ($fid > 0) {
$forum = get_forum($fid);
if (!$forum) {
error($lang->error_invalidforum);
}
// Make navigation
build_forum_breadcrumb($forum['fid']);
// Permissions
$forumpermissions = forum_permissions($forum['fid']);
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
error_no_permission();
}
// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);
}
add_breadcrumb($lang->nav_announcements);
$archive_url = build_archive_link("announcement", $aid);
// Get announcement info
$time = TIME_NOW;
$query = $db->query("\n\t\tSELECT u.*, u.username AS userusername, a.*, f.*\n\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\n\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND a.aid='{$aid}'\n\t");
$announcementarray = $db->fetch_array($query);
if (!$announcementarray) {
error($lang->error_invalidannouncement);
}
// Gather usergroup data from the cache
// Field => Array Key
$data_key = array('title' => 'grouptitle', 'usertitle' => 'groupusertitle', 'stars' => 'groupstars', 'starimage' => 'groupstarimage', 'image' => 'groupimage', 'namestyle' => 'namestyle', 'usereputationsystem' => 'usereputationsystem');
foreach ($data_key as $field => $key) {
$announcementarray[$key] = $groupscache[$announcementarray['usergroup']][$field];
}
$announcementarray['dateline'] = $announcementarray['startdate'];
$announcementarray['userusername'] = $announcementarray['username'];
$announcement = build_postbit($announcementarray, 3);
$announcementarray['subject'] = $parser->parse_badwords($announcementarray['subject']);
$lang->forum_announcement = $lang->sprintf($lang->forum_announcement, htmlspecialchars_uni($announcementarray['subject']));
if ($announcementarray['startdate'] > $mybb->user['lastvisit']) {
$setcookie = true;
if (isset($mybb->cookies['mybb']['announcements']) && is_scalar($mybb->cookies['mybb']['announcements'])) {
$cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
if (isset($cookie[$announcementarray['aid']])) {
$setcookie = false;
}
}
if ($setcookie) {
my_set_array_cookie('announcements', $announcementarray['aid'], $announcementarray['startdate'], -1);
}
}
$user_info = get_user($announcementarray['aid']);
$icon_url = absolute_url($user_info['avatar']);
// prepare xmlrpc return
$xmlrpc_post = new xmlrpcval(array('topic_id' => new xmlrpcval('ann_' . $announcementarray['aid']), 'post_title' => new xmlrpcval(basic_clean($announcementarray['subject']), 'base64'), 'post_content' => new xmlrpcval(process_post($announcementarray['message'], $input['return_html']), 'base64'), 'post_author_id' => new xmlrpcval($announcementarray['uid']), 'post_author_name' => new xmlrpcval(basic_clean($announcementarray['username']), 'base64'), 'user_type' => new xmlrpcval(check_return_user_type($announcementarray['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($icon_url)), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($announcementarray['dateline']), 'dateTime.iso8601'), 'timestamp' => new xmlrpcval($announcementarray['dateline'], 'string')), 'struct');
$result = array('total_post_num' => new xmlrpcval(1, 'int'), 'can_reply' => new xmlrpcval(false, 'boolean'), 'can_subscribe' => new xmlrpcval(false, 'boolean'), 'posts' => new xmlrpcval(array($xmlrpc_post), 'array'));
return new xmlrpcresp(new xmlrpcval($result, 'struct'));
}
示例6: ON
} else {
// Figure out the poster's other information.
$query = $db->query("\n\t\t\t\tSELECT u.*, f.*, p.dateline\n\t\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (p.uid=u.uid)\n\t\t\t\tWHERE u.uid='{$post['uid']}' AND p.pid='{$pid}'\n\t\t\t\tLIMIT 1\n\t\t\t");
$postinfo = $db->fetch_array($query);
$postinfo['userusername'] = $postinfo['username'];
}
$query = $db->simple_select("attachments", "*", "pid='{$pid}'");
while ($attachment = $db->fetch_array($query)) {
$attachcache[0][$attachment['aid']] = $attachment;
}
// Set the values of the post info array.
$postinfo['message'] = $previewmessage;
$postinfo['subject'] = $previewsubject;
$postinfo['icon'] = $icon;
$postinfo['smilieoff'] = $postoptions['disablesmilies'];
$postbit = build_postbit($postinfo, 1);
eval("\$preview = \"" . $templates->get("previewpost") . "\";");
} else {
if (!$post_errors) {
$message = htmlspecialchars_uni($message);
$subject = htmlspecialchars_uni($subject);
if ($post['includesig'] != 0) {
$postoptionschecked['signature'] = " checked=\"checked\"";
}
if ($post['smilieoff'] == 1) {
$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
}
$query = $db->simple_select("threadsubscriptions", "notification", "tid='{$tid}' AND uid='{$mybb->user['uid']}'");
if ($db->num_rows($query) > 0) {
$notification = $db->fetch_field($query, 'notification');
if ($notification == 0) {
示例7: _whiletyping_build_postbit
/**
* Helper function to build the postbit
*/
function _whiletyping_build_postbit($post, $type = 0, $quick_reply = false)
{
global $lang, $postcounter, $mybb, $ismod;
$user = get_user($post['uid']);
$post['userusername'] = $post['username'];
$post = array_merge($post, $user);
if (!function_exists('build_postbit')) {
include MYBB_ROOT . "inc/functions_post.php";
}
$postbit = build_postbit($post, $type);
return $postbit;
}