aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Include/params.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2012-07-28 10:06:52 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2012-07-28 10:06:52 +0000
commita214e6553572eaba8bab16e4234c6b0e345a2de1 (patch)
treec9da68ef4b2bc452f7663ac09b489ca18390bfeb /h-source/Application/Include/params.php
parent4b81cc0ac3174ad9cc84fc859a10ab59a70ea540 (diff)
improved the way the software sends e-mails and improved i18n
Diffstat (limited to 'h-source/Application/Include/params.php')
-rw-r--r--h-source/Application/Include/params.php38
1 files changed, 26 insertions, 12 deletions
diff --git a/h-source/Application/Include/params.php b/h-source/Application/Include/params.php
index b972739..fa2aef2 100644
--- a/h-source/Application/Include/params.php
+++ b/h-source/Application/Include/params.php
@@ -35,6 +35,8 @@ class Website
static public $allowAnonymousSubmission = "yes";
static public $statusnetGroupText = "";
+
+ static public $useSMTP = true;
}
class Account
@@ -42,6 +44,18 @@ class Account
static public $confirmTime = 3600;
+ public static function getTransport()
+ {
+ if (Website::$useSMTP)
+ {
+ return Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword);
+ }
+ else
+ {
+ return Swift_MailTransport::newInstance();
+ }
+ }
+
static public function confirm($username,$e_mail,$id_user,$token)
{
require_once (ROOT.'/External/swiftmailer/lib/swift_required.php');
@@ -53,13 +67,13 @@ class Account
$siteName = Website::$generalName;
$siteMail = Website::$generalMail;
- $mess = "Hello,\n\nyou have registered an account at $siteName with the following data:\nusername: ".$clean['username']."\n\nin order to confirm the registration of the new account follow the link below\nhttp://".DOMAIN_NAME."/users/confirm/".Lang::$current."/".$clean['id_user']."/".$clean['token']."\n\nIf you don't want to confirm the account registration\nthen wait one hour and your username and e-mail will be deleted from the database\n\nIf you received this e-mail for error, please simply disregard this message";
+ $mess = gtext("Hello,\n\nyou have registered an account at")." $siteName ".gtext("with the following data:\nusername: ").$clean['username']."\n\n".gtext("in order to confirm the registration of the new account please follow the link below")."\nhttp://".DOMAIN_NAME."/users/confirm/".Lang::$current."/".$clean['id_user']."/".$clean['token']."\n\n".gtext("If you don't want to confirm the account registration\nthen wait one hour and your username and e-mail will be deleted from the database")."\n\n".gtext("If you received this e-mail for error, please simply disregard this message");
- $message = Swift_Message::newInstance()->setSubject('account registration to '.$siteName)->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess);
+ $message = Swift_Message::newInstance()->setSubject('['.Website::$projectName.'] '.gtext("account registration"))->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess);
//Create the Transport
- $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword);
-
+ $transport = self::getTransport();
+
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
@@ -90,10 +104,10 @@ class Account
$mess = "Hello,\n\nyou have requested a new password for your account at $siteName.\nYour username is:\n".$clean['username']."\n\nin order to obtain a new password for your account follow the link below\nhttp://".DOMAIN_NAME."/users/change/".Lang::$current."/".$clean['id_user']."/".$clean['token']."\n\nIf you don't want to change the password then disregard this mail\n";
- $message = Swift_Message::newInstance()->setSubject('request a new password at '.$siteName)->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess);
+ $message = Swift_Message::newInstance()->setSubject('['.Website::$projectName.'] request a new password')->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess);
//Create the Transport
- $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword);
+ $transport = self::getTransport();
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
@@ -124,10 +138,10 @@ class Account
$mess = "Hello,\n\nyou have requested a new password for your account to $siteName.\nYour username is:\n".$clean['username']."\n\nYour new password is:\n".$clean['password']."\n";
- $message = Swift_Message::newInstance()->setSubject('get your new h-node.com account password ')->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess);
+ $message = Swift_Message::newInstance()->setSubject('['.Website::$projectName.'] get your new password ')->setFrom(array($siteMail => $siteName))->setTo(array($e_mail))->setBody($mess);
//Create the Transport
- $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword);
+ $transport = self::getTransport();
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
@@ -160,10 +174,10 @@ class Account
$mess = "$who has added a message to the talk page of a device you have contributed to maintain at $siteName\n\nThe whole conversation is here:\n\n".$urls['urlTalk']."\n\nThe device page is here:\n\n".$urls['urlView']."\n\nBest regards\nthe ".Website::$projectName." team\n\nP.S: you can disable the mail notifications in the profile page of your control panel";
- $message = Swift_Message::newInstance()->setSubject("$who sent a notice to your attention")->setFrom(array($siteMail => $siteName))->setTo($e_mails)->setBody($mess);
+ $message = Swift_Message::newInstance()->setSubject("[".Website::$projectName."] $who sent a notice to your attention")->setFrom(array($siteMail => $siteName))->setTo($e_mails)->setBody($mess);
//Create the Transport
- $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword);
+ $transport = self::getTransport();
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
@@ -189,10 +203,10 @@ class Account
$mess = "$who has added a message to the talk page of a wiki page you have contributed to maintain at $siteName\n\nThe whole conversation is here:\n\n".$talkUrl."\n\nThe wiki page is here:\n\n".$pageUrl."\n\nBest regards\nthe ".Website::$projectName." team\n\nP.S: you can disable the mail notifications in the profile page of your control panel";
- $message = Swift_Message::newInstance()->setSubject("$who sent a notice to your attention")->setFrom(array($siteMail => $siteName))->setTo($e_mails)->setBody($mess);
+ $message = Swift_Message::newInstance()->setSubject("[".Website::$projectName."] $who sent a notice to your attention")->setFrom(array($siteMail => $siteName))->setTo($e_mails)->setBody($mess);
//Create the Transport
- $transport = Swift_SmtpTransport::newInstance(Website::$mailServer, 25)->setUsername(Website::$generalMail)->setPassword(Website::$mailPassword);
+ $transport = self::getTransport();
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);