aboutsummaryrefslogtreecommitdiff
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
parent4b81cc0ac3174ad9cc84fc859a10ab59a70ea540 (diff)
improved the way the software sends e-mails and improved i18n
-rw-r--r--h-source/Application/Include/languages.php8
-rw-r--r--h-source/Application/Include/params.php38
-rw-r--r--h-source/README.txt13
3 files changed, 40 insertions, 19 deletions
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index 8652b55..965a814 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -397,7 +397,13 @@ class Lang
/*0337*/"Example" => "Esempio",
/*0338*/"free boot firmware?" => "firmware per boot libero?",
/*0339*/"can be installed" => "può essere installato",
- /*0340*/"does it have free boot firmware (BIOS,UEFI,...) ?" => "ha un firmware per il boot (BIOS, UEFI,..) libero?"
+ /*0340*/"does it have free boot firmware (BIOS,UEFI,...) ?" => "ha un firmware per il boot (BIOS, UEFI,..) libero?",
+ /*0341*/"Hello,\n\nyou have registered an account at"=>"Ciao,\n\nhai richiesto l'attivazione di un account al sito",
+ /*0342*/"with the following data:\nusername: " => "con i seguenti dati:\nusername: ",
+ /*0343*/"in order to confirm the registration of the new account please follow the link below" => "per confermare la registrazione per favore segui il link sottostante",
+ /*0343*/"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" => "Se non vuoi confermare la registrazione dell'account\naspetta un ora e il tuo username e la tua e-mail verranno cancellati dal nostro database",
+ /*0344*/"If you received this e-mail for error, please simply disregard this message" => "Se hai ricevuto questa e-mail per errore, per favore cancellala",
+ /*0345*/"account registration" => "registrazione account",
),
'es' => array
(
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);
diff --git a/h-source/README.txt b/h-source/README.txt
index e76b542..6aa1419 100644
--- a/h-source/README.txt
+++ b/h-source/README.txt
@@ -61,19 +61,20 @@ where DOMAIN_NAME is the domain name you have previously set (perhaps localhost)
If you want that the system can send e-mails you have to specify the name of the SMTP server that has to be used. Open the file Application/Include/params.php and set the following constants:
- $mailServer = ""; //set the mail server
+ $mailServer = ""; //set the mail server (only useful if $useSMTP = true)
- $generalMail = ""; //set the username of your mail account
+ $generalMail = ""; //set the username of your mail account (always needed)
- $mailPassword = ""; //set the password of your mail account
+ $mailPassword = ""; //set the password of your mail account (only useful if $useSMTP = true)
+ $useSMTP = true; //if you want to use a SMTP account. It can be true or false. Set $useSMTP to false if you want that the software rely on the mail() PHP function
+
You can also set these constants:
$generalName = ""; //the string that you want to use inside the <title> tag of your website
- $projectName = ""; //the name of your project
-
-
+ $projectName = ""; //the name of your project
+
== Change the homepage ==