PHP Mail,将所有消息组合到一个区域中

时间:2015-08-25 19:20:16

标签: php

我无法将所有消息合并到一个框中。目前,每个发送和接收的所有单独的消息。 html代码是message_send.html,php代码是message_send.php。我正在使用名为etano的PHP脚本 - http://www.datemill.com/

HTML
    !--opt name="output.flirt_reply"-->
    <p><a class="content-link link_flirt" href="{tplvars.relative_url}flirt_send.php?to_id={output.fk_user_id}&amp;ft=1&amp;return={output.return}"><i class="fa fa-heart"></i>Reply with a flirt instead</a></p>
<!--/opt name="output.flirt_reply"-->

<form action="{tplvars.relative_url}processors/message_send.php" method="post" id="msend_form">
<fieldset>
    <input type="hidden" name="fk_user_id" value="{output.fk_user_id}" />
    <input type="hidden" name="return" value="{output.return}" />
    <input type="hidden" name="refnum" value="{output.refnum}" />
    <label for="subject" id="subject">Subject: </label><input class="text" type="text" name="subject" id="subject" value="{output.subject}" tabindex="1" />
</fieldset>
<fieldset>
    <textarea name="message_body" id="message_body" cols="" rows="" tabindex="2" class="sco_bbcode">{output.message_body}</textarea>
</fieldset>
<fieldset class="controls">
    <p>
    <a class="content-link plain thickbox" href="{tplvars.relative_url}popup_use_tpl.php?mail_id={output.mail_id}&amp;return={output.return}&amp;keepThis=true&amp;TB_iframe=true&amp;height=500&amp;width=750" id="popup_use_tpl">Use a saved message</a>
    <input class="button large" id="btn_savetpl" type="submit" value="Save as Template" tabindex="4" />
    </p>

    <input class="button medium reply" type="submit" value="Send" tabindex="3" />
</fieldset>
</form>

<script type="text/javascript" src="{tplvars.relative_url}js/thickbox.js?v={tplvars.js_lib_v}"></script>
<script type="text/javascript" src="{tplvars.relative_url}js/message_send.js?v={tplvars.js_lib_v}"></script>
<!--opt name="output.bbcode_message"-->
<script type="text/javascript" src="{tplvars.relative_url}js/bbcode.js?v={tplvars.js_lib_v}"></script>
<!--/opt name="output.bbcode_message"-->
<script type="text/javascript">
    var lang=new Array('{output.lang_263}','{output.lang_264}','{output.lang_196}','{output.lang_197}');
</script>

PHP

  <?php
/******************************************************************************
Etano
===============================================================================
File:                       message_send.php
$Revision: 679 $
Software by:                DateMill (http://www.datemill.com)
Copyright by:               DateMill (http://www.datemill.com)
Support at:                 http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license.                         *
******************************************************************************/

require 'includes/common.inc.php';
require _BASEPATH_.'/includes/user_functions.inc.php';
require _BASEPATH_.'/includes/tables/user_inbox.inc.php';
require _BASEPATH_.'/skins_site/'.get_my_skin().'/lang/mailbox.inc.php';

$tpl=new phemplate(_BASEPATH_.'/skins_site/'.get_my_skin().'/','remove_nonjs');

$output=$user_inbox_default['defaults'];
if (isset($_SESSION['topass']['input'])) {
    $output=$_SESSION['topass']['input'];
    $output['_user_other']=get_user_by_userid($output['fk_user_id']);
    unset($_SESSION['topass']['input']);
    $temp='message_write';
    if (isset($_SESSION[_LICENSE_KEY_]['user'][$output['refnum']])) {
        $temp=$_SESSION[_LICENSE_KEY_]['user'][$output['refnum']];
    }
    check_login_member($temp);
} elseif (!empty($_GET['to_id'])) {
    $output['fk_user_id']=(int)$_GET['to_id'];
    $output['_user_other']=get_user_by_userid($output['fk_user_id']);
    check_login_member('message_write');
} elseif (!empty($_GET['mail_id'])) {
    $output['refnum']=mt_rand(10000,99999);
    $_SESSION[_LICENSE_KEY_]['user'][$output['refnum']]='message_reply';
    check_login_member('message_reply');
    $mail_id=(int)$_GET['mail_id'];
    $query="SELECT `mail_id`,`fk_user_id_other` as `fk_user_id`,`subject`,`message_body`,`_user_other`,`message_type` FROM `{$dbtable_prefix}user_inbox` WHERE `mail_id`=$mail_id AND `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."'";
    if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
    if (mysql_num_rows($res)) {
        $output=array_merge($output,mysql_fetch_assoc($res));
        $output['subject']=(substr($output['subject'],0,3)=='Re:') ? $output['subject'] : 'Re: '.$output['subject'];
        if ($output['message_type']==MESS_MESS) {
            $output['message_body']="\n\n[quote]".$output['message_body'].'[/quote]';
        } else {
            $output['message_body']='';
        }
    }
    if (isset($_GET['gettpl'])) {
        $tpl_id=(int)$_GET['gettpl'];
        $query="SELECT `subject`,`message_body` FROM `{$dbtable_prefix}user_mtpls` WHERE `mtpl_id`=$tpl_id AND `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."'";
        if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
        if (mysql_num_rows($res)) {
            $output=array_merge($output,mysql_fetch_assoc($res));
        }
    }
// no need to sanitize
//  $output=sanitize_and_format($output,TYPE_STRING,$__field2format[TEXT_DB2EDIT]);
    if ($output['message_type']==MESS_FLIRT) {
        $output['flirt_reply']=true;
    }
} else {
    trigger_error($GLOBALS['_lang'][120],E_USER_ERROR);
}
$output['lang_263']=sanitize_and_format($GLOBALS['_lang'][263],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]);
$output['lang_264']=sanitize_and_format($GLOBALS['_lang'][264],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]);
$output['lang_196']=sanitize_and_format($GLOBALS['_lang'][196],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]);
$output['lang_197']=sanitize_and_format($GLOBALS['_lang'][197],TYPE_STRING,$__field2format[TEXT_DB2DISPLAY]);

if (!isset($output['return']) && isset($_GET['return'])) {
    $output['return']=sanitize_and_format_gpc($_GET,'return',TYPE_STRING,$__field2format[FIELD_TEXTFIELD] | FORMAT_RUENCODE,'');
}

$output['bbcode_message']=get_site_option('bbcode_message','core');
if (empty($output['bbcode_message'])) {
    unset($output['bbcode_message']);
}
$tpl->set_file('content','message_send.html');
$tpl->set_var('output',$output);
$tpl->process('content','content',TPL_OPTIONAL);

$tplvars['page_title']=sprintf($GLOBALS['_lang'][137],$output['_user_other']);
$tplvars['title']=$tplvars['page_title'];
$tplvars['page']='message_send';
$tplvars['css']='message_send.css';
if (is_file('message_send_left.php')) {
    include 'message_send_left.php';
}
include 'frame.php';

0 个答案:

没有答案