* @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 = '
'.$title.'
'.$content.'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message generated automatic by DSF v'.VERSION.'. ('.$email_date.')
';
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);
}
}
}
?>