A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.8 KiB

<?php
/**
* @package uForum
* @file includes/class_email.php
* @version $Id: emailer.php -1 $
* @copyright 2009(c) PioDer <[email protected]>
* @link http://pioder.gim2przemysl.int.pl/
* @license GNU GPL v3
**/
if ( !defined('IN_uF') )
{
die('Hacking attempt');
}
function SendEmail($email, $title, $content)
{
global $forum_config;
#headers
$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 &micro;Forum <b>('.$email_date.')</b></font>
</body>
</html>';
#send email - do it!
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);
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);
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))
{
SendEmail($item['email'], $title, $content);
}
}
?>