MyBB Community Forums

Full Version: error when sending PMs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
my users just reported this error to me. when you try to send a PM the page loads this text. why would it spit out raw php?
message = ''; $this->headers = $headers; if($from) { $this->from = $from; } $this->set_to($to); $this->set_subject($subject); if($charset) { $this->set_charset($charset); } $this->parse_format = $format; $this->set_common_headers(); $this->set_message($message, $message_text); } /** * Sets the charset. * * @param string charset */ function set_charset($charset) { global $lang; if(empty($charset)) { $this->charset = $lang->settings['charset']; } else { $this->charset = $charset; } } /** * Sets and formats the email message. * * @param string message */ function set_message($message, $message_text="") {	 if($this->parse_format == "html" || $this->parse_format == "both") { $this->set_html_headers($message, $message_text); } else { $this->message = $message; $this->set_plain_headers(); } } /** * Sets and formats the email subject. * * @param string subject */ function set_subject($subject) { $this->subject = $this->utf8_encode($this->cleanup($subject)); } /** * Sets and formats the recipient address. * * @param string to */ function set_to($to) { $to = $this->cleanup($to); $this->to = $this->cleanup($to); } /** * Sets the plain headers, text/plain */ function set_plain_headers() { $this->headers .= "Content-Type: text/plain; charset={$this->charset}{$this->delimiter}"; } /** * Sets the alternative headers, text/html and text/plain. * * @param string message */ function set_html_headers($message, $message_text="") { if(!$message_text && $this->parse_format == 'both') { $message_text = strip_tags($message); } if($this->parse_format == 'both') { $mime_boundary = "=_NextPart".md5(TIME_NOW); $this->headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"{$this->delimiter}"; $this->message = "This is a multi-part message in MIME format.{$this->delimiter}{$this->delimiter}"; $this->message .= "--{$mime_boundary}{$this->delimiter}"; $this->message .= "Content-Type: text/plain; charset=\"{$this->charset}\"{$this->delimiter}"; $this->message .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message .= $message_text."{$this->delimiter}{$this->delimiter}"; $this->message .= "--{$mime_boundary}{$this->delimiter}"; $this->message .= "Content-Type: text/html; charset=\"{$this->charset}\"{$this->delimiter}"; $this->message .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message .= $message."{$this->delimiter}{$this->delimiter}"; $this->message .= "--{$mime_boundary}--{$this->delimiter}{$this->delimiter}"; } else { $this->headers .= "Content-Type: text/html; charset=\"{$this->charset}\"{$this->delimiter}"; $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}"; $this->message = $message."{$this->delimiter}{$this->delimiter}"; } } /** * Sets the common headers. */ function set_common_headers() { global $mybb; // Build mail headers if(!trim($this->from)) { if($mybb->settings['mail_handler'] == 'smtp') { $this->from = $mybb->settings['adminemail']; } else { $this->from = '"'.$this->utf8_encode($mybb->settings['bbname']).'"'; $this->from .= " <{$mybb->settings['adminemail']}>"; } } $this->headers .= "From: {$this->from}{$this->delimiter}"; if(isset($_SERVER['SERVER_NAME'])) { $http_host = $_SERVER['SERVER_NAME']; } else if(isset($_SERVER['HTTP_HOST'])) { $http_host = $_SERVER['HTTP_HOST']; } else { $http_host = "unknown.local"; } $msg_id = md5(uniqid(TIME_NOW)) . "@" . $http_host; $this->headers .= "Message-ID: <{$msg_id}>{$this->delimiter}"; $this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}"; $this->headers .= "X-Priority: 3{$this->delimiter}"; $this->headers .= "X-MSMail-Priority: Normal{$this->delimiter}"; $this->headers .= "X-Mailer: MyBB{$this->delimiter}"; if(defined("IN_ADMINCP")) { $_SERVER['PHP_SELF'] = str_replace($mybb->config['admin_dir']."/", "admin-", $_SERVER['PHP_SELF']); } $this->headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}{$this->delimiter}"; $this->headers .= "MIME-Version: 1.0{$this->delimiter}"; } /** * Log a fatal error message to the database. * * @param string The error message * @param string Any additional information */ function fatal_error($error) { global $db; $mail_error = array( "subject" => $db->escape_string($this->subject), "message" => $db->escape_string($this->message), "toaddress" => $db->escape_string($this->to), "fromaddress" => $db->escape_string($this->from), "dateline" => TIME_NOW, "error" => $db->escape_string($error), "smtperror" => $db->escape_string($this->data), "smtpcode" => intval($this->code) ); $db->insert_query("mailerrors", $mail_error); // Another neat feature would be the ability to notify the site administrator via email - but wait, with email down, how do we do that? How about private message and hope the admin checks their PMs? } /** * Rids pesky characters from subjects, recipients, from addresses etc (prevents mail injection too) * * @param string The string being checked * @return string The cleaned string */ function cleanup($string) { $string = str_replace(array("\r", "\n", "\r\n"), "", $string); $string = trim($string); return $string; } /** * Encode a string based on the character set enabled. Used to encode subjects * and recipients in email messages going out so that they show up correctly * in email clients. * * @param string The string to be encoded. * @return string The encoded string. */ function utf8_encode($string) { $encoded_string = $string; if(strtolower($this->charset) == 'utf-8' && preg_match('/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff]/', $string)) { // Define start delimimter, end delimiter and spacer $end = "?="; $start = "=?" . $this->charset . "?B?"; $spacer = $end . ' ' . $start; // Determine length of encoded text within chunks and ensure length is even (should NOT use the my_strlen functions) $length = 75 - strlen($start) - strlen($end); $length = floor($length/4) * 4; // Encode the string and split it into chunks with spacers after each chunk $encoded_string = base64_encode($encoded_string); $encoded_string = chunk_split($encoded_string, $length, $spacer); // Remove trailing spacer and add start and end delimiters $spacer = preg_quote($spacer); $encoded_string = preg_replace("/" . $spacer . "$/", "", $encoded_string); $encoded_string = $start . $encoded_string . $end; } return $encoded_string; } } ?>㱢爠⼾਼戾䙡瑡氠敲牯爼⽢㸺†䍬慳猠❍慩汈慮摬敲✠湯琠景畮搠楮‼戾⽨潭支⹣桡湩⽢慲牡穡⽴潲瑯楳敦潲畭⹯牧⽩湣⽭慩汨慮摬敲猯灨瀮灨瀼⽢㸠潮楮攠㱢㸲ㄼ⽢㸼扲 㸊

running 1.4.3
and as far as i can tell this happens for all users
Try reuploading ./private.php
Also try reuploading inc/datahandlers/pm.php
i reuploaded both of those...no dice Sad
thanks for the suggestions though guys
i reuploaded all the files and it works fine now.
thanks for everyones help
also upload inc/class_mailhandler.php and the inc/mailhandlers folder.