Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions_post.php 5753 2012-03-09 14:53:07Z Tomm $
| * $Id$
|
*/
/**
| */
/**
|
Zeile 24 | Zeile 24 |
---|
global $plugins, $parser, $cache, $ignored_users, $hascustomtitle; $hascustomtitle = 0;
|
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)
|
// 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)
|
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 = $unapproved_shade = 'trow_shaded'; } elseif($altbg == 'trow1')
|
{
| {
|
$altbg = 'trow2'; } else
|
$altbg = 'trow2'; } else
|
{
| {
|
$altbg = 'trow1'; } $post['fid'] = $fid;
| $altbg = 'trow1'; } $post['fid'] = $fid;
|
Zeile 50 | Zeile 59 |
---|
{ case 1: // Message preview global $forum;
|
{ 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['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;
| $parser_options['filter_badwords'] = 1; $id = 0; break;
|
Zeile 115 | Zeile 124 |
---|
continue; } $post[$post_field] = htmlspecialchars_uni($field_value);
|
continue; } $post[$post_field] = htmlspecialchars_uni($field_value);
|
}
| }
|
if(!$postcounter) { // Used to show the # of the post
| if(!$postcounter) { // Used to show the # of the post
|
Zeile 123 | Zeile 132 |
---|
{ if(!$mybb->settings['postsperpage']) {
|
{ if(!$mybb->settings['postsperpage']) {
|
$mybb->settings['postperpage'] = 20;
| $mybb->settings['postsperpage'] = 20;
|
} $postcounter = $mybb->settings['postsperpage']*($page-1);
| } $postcounter = $mybb->settings['postsperpage']*($page-1);
|
Zeile 135 | Zeile 144 |
---|
$post_extra_style = "border-top-width: 0;"; } elseif($mybb->input['mode'] == "threaded")
|
$post_extra_style = "border-top-width: 0;"; } elseif($mybb->input['mode'] == "threaded")
|
{
| {
|
$post_extra_style = "border-top-width: 0;"; } else
| $post_extra_style = "border-top-width: 0;"; } else
|
Zeile 146 | Zeile 155 |
---|
if(!$altbg) { // Define the alternate background colour if this is the first post $altbg = "trow1";
|
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
| $postcounter++;
// Format the post date and time using my_date
|
Zeile 158 | Zeile 167 |
---|
// Pm's have been htmlspecialchars_uni()'ed already. if($post_type != 2)
|
// Pm's have been htmlspecialchars_uni()'ed already. if($post_type != 2)
|
{
| {
|
$post['subject'] = htmlspecialchars_uni($post['subject']); }
| $post['subject'] = htmlspecialchars_uni($post['subject']); }
|
Zeile 166 | Zeile 175 |
---|
{ $post['subject'] = ' '; }
|
{ $post['subject'] = ' '; }
|
|
|
$post['author'] = $post['uid'];
// Get the usergroup
| $post['author'] = $post['uid'];
// Get the usergroup
|
Zeile 177 | Zeile 186 |
---|
$post['displaygroup'] = $post['usergroup']; } $usergroup = $groupscache[$post['displaygroup']];
|
$post['displaygroup'] = $post['usergroup']; } $usergroup = $groupscache[$post['displaygroup']];
|
}
| }
|
else { $usergroup = $groupscache[1];
|
else { $usergroup = $groupscache[1];
|
}
| }
|
if(!is_array($titlescache)) {
| if(!is_array($titlescache)) {
|
Zeile 192 | Zeile 201 |
---|
{ $titlescache[$usertitle['posts']] = $usertitle; }
|
{ $titlescache[$usertitle['posts']] = $usertitle; }
|
}
| }
|
if(is_array($titlescache)) {
| if(is_array($titlescache)) {
|
Zeile 202 | Zeile 211 |
---|
}
// Work out the usergroup/title stuff
|
}
// Work out the usergroup/title stuff
|
| $post['groupimage'] = '';
|
if(!empty($usergroup['image'])) {
|
if(!empty($usergroup['image'])) {
|
| $language = $mybb->settings['bblanguage'];
|
if(!empty($mybb->user['language'])) { $language = $mybb->user['language']; }
|
if(!empty($mybb->user['language'])) { $language = $mybb->user['language']; }
|
else { $language = $mybb->settings['bblanguage']; }
|
|
$usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']); $usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']); eval("\$post['groupimage'] = \"".$templates->get("postbit_groupimage")."\";");
|
$usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']); $usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']); eval("\$post['groupimage'] = \"".$templates->get("postbit_groupimage")."\";");
|
|
|
if($mybb->settings['postlayout'] == "classic")
|
if($mybb->settings['postlayout'] == "classic")
|
{
| {
|
$post['groupimage'] .= "<br />"; } }
if($post['userusername'])
|
$post['groupimage'] .= "<br />"; } }
if($post['userusername'])
|
{ // This post was made by a registered user
| { // This post was made by a registered user
|
$post['username'] = $post['userusername']; $post['profilelink_plain'] = get_profile_link($post['uid']); $post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']); $post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid']);
|
$post['username'] = $post['userusername']; $post['profilelink_plain'] = get_profile_link($post['uid']); $post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']); $post['profilelink'] = build_profile_link($post['username_formatted'], $post['uid']);
|
|
|
if(trim($post['usertitle']) != "") { $hascustomtitle = 1; } if($usergroup['usertitle'] != "" && !$hascustomtitle)
|
if(trim($post['usertitle']) != "") { $hascustomtitle = 1; } if($usergroup['usertitle'] != "" && !$hascustomtitle)
|
{
| {
|
$post['usertitle'] = $usergroup['usertitle']; } elseif(is_array($titlescache) && !$usergroup['usertitle'])
|
$post['usertitle'] = $usergroup['usertitle']; } elseif(is_array($titlescache) && !$usergroup['usertitle'])
|
{
| {
|
reset($titlescache); foreach($titlescache as $key => $titleinfo) {
| reset($titlescache); foreach($titlescache as $key => $titleinfo) {
|
Zeile 254 | Zeile 263 |
---|
break; } }
|
break; } }
|
}
| }
|
if($usergroup['stars']) { $post['stars'] = $usergroup['stars']; }
|
if($usergroup['stars']) { $post['stars'] = $usergroup['stars']; }
|
if(!$post['starimage'])
| if(empty($post['starimage']))
|
{ $post['starimage'] = $usergroup['starimage']; }
| { $post['starimage'] = $usergroup['starimage']; }
|
Zeile 270 | Zeile 279 |
---|
{ // Only display stars if we have an image to use... $post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']);
|
{ // Only display stars if we have an image to use... $post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']);
|
| $post['userstars'] = '';
|
for($i = 0; $i < $post['stars']; ++$i) { $post['userstars'] .= "<img src=\"".$post['starimage']."\" border=\"0\" alt=\"*\" />";
| for($i = 0; $i < $post['stars']; ++$i) { $post['userstars'] .= "<img src=\"".$post['starimage']."\" border=\"0\" alt=\"*\" />";
|
Zeile 325 | Zeile 335 |
---|
} else {
|
} else {
|
$post['useravatar'] = "";
| $post['useravatar'] = ''; $post['avatar_padding'] = '';
|
} eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";");
| } eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";");
|
Zeile 335 | Zeile 346 |
---|
eval("\$post['button_pm'] = \"".$templates->get("postbit_pm")."\";"); }
|
eval("\$post['button_pm'] = \"".$templates->get("postbit_pm")."\";"); }
|
if($mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']))
| if($mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid'])
|
{ if(!$post['pid']) {
| { if(!$post['pid']) {
|
Zeile 367 | Zeile 378 |
---|
$post['userregdate'] = my_date($mybb->settings['regdateformat'], $post['regdate']);
// Work out the reputation this user has (only show if not announcement)
|
$post['userregdate'] = my_date($mybb->settings['regdateformat'], $post['regdate']);
// Work out the reputation this user has (only show if not announcement)
|
if($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']))
| if($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1)
|
{ $post['userreputation'] = get_reputation($post['reputation'], $post['uid']); eval("\$post['replink'] = \"".$templates->get("postbit_reputation")."\";");
| { $post['userreputation'] = get_reputation($post['reputation'], $post['uid']); eval("\$post['replink'] = \"".$templates->get("postbit_reputation")."\";");
|
Zeile 400 | Zeile 411 |
---|
} else { // Message was posted by a guest or an unknown user
|
} else { // Message was posted by a guest or an unknown user
|
$post['username'] = $post['username'];
| |
$post['profilelink'] = format_name($post['username'], 1); if($usergroup['usertitle'])
| $post['profilelink'] = format_name($post['username'], 1); if($usergroup['usertitle'])
|
Zeile 451 | Zeile 461 |
---|
if(!$post_type) { // Figure out if we need to show an "edited by" message
|
if(!$post_type) { // Figure out if we need to show an "edited by" message
|
| $post['editedmsg'] = '';
|
if($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1)) { $post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']);
| if($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1)) { $post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']);
|
Zeile 487 | Zeile 498 |
---|
// Inline moderation stuff if($ismod) {
|
// Inline moderation stuff if($ismod) {
|
if(my_strpos($mybb->cookies[$inlinecookie], "|".$post['pid']."|"))
| if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|".$post['pid']."|"))
|
{ $inlinecheck = "checked=\"checked\""; $inlinecount++;
| { $inlinecheck = "checked=\"checked\""; $inlinecount++;
|
Zeile 562 | Zeile 573 |
---|
} // If we have incoming search terms to highlight - get it done.
|
} // If we have incoming search terms to highlight - get it done.
|
if($mybb->input['highlight'])
| if(!empty($mybb->input['highlight']))
|
{ $parser_options['highlight'] = $mybb->input['highlight']; $post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']);
| { $parser_options['highlight'] = $mybb->input['highlight']; $post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']);
|
Zeile 627 | Zeile 638 |
---|
$post = $plugins->run_hooks("postbit", $post);
// Is this author on the ignore list of the current user? Hide this post
|
$post = $plugins->run_hooks("postbit", $post);
// Is this author on the ignore list of the current user? Hide this post
|
if(is_array($ignored_users) && $post['uid'] != 0 && $ignored_users[$post['uid']] == 1)
| $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")."\";");
| { $ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']); eval("\$ignore_bit = \"".$templates->get("postbit_ignored")."\";");
|
Zeile 662 | Zeile 674 |
---|
$validationcount = 0; $tcount = 0;
|
$validationcount = 0; $tcount = 0;
|
if(is_array($attachcache[$id]))
| if(isset($attachcache[$id]) && is_array($attachcache[$id]))
|
{ // This post has 1 or more attachments foreach($attachcache[$id] as $aid => $attachment) {
| { // This post has 1 or more attachments foreach($attachcache[$id] as $aid => $attachment) {
|