mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 04:40:44 +02:00
Fixes #1532 PM notification template.
This commit is contained in:
@@ -577,7 +577,10 @@ class e107Email extends PHPMailer
|
||||
$message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' >\n".$message;
|
||||
}
|
||||
if ($this->legacyBody && !preg_match('/<(font|br|a|img|b)/i', $message)) // Assume html if it includes one of these tags
|
||||
|
||||
;
|
||||
// !preg_match('/<(table|div|font|br|a|img|b)/i', $message)
|
||||
if ($this->legacyBody && e107::getParser()->isHtml($message) != true) // Assume html if it includes one of these tags
|
||||
{ // Otherwise assume its a plain text message which needs some conversion to render in HTML
|
||||
|
||||
if($this->debug == true)
|
||||
|
@@ -134,6 +134,10 @@ class private_msg_ui extends e_admin_ui
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private function limitsPageAdd()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
@@ -768,13 +772,49 @@ class private_msg_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
|
||||
function sendTestNotify()
|
||||
{
|
||||
e107::includeLan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
|
||||
require_once(e_PLUGIN."pm/pm_class.php");
|
||||
|
||||
$pmInfo = array ( 'numsent' => '1', 'pm_to' => USERID, 'pm_sent'=>time(), 'pm_userclass' => false, 'pm_subject' => 'Test Subject Random:'.md5(time()), 'pm_message' => 'Test Message '.md5(time()), 'postpm' => 'Send Private Message', 'keyword' => NULL,
|
||||
'to_info' => array (
|
||||
'user_id' => USERID,
|
||||
'user_name' => USERNAME,
|
||||
'user_class' => USERCLASS,
|
||||
'user_email' => USEREMAIL,
|
||||
),
|
||||
'uploaded' => array ( ), 'from_id' => 1, 'options' => '', );
|
||||
|
||||
$pm = new private_message;
|
||||
|
||||
if($pm->pm_send_notify(null,$pmInfo, 1) === true)
|
||||
{
|
||||
e107::getMessage()->addSuccess("Test Email Sent");
|
||||
}
|
||||
else
|
||||
{
|
||||
e107::getMessage()->addError("Test Email Failed");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
// $this->listQry = "SELECT p.*,u.user_name FROM #private_msg AS p LEFT JOIN #user AS u ON p.pm_from = u.user_id ";
|
||||
|
||||
if(deftrue('e_DEVELOPER') || deftrue('e_DEBUG'))
|
||||
{
|
||||
$this->prefs['notify_class']['writeParms']['post']= e107::getForm()->button('testNotify', 1, 'primary', "Test");
|
||||
|
||||
if(!empty($_POST['testNotify']))
|
||||
{
|
||||
$this->sendTestNotify();
|
||||
}
|
||||
}
|
||||
|
||||
if($this->getMode() == 'inbox')
|
||||
{
|
||||
$this->listQry = 'SELECT p.*, u.user_name, f.user_name AS fromuser FROM #private_msg AS p LEFT JOIN #user AS u ON u.user_id = p.pm_to
|
||||
|
@@ -32,7 +32,7 @@ class private_message
|
||||
* @param array $prefs - pref settings for PM plugin
|
||||
* @return none
|
||||
*/
|
||||
public function __construct($prefs)
|
||||
public function __construct($prefs=null)
|
||||
{
|
||||
$this->e107 = e107::getInstance();
|
||||
$this->pmPrefs = $prefs; }
|
||||
@@ -117,6 +117,8 @@ class private_message
|
||||
$pm_options = '';
|
||||
$ret = '';
|
||||
$addOutbox = TRUE;
|
||||
$timestamp = time();
|
||||
|
||||
$maxSendNow = varset($this->pmPrefs['pm_max_send'],100); // Maximum number of PMs to send without queueing them
|
||||
if (isset($vars['pm_from']))
|
||||
{ // Doing bulk send off cron task
|
||||
@@ -161,7 +163,7 @@ class private_message
|
||||
// Most of the pm info is fixed - just need to set the 'to' user on each send
|
||||
$info = array(
|
||||
'pm_from' => $vars['from_id'],
|
||||
'pm_sent' => time(), /* Date sent */
|
||||
'pm_sent' => $timestamp, /* Date sent */
|
||||
'pm_read' => 0, /* Date read */
|
||||
'pm_subject' => $pm_subject,
|
||||
'pm_text' => $pm_message,
|
||||
@@ -235,6 +237,7 @@ class private_message
|
||||
if(check_class($this->pmPrefs['notify_class'], null, $u['user_id']))
|
||||
{
|
||||
$vars['to_info'] = $u;
|
||||
$vars['pm_sent'] = $timestamp;
|
||||
$this->pm_send_notify($u['user_id'], $vars, $pmid, count($a_list));
|
||||
}
|
||||
}
|
||||
@@ -262,6 +265,7 @@ class private_message
|
||||
if($pmid = $sql->insert('private_msg', $info))
|
||||
{
|
||||
$info['pm_id'] = $pmid;
|
||||
$info['pm_sent'] = $timestamp;
|
||||
e107::getEvent()->trigger('user_pm_sent', $info);
|
||||
|
||||
|
||||
@@ -366,7 +370,7 @@ class private_message
|
||||
*/
|
||||
function pm_send_notify($uid, $pmInfo, $pmid, $attach_count = 0)
|
||||
{
|
||||
require_once(e_HANDLER.'mail.php');
|
||||
// require_once(e_HANDLER.'mail.php');
|
||||
|
||||
$tpl_file = THEME.'pm_template.php';
|
||||
|
||||
@@ -388,13 +392,14 @@ class private_message
|
||||
<tr><td>".LAN_PM_108."</td><td>{PM_DATE}</td></tr>
|
||||
<tr><td>".LAN_PM_104."</td><td>{PM_ATTACHMENTS}</td></tr>
|
||||
|
||||
</table>
|
||||
</table><br />
|
||||
<div>".LAN_PM_105.": {PM_URL}</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
}
|
||||
|
||||
$url = e107::url('pm','index', null, array('mode'=>'full')).'?show.'.$pmid;
|
||||
|
||||
$data = array();
|
||||
$data['PM_SUBJECT'] = $pmInfo['pm_subject'];
|
||||
@@ -402,13 +407,26 @@ class private_message
|
||||
$data['PM_DATE'] = e107::getParser()->toDate($pmInfo['pm_sent'], 'long');
|
||||
$data['SITENAME'] = SITENAME;
|
||||
$data['USERNAME'] = USERNAME;
|
||||
$data['PM_URL'] = e107::url('pm','index', null, array('mode'=>'full')).'?show.'.$pmid;;
|
||||
$data['PM_URL'] = "<a href='".$url."'>".$url."</a>";// e107::url('pm','index', null, array('mode'=>'full')).'?show.'.$pmid;
|
||||
|
||||
$text = e107::getParser()->simpleParse($template, $data);
|
||||
|
||||
$subject = LAN_PM_100.SITENAME;
|
||||
$eml = array();
|
||||
$eml['email_subject'] = LAN_PM_100.USERNAME;
|
||||
$eml['send_html'] = true;
|
||||
$eml['email_body'] = $text;
|
||||
$eml['template'] = 'default';
|
||||
$eml['e107_header'] = $pmInfo['to_info']['user_id'];
|
||||
|
||||
if(e107::getEmail()->sendEmail($pmInfo['to_info']['user_email'], $pmInfo['to_info']['user_name'], $eml))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
sendemail($pmInfo['to_info']['user_email'], $subject, $text, $pmInfo['to_info']['user_name']);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -176,7 +176,10 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
|
||||
else
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
$ret = $frm->userlist('pm_to',null,array('excludeSelf'=>true, 'default'=>'blank', 'classes'=>varset($this->pmPrefs['send_to_class'], e_UC_MEMBER)));
|
||||
|
||||
$exclude = (getperms('0') && e_DEBUG === true) ? false : true;
|
||||
|
||||
$ret = $frm->userlist('pm_to',null,array('excludeSelf'=>$exclude, 'default'=>'blank', 'classes'=>varset($this->pmPrefs['send_to_class'], e_UC_MEMBER)));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -277,7 +277,7 @@ $PM_NOTIFY =
|
||||
<tr><td>".LAN_PM_108."</td><td>{PM_DATE}</td></tr>
|
||||
<tr><td>".LAN_PM_104."</td><td>{PM_ATTACHMENTS}</td></tr>
|
||||
|
||||
</table>
|
||||
</table><br />
|
||||
<div>".LAN_PM_105.": {PM_URL}</div>
|
||||
</div>
|
||||
";
|
||||
|
Reference in New Issue
Block a user