|
<?php
|
|
/**
|
|
* @package Dynamic Script Forum
|
|
* @file includes/class_email.php
|
|
* @version 1.0.x, 02-07-2007, 16:56
|
|
* @copyright 2008(c) PioDer <[email protected]>
|
|
* @link http://pioder.gim2przemysl.int.pl/dsf.html
|
|
* @license GNU GPL v3
|
|
**/
|
|
if ( !defined('IN_uF') )
|
|
{
|
|
die('Hacking attempt');
|
|
}
|
|
class Email
|
|
{
|
|
function SendEmail($email, $title, $content)
|
|
{
|
|
global $forum_config;
|
|
$email_headers = "MIME-Version: 1.0\r\n";
|
|
$email_headers .= "Content-type: text/html; charset=iso-8859-2\r\n";
|
|
$email_headers .= "From: ".$forum_config['forumname']." \n";
|
|
$email_date = date('d-m-Y, G:i',time());
|
|
$email_content = '
|
|
<html>
|
|
<head>
|
|
<title>'.$title.'</title>
|
|
</head>
|
|
<body>
|
|
'.$content.'<br>
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
|
|
<font face="Verdana" style="font-size:10pt">
|
|
Message generated automatic by DSF v'.VERSION.'. <b>('.$email_date.')</b></font>
|
|
</body>
|
|
</html>';
|
|
if ( !mail($email, $title, $email_content, $email_headers ))
|
|
{
|
|
message_die('GENERAL','Could not send email from: '.$email.'. sorry :(','');
|
|
}
|
|
}
|
|
function SendRegisterEmail()
|
|
{
|
|
global $forum_config;
|
|
global $original_pass;
|
|
global $lng;
|
|
$email_content = $lng['email_newpasswd_msg'];
|
|
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
|
$email_content = str_replace('%url_f%',$forum_config['forumpatch'],$email_content);
|
|
$email_content = str_replace('%ip%',$_SERVER['REMOTE_ADDR'],$email_content);
|
|
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
|
$email_content = str_replace('%login%',$_POST['nick'],$email_content);
|
|
$email_content = str_replace('%pass%',$original_pass,$email_content);
|
|
Email::SendEmail($_POST['email'],$lng['email_welcome'].$forum_config['forumname'],$email_content);
|
|
|
|
}
|
|
function SendForgotPassEmail($newpass)
|
|
{
|
|
global $forum_config;
|
|
global $original_pass;
|
|
global $lng;
|
|
global $uid;
|
|
$email_content = $lng['email_register_msg'];
|
|
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
|
$email_content = str_replace('%url_f%',$forum_config['forumpatch'],$email_content);
|
|
$email_content = str_replace('%ip%',$_SERVER['REMOTE_ADDR'],$email_content);
|
|
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
|
$email_content = str_replace('%login%',$_POST['username'],$email_content);
|
|
$email_content = str_replace('%pass%',$newpass,$email_content);
|
|
Email::SendEmail(User::UserInformation($uid,'email'),$lng['email_sent_forget_pass'].$forum_config['forumname'],$email_content);
|
|
}
|
|
function SendMassEmail($title,$content)
|
|
{
|
|
$sql = "SELECT `email`,`u_id` FROM ".USERS_TABLE." WHERE `u_id`>0";
|
|
$query = DataBase::sql_query($sql,'CRITICAL','Could not read users table');
|
|
while($item = @mysql_fetch_array($query))
|
|
{
|
|
Email::SendEmail($item['email'], $title, $content);
|
|
}
|
|
}
|
|
}
|
|
?>
|