diff --git a/lib/EmailTemplates.php b/lib/EmailTemplates.php index 338fe4458..bc5e19fd1 100755 --- a/lib/EmailTemplates.php +++ b/lib/EmailTemplates.php @@ -251,6 +251,7 @@ public function replaceVariables($text) $email = $_SESSION['CATS']->getEmail(); $siteName = $_SESSION['CATS']->getSiteName(); $fullName = $_SESSION['CATS']->getFullName(); + $emailSignature = $this->getEmailSignature(); if ($_SESSION['CATS']->isDateDMY()) { @@ -275,7 +276,8 @@ public function replaceVariables($text) '%DATETIME%', '%SITENAME%', '%USERFULLNAME%', - '%USERMAIL%' + '%USERMAIL%', + '%USEREMAILSIGNATURE%' ); if ($isLoggedIn) @@ -284,7 +286,8 @@ public function replaceVariables($text) DateUtility::getAdjustedDate($dateFormat . ' g:i A'), $siteName, $fullName, - ''. $email .'' + ''. $email .'', + $emailSignature ); } else @@ -391,7 +394,40 @@ public function getAll() return $this->_db->getAllAssoc($sql); } - + + public function getEmailSignature(){ + $sql = sprintf( + "SELECT + settings.value AS value + FROM + settings + WHERE + settings.site_id = %s + AND + settings.settings_type = %s + AND + settings.setting = %s", + $this->_siteID, + SETTINGS_MAILER, + $this->_db->makeQueryString("emailSignature_".$_SESSION['CATS']->getUserID()) + ); + $rs = $this->_db->getAllAssoc($sql); + if(empty($rs) || !$rs){ + return ""; + } + return $rs[0]['value']; + } + + public function saveEmailSignature($signature){ + if(strlen($signature) > 254){ + return -1; + } else { + $mailerSettings = new MailerSettings($this->_siteID); + $mailerSettings->set("emailSignature_" . $_SESSION['CATS']->getUserID(), $signature); + return 0; + } + } + public function getAllCustom() { $sql = sprintf( diff --git a/lib/Mailer.php b/lib/Mailer.php index 2921294eb..6ce61b442 100755 --- a/lib/Mailer.php +++ b/lib/Mailer.php @@ -478,7 +478,7 @@ public function set($setting, $value) AND site_id = %s AND - settings_type", + settings_type = %s", $this->_db->makeQueryStringOrNULL($setting), $this->_siteID, SETTINGS_MAILER diff --git a/modules/settings/EmailSignature.tpl b/modules/settings/EmailSignature.tpl new file mode 100644 index 000000000..1e630e078 --- /dev/null +++ b/modules/settings/EmailSignature.tpl @@ -0,0 +1,82 @@ + + + +active, $this->subActive); ?> +
+ + +
+ + + + + +
+ Settings  +

Settings: E-Mail Signature

+ +

My E-Mail Signature

+ +
+ + + isDemoUser): ?> + Note that as a demo user, you do not have privileges to modify any settings. +

+ + + + + + + + + + + + + + + + +
+ Change Signature +
+
+ + errorMessage)): ?> + _($this->errorMessage); ?> + + +
+   + + +
+
+ + +
+
+
+
+ + diff --git a/modules/settings/EmailTemplates.tpl b/modules/settings/EmailTemplates.tpl index cf7577c8b..2cf387048 100755 --- a/modules/settings/EmailTemplates.tpl +++ b/modules/settings/EmailTemplates.tpl @@ -157,6 +157,7 @@ + diff --git a/modules/settings/MyProfile.tpl b/modules/settings/MyProfile.tpl index cb1771d0d..04872aa83 100755 --- a/modules/settings/MyProfile.tpl +++ b/modules/settings/MyProfile.tpl @@ -46,6 +46,16 @@ Change your CATS login password. + + + + Change E-mail Signature + + + + Change the signature that can be used with e-mail templates sent from your account. + +