2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
+ ----------------------------------------------------------------------------+
|
|
|
|
| e107 website system
|
|
|
|
|
|
2009-11-18 01:06:08 +00:00
|
|
|
| Copyright (C) 2008-2009 e107 Inc (e107.org)
|
2006-12-02 04:36:16 +00:00
|
|
|
| http://e107.org
|
2009-07-14 05:31:57 +00:00
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
| Released under the terms and conditions of the
|
|
|
|
| GNU General Public License (http://gnu.org).
|
|
|
|
|
|
|
|
|
| $Source: /cvs_backup/e107_0.8/email.php,v $
|
2010-02-10 18:18:01 +00:00
|
|
|
| $Revision$
|
|
|
|
| $Date$
|
|
|
|
| $Author$
|
2006-12-02 04:36:16 +00:00
|
|
|
+----------------------------------------------------------------------------+
|
|
|
|
*/
|
2009-11-03 22:08:03 +00:00
|
|
|
require_once('class2.php');
|
2009-09-28 21:00:18 +00:00
|
|
|
if (!check_class(varset($pref['email_item_class'],e_UC_MEMBER)))
|
|
|
|
{
|
|
|
|
header('Location: '.e_BASE.'index.php');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-01-23 09:41:23 -08:00
|
|
|
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
2009-08-28 15:30:25 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once(HEADERF);
|
|
|
|
|
|
|
|
$use_imagecode = FALSE;
|
2009-11-03 22:08:03 +00:00
|
|
|
$imgtypes = array('jpeg', 'png', 'gif');
|
2006-12-02 04:36:16 +00:00
|
|
|
foreach($imgtypes as $t)
|
|
|
|
{
|
2009-11-03 22:08:03 +00:00
|
|
|
if(function_exists('imagecreatefrom'.$t))
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
$use_imagecode = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($use_imagecode)
|
|
|
|
{
|
2009-11-03 22:08:03 +00:00
|
|
|
require_once(e_HANDLER.'secure_img_handler.php');
|
2006-12-02 04:36:16 +00:00
|
|
|
$sec_img = new secure_image;
|
|
|
|
}
|
|
|
|
|
2009-11-03 22:08:03 +00:00
|
|
|
if (e_QUERY)
|
|
|
|
{
|
|
|
|
$qs = explode('.', e_QUERY, 2);
|
|
|
|
}
|
|
|
|
else
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$source = $qs[0];
|
2009-11-03 22:08:03 +00:00
|
|
|
$parms = varset($qs[1], '');
|
|
|
|
unset($qs);
|
|
|
|
$error = '';
|
|
|
|
$message = '';
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2009-11-03 22:08:03 +00:00
|
|
|
$referrer = strip_tags(urldecode(html_entity_decode(varset($_SERVER['HTTP_REFERER'],''), ENT_QUOTES)));
|
|
|
|
$emailurl = ($source == 'referer') ? $referrer : SITEURL;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2018-01-25 13:38:29 -08:00
|
|
|
$comments = '';
|
|
|
|
$author = '';
|
|
|
|
$email_send = '';
|
|
|
|
|
|
|
|
if(!empty($_POST['comment']))
|
|
|
|
{
|
|
|
|
$comments = $tp->post_toHTML($_POST['comment'], true, 'retain_nl, emotes_off, no_make_clickable');
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!empty($_POST['author_name']))
|
|
|
|
{
|
|
|
|
$author = $tp->post_toHTML($_POST['author_name'], false,'emotes_off, no_make_clickable');
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!empty($_POST['email_send']))
|
|
|
|
{
|
|
|
|
$email_send = check_email($_POST['email_send']);
|
|
|
|
}
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['emailsubmit']))
|
|
|
|
{
|
|
|
|
if (!$email_send)
|
|
|
|
{
|
|
|
|
$error .= LAN_EMAIL_106;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($use_imagecode)
|
|
|
|
{
|
|
|
|
if(!isset($_POST['code_verify']) || !isset($_POST['rand_num']))
|
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
|
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-03 22:08:03 +00:00
|
|
|
if ($comments == '')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2010-09-21 18:06:56 +00:00
|
|
|
$message = LAN_EMAIL_6.' '.SITENAME.' ('.SITEURL.')';
|
2006-12-02 04:36:16 +00:00
|
|
|
if (USER == TRUE)
|
|
|
|
{
|
|
|
|
$message .= "\n\n".LAN_EMAIL_1." ".USERNAME;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message .= "\n\n".LAN_EMAIL_1." ".$author;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-21 18:06:56 +00:00
|
|
|
// $message .= $comments."\n"; // Added to message later on
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2012-01-02 22:06:22 +00:00
|
|
|
$ip = e107::getIPHandler()->getIP(FALSE);
|
2006-12-02 04:36:16 +00:00
|
|
|
$message .= "\n\n".LAN_EMAIL_2." ".$ip."\n\n";
|
|
|
|
|
2009-11-03 22:08:03 +00:00
|
|
|
if (substr($source,0,7) == 'plugin:')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
$plugin = substr($source,7);
|
2009-11-03 22:08:03 +00:00
|
|
|
$text = '';
|
|
|
|
if(file_exists(e_PLUGIN.$plugin.'/e_emailprint.php'))
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2009-11-03 22:08:03 +00:00
|
|
|
include_once(e_PLUGIN.$plugin.'/e_emailprint.php');
|
2006-12-02 04:36:16 +00:00
|
|
|
$text = email_item($parms);
|
|
|
|
$emailurl = SITEURL;
|
|
|
|
}
|
2009-11-03 22:08:03 +00:00
|
|
|
if($text == '')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$message .= $text;
|
|
|
|
}
|
2009-11-03 22:08:03 +00:00
|
|
|
elseif($source == 'referer')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
if(!isset($_POST['referer']) || $_POST['referer'] == '')
|
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
2009-11-03 22:08:03 +00:00
|
|
|
$message .= strip_tags($_POST['referer']);
|
|
|
|
$emailurl = strip_tags($_POST['referer']);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-03 22:08:03 +00:00
|
|
|
$emailurl = strip_tags($_POST['referer']);
|
2009-01-22 01:58:29 +00:00
|
|
|
$message = '';
|
2009-04-16 10:19:50 +00:00
|
|
|
if($sql->db_Select('news', 'news_title, news_body, news_extended', 'news_id='.((int)$parms)))
|
2009-01-22 01:58:29 +00:00
|
|
|
{
|
|
|
|
$row = $sql->db_Fetch();
|
|
|
|
$message = "<h3 class='email_heading'>".$row['news_title']."</h3><br />".$row['news_body']."<br />".$row['news_extended']."<br /><br /><a href='{e_BASE}news.php?extend.".$parms."'>{e_BASE}news.php?extend.".$parms."</a><br />";
|
|
|
|
$message = $tp->toEmail($message);
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2009-11-03 22:08:03 +00:00
|
|
|
if($message == '')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2016-01-13 19:17:37 -08:00
|
|
|
e107::redirect();
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-03 22:08:03 +00:00
|
|
|
if ($error == '')
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2009-01-22 01:58:29 +00:00
|
|
|
// Load Mail Handler and Email Template.
|
2009-11-03 22:08:03 +00:00
|
|
|
require_once(e_HANDLER.'mail.php');
|
2011-05-05 06:05:26 +00:00
|
|
|
|
|
|
|
$email_body = (trim($comments) != '') ? $tp->toEmail($comments).'<hr />' : '';
|
|
|
|
$email_body .= $tp->toEmail($message);
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
if (sendemail($email_send, LAN_EMAIL_3.SITENAME,$email_body))
|
|
|
|
{
|
|
|
|
$text = "<div style='text-align:center'>".LAN_EMAIL_10." ".$email_send."</div>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$text = "<div style='text-align:center'>".LAN_EMAIL_9."</div>";
|
|
|
|
}
|
|
|
|
$ns->tablerender(LAN_EMAIL_11, $text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-25 21:27:30 +02:00
|
|
|
$ns->tablerender(LAN_ERROR, "<div style='text-align:center'>".$error."</div>");
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// --------------------- Form -------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$text = "<form method='post' action='".e_SELF."?".e_QUERY."'>\n
|
2009-11-03 22:08:03 +00:00
|
|
|
<table>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
if (USER != TRUE)
|
|
|
|
{
|
|
|
|
$text .= "<tr>
|
2009-01-22 01:58:29 +00:00
|
|
|
<td style='width:25%'>".LAN_EMAIL_15."</td>
|
|
|
|
<td style='width:75%'>
|
|
|
|
<input class='tbox' type='text' name='author_name' size='60' style='width:95%' value='$author' maxlength='100' />
|
|
|
|
</td>
|
|
|
|
</tr>";
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$text .= "
|
|
|
|
<tr>
|
2009-01-22 01:58:29 +00:00
|
|
|
<td style='width:25%'>".LAN_EMAIL_8."</td>
|
|
|
|
<td style='width:75%'>
|
|
|
|
<textarea class='tbox' name='comment' cols='70' rows='4' style='width:95%'>".LAN_EMAIL_6." ".SITENAME." (".$emailurl.")
|
2006-12-02 04:36:16 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
if (USER == TRUE)
|
|
|
|
{
|
|
|
|
$text .= "\n\n".LAN_EMAIL_1." ".USERNAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
$text .= "</textarea>
|
2009-01-22 01:58:29 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2009-01-22 01:58:29 +00:00
|
|
|
<tr>
|
|
|
|
<td style='width:25%'>".LAN_EMAIL_187."</td>
|
|
|
|
<td style='width:75%'>
|
|
|
|
<input class='tbox' type='text' name='email_send' size='60' value='$email_send' style='width:95%' maxlength='100' />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2009-01-22 01:58:29 +00:00
|
|
|
if($use_imagecode)
|
|
|
|
{
|
|
|
|
$text .= "<tr><td>".LAN_EMAIL_190."</td><td>";
|
|
|
|
$text .= $sec_img->r_image();
|
|
|
|
$text .= " <input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />
|
|
|
|
<input type='hidden' name='rand_num' value='".$sec_img->random_number."' /></td></tr>";
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
$text .= "
|
2009-01-22 01:58:29 +00:00
|
|
|
<tr style='vertical-align:top'>
|
|
|
|
<td style='width:25%'></td>
|
|
|
|
<td style='width:75%'>
|
2018-01-10 15:06:40 -08:00
|
|
|
<input class='btn btn-default btn-secondary button' type='submit' name='emailsubmit' value='".LAN_EMAIL_4."' />
|
2009-11-03 22:08:03 +00:00
|
|
|
<input type='hidden' name='referer' value='".$referrer."' />
|
2006-12-02 04:36:16 +00:00
|
|
|
</td>
|
2009-01-22 01:58:29 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
$ns->tablerender(LAN_EMAIL_5, $text);
|
|
|
|
|
|
|
|
require_once(FOOTERF);
|
|
|
|
?>
|