causefx 8 лет назад
Родитель
Сommit
2057d823cb
5 измененных файлов с 1388 добавлено и 51 удалено
  1. 20 0
      config/configDefaults.php
  2. 1223 0
      email.php
  3. 63 2
      functions.php
  4. 49 8
      settings.php
  5. 33 41
      user.php

+ 20 - 0
config/configDefaults.php

@@ -144,4 +144,24 @@ return array(
 	"homepageOrdernoticeguest" => '14',
 	"homepageOrdertransmisson" => '15',
 	'requestedUserOnly' => 'true',
+	'emailTemplateCSS' => '',
+	'emailTempateLogo' => 'https://raw.githubusercontent.com/causefx/Organizr/master/images/organizr-logo-h.png',
+	'emailTemplateResetPassword' => '
+	<h2>Hey there {user}!</h2><br />
+	Looks like you forgot your password.  Well, I got you...  Here is your new password: {password}<br />
+	If you want to change it once you log in, you can.  Head over to my website: {domain}<br />
+	',
+	'emailTemplateResetPasswordSubject' => 'Password Reset',
+	'emailTemplateInviteUser' => '
+	<h2>Hey there {user}!</h2><br />
+	Here is the invite code to join my cool media server: {inviteCode}<br/>
+	Head over to my website and enter the code to join: {domain}<br />
+	',
+	'emailTemplateInviteUserSubject' => 'You have been invited to join my server',
+	'emailTemplateRegisterUser' => '
+	<h2>Hey there {user}!</h2><br />
+	Welcome to me site.<br/>
+	If you need anything, please let me know.<br />
+	',
+	'emailTemplateRegisterUserSubject' => 'Thank you For Registering',
 );

+ 1223 - 0
email.php

@@ -0,0 +1,1223 @@
+<?php
+switch ($extra) {
+    case 'invite':
+        $button = '
+        <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnButtonBlock" style="min-width:100%;">
+            <tbody class="mcnButtonBlockOuter">
+                <tr>
+                    <td style="padding-top:0; padding-right:18px; padding-bottom:18px; padding-left:18px;" valign="top" align="center" class="mcnButtonBlockInner">
+                        <table border="0" cellpadding="0" cellspacing="0" class="mcnButtonContentContainer" style="border-collapse: separate !important;border-radius: 10px;background-color: #AD80FD;">
+                            <tbody>
+                                <tr>
+                                    <td align="center" valign="middle" class="mcnButtonContent" style="font-family: Helvetica; font-size: 18px; padding: 18px;">
+                                        <a class="mcnButton " title="Button Text" href="'.getServerPath().'?inviteCode='.$email['inviteCode'].'" target="_self" style="font-weight: bold;letter-spacing: -0.5px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;">Use Invite Code</a>
+                                    </td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+        ';
+        break;
+    case 'reset':
+        $button = '
+        <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnButtonBlock" style="min-width:100%;">
+            <tbody class="mcnButtonBlockOuter">
+                <tr>
+                    <td style="padding-top:0; padding-right:18px; padding-bottom:18px; padding-left:18px;" valign="top" align="center" class="mcnButtonBlockInner">
+                        <table border="0" cellpadding="0" cellspacing="0" class="mcnButtonContentContainer" style="border-collapse: separate !important;border-radius: 10px;background-color: #AD80FD;">
+                            <tbody>
+                                <tr>
+                                    <td align="center" valign="middle" class="mcnButtonContent" style="font-family: Helvetica; font-size: 18px; padding: 18px;">
+                                        <a class="mcnButton " title="Reset Password" href="'.getServerPath().'" target="_self" style="font-weight: bold;letter-spacing: -0.5px;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;">Goto My Site</a>
+                                    </td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+        ';
+        break;
+    default:
+        $button = null;
+        break;
+}
+
+$info = '
+<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextBlock" style="min-width:100%;">
+    <!--[if gte mso 9]>
+<table align="center" border="0" cellspacing="0" cellpadding="0" width="100%">
+<![endif]-->
+    <tbody class="mcnBoxedTextBlockOuter">
+        <tr>
+            <td valign="top" class="mcnBoxedTextBlockInner">
+
+                <!--[if gte mso 9]>
+<td align="center" valign="top" ">
+<![endif]-->
+                <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;" class="mcnBoxedTextContentContainer">
+                    <tbody>
+                        <tr>
+
+                            <td style="padding-top:9px; padding-left:18px; padding-bottom:9px; padding-right:18px;">
+
+                                <table border="0" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% !important;background-color: #F7F7F7;border: 1px none;">
+                                    <tbody>
+                                        <tr>
+                                            <td valign="top" class="mcnTextContent" style="padding: 18px;">
+                                                <h3 style="text-align:center;">'.getServerPath().'</h3>
+
+                                                <p><b>Email Sent at:</b> '.date("Y-m-d h:i").'</p>
+
+                                            </td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </td>
+                        </tr>
+                    </tbody>
+                </table>
+                <!--[if gte mso 9]>
+</td>
+<![endif]-->
+
+                <!--[if gte mso 9]>
+</tr>
+</table>
+<![endif]-->
+            </td>
+        </tr>
+    </tbody>
+</table>
+';
+
+ $email = '
+<!doctype html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
+
+<head>
+    <!-- NAME: EDUCATE -->
+    <!--[if gte mso 15]>
+		<xml>
+			<o:OfficeDocumentSettings>
+			<o:AllowPNG/>
+			<o:PixelsPerInch>96</o:PixelsPerInch>
+			</o:OfficeDocumentSettings>
+		</xml>
+		<![endif]-->
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>*EMAIL*</title>
+
+    <style type="text/css">
+        p {
+            margin: 10px 0;
+            padding: 0;
+        }
+
+        table {
+            border-collapse: collapse;
+        }
+
+        h1,
+        h2,
+        h3,
+        h4,
+        h5,
+        h6 {
+            display: block;
+            margin: 0;
+            padding: 0;
+        }
+
+        img,
+        a img {
+            border: 0;
+            height: auto;
+            outline: none;
+            text-decoration: none;
+        }
+
+        body,
+        #bodyTable,
+        #bodyCell {
+            height: 100%;
+            margin: 0;
+            padding: 0;
+            width: 100%;
+        }
+
+        .mcnPreviewText {
+            display: none !important;
+        }
+
+        #outlook a {
+            padding: 0;
+        }
+
+        img {
+            -ms-interpolation-mode: bicubic;
+        }
+
+        table {
+            mso-table-lspace: 0pt;
+            mso-table-rspace: 0pt;
+        }
+
+        .ReadMsgBody {
+            width: 100%;
+        }
+
+        .ExternalClass {
+            width: 100%;
+        }
+
+        p,
+        a,
+        li,
+        td,
+        blockquote {
+            mso-line-height-rule: exactly;
+        }
+
+        a[href^=tel],
+        a[href^=sms] {
+            color: inherit;
+            cursor: default;
+            text-decoration: none;
+        }
+
+        p,
+        a,
+        li,
+        td,
+        body,
+        table,
+        blockquote {
+            -ms-text-size-adjust: 100%;
+            -webkit-text-size-adjust: 100%;
+        }
+
+        .ExternalClass,
+        .ExternalClass p,
+        .ExternalClass td,
+        .ExternalClass div,
+        .ExternalClass span,
+        .ExternalClass font {
+            line-height: 100%;
+        }
+
+        a[x-apple-data-detectors] {
+            color: inherit !important;
+            text-decoration: none !important;
+            font-size: inherit !important;
+            font-family: inherit !important;
+            font-weight: inherit !important;
+            line-height: inherit !important;
+        }
+
+        .templateContainer {
+            max-width: 600px !important;
+        }
+
+        a.mcnButton {
+            display: block;
+        }
+
+        .mcnImage {
+            vertical-align: bottom;
+        }
+
+        .mcnTextContent {
+            word-break: break-word;
+        }
+
+        .mcnTextContent img {
+            height: auto !important;
+        }
+
+        .mcnDividerBlock {
+            table-layout: fixed !important;
+        }
+        /*
+	@tab Page
+	@section Heading 1
+	@style heading 1
+	*/
+
+        h1 {
+            /*@editable*/
+            color: #222222;
+            /*@editable*/
+            font-family: Helvetica;
+            /*@editable*/
+            font-size: 40px;
+            /*@editable*/
+            font-style: normal;
+            /*@editable*/
+            font-weight: bold;
+            /*@editable*/
+            line-height: 150%;
+            /*@editable*/
+            letter-spacing: normal;
+            /*@editable*/
+            text-align: left;
+        }
+        /*
+	@tab Page
+	@section Heading 2
+	@style heading 2
+	*/
+
+        h2 {
+            /*@editable*/
+            color: #222222;
+            /*@editable*/
+            font-family: Helvetica;
+            /*@editable*/
+            font-size: 28px;
+            /*@editable*/
+            font-style: normal;
+            /*@editable*/
+            font-weight: bold;
+            /*@editable*/
+            line-height: 150%;
+            /*@editable*/
+            letter-spacing: normal;
+            /*@editable*/
+            text-align: left;
+        }
+        /*
+	@tab Page
+	@section Heading 3
+	@style heading 3
+	*/
+
+        h3 {
+            /*@editable*/
+            color: #444444;
+            /*@editable*/
+            font-family: Helvetica;
+            /*@editable*/
+            font-size: 22px;
+            /*@editable*/
+            font-style: normal;
+            /*@editable*/
+            font-weight: bold;
+            /*@editable*/
+            line-height: 150%;
+            /*@editable*/
+            letter-spacing: normal;
+            /*@editable*/
+            text-align: left;
+        }
+        /*
+	@tab Page
+	@section Heading 4
+	@style heading 4
+	*/
+
+        h4 {
+            /*@editable*/
+            color: #999999;
+            /*@editable*/
+            font-family: Georgia;
+            /*@editable*/
+            font-size: 20px;
+            /*@editable*/
+            font-style: italic;
+            /*@editable*/
+            font-weight: normal;
+            /*@editable*/
+            line-height: 125%;
+            /*@editable*/
+            letter-spacing: normal;
+            /*@editable*/
+            text-align: left;
+        }
+        /*
+	@tab Header
+	@section Header Container Style
+	*/
+
+        #templateHeader {
+            /*@editable*/
+            background-color: #333333;
+            /*@editable*/
+            background-image: none;
+            /*@editable*/
+            background-repeat: no-repeat;
+            /*@editable*/
+            background-position: center;
+            /*@editable*/
+            background-size: cover;
+            /*@editable*/
+            border-top: 0;
+            /*@editable*/
+            border-bottom: 0;
+            /*@editable*/
+            padding-top: 10px;
+            /*@editable*/
+            padding-bottom: 10px;
+        }
+        /*
+	@tab Header
+	@section Header Interior Style
+	*/
+
+        .headerContainer {
+            /*@editable*/
+            background-color: #transparent;
+            /*@editable*/
+            background-image: none;
+            /*@editable*/
+            background-repeat: no-repeat;
+            /*@editable*/
+            background-position: center;
+            /*@editable*/
+            background-size: cover;
+            /*@editable*/
+            border-top: 0;
+            /*@editable*/
+            border-bottom: 0;
+            /*@editable*/
+            padding-top: 0;
+            /*@editable*/
+            padding-bottom: 0;
+        }
+        /*
+	@tab Header
+	@section Header Text
+	*/
+
+        .headerContainer .mcnTextContent,
+        .headerContainer .mcnTextContent p {
+            /*@editable*/
+            color: #808080;
+            /*@editable*/
+            font-family: Helvetica;
+            /*@editable*/
+            font-size: 16px;
+            /*@editable*/
+            line-height: 150%;
+            /*@editable*/
+            text-align: left;
+        }
+        /*
+	@tab Header
+	@section Header Link
+	*/
+
+        .headerContainer .mcnTextContent a,
+        .headerContainer .mcnTextContent p a {
+            /*@editable*/
+            color: #00ADD8;
+            /*@editable*/
+            font-weight: normal;
+            /*@editable*/
+            text-decoration: underline;
+        }
+        /*
+	@tab Body
+	@section Body Container Style
+	*/
+
+        #templateBody {
+            /*@editable*/
+            background-color: #ffffff;
+            /*@editable*/
+            background-image: none;
+            /*@editable*/
+            background-repeat: no-repeat;
+            /*@editable*/
+            background-position: center;
+            /*@editable*/
+            background-size: cover;
+            /*@editable*/
+            border-top: 0;
+            /*@editable*/
+            border-bottom: 0;
+            /*@editable*/
+            padding-top: 27px;
+            /*@editable*/
+            padding-bottom: 63px;
+        }
+        /*
+	@tab Body
+	@section Body Interior Style
+	*/
+
+        .bodyContainer {
+            /*@editable*/
+            background-color: #transparent;
+            /*@editable*/
+            background-image: none;
+            /*@editable*/
+            background-repeat: no-repeat;
+            /*@editable*/
+            background-position: center;
+            /*@editable*/
+            background-size: cover;
+            /*@editable*/
+            border-top: 0;
+            /*@editable*/
+            border-bottom: 0;
+            /*@editable*/
+            padding-top: 0;
+            /*@editable*/
+            padding-bottom: 0;
+        }
+        /*
+	@tab Body
+	@section Body Text
+	*/
+
+        .bodyContainer .mcnTextContent,
+        .bodyContainer .mcnTextContent p {
+            /*@editable*/
+            color: #808080;
+            /*@editable*/
+            font-family: Helvetica;
+            /*@editable*/
+            font-size: 16px;
+            /*@editable*/
+            line-height: 150%;
+            /*@editable*/
+            text-align: left;
+        }
+        /*
+	@tab Body
+	@section Body Link
+	*/
+
+        .bodyContainer .mcnTextContent a,
+        .bodyContainer .mcnTextContent p a {
+            /*@editable*/
+            color: #00ADD8;
+            /*@editable*/
+            font-weight: normal;
+            /*@editable*/
+            text-decoration: underline;
+        }
+        /*
+	@tab Footer
+	@section Footer Style
+	*/
+
+        #templateFooter {
+            /*@editable*/
+            background-color: #333333;
+            /*@editable*/
+            background-image: none;
+            /*@editable*/
+            background-repeat: no-repeat;
+            /*@editable*/
+            background-position: center;
+            /*@editable*/
+            background-size: cover;
+            /*@editable*/
+            border-top: 0;
+            /*@editable*/
+            border-bottom: 0;
+            /*@editable*/
+            padding-top: 0px;
+            /*@editable*/
+            padding-bottom: 0px;
+        }
+        /*
+	@tab Footer
+	@section Footer Interior Style
+	*/
+
+        .footerContainer {
+            /*@editable*/
+            background-color: #transparent;
+            /*@editable*/
+            background-image: none;
+            /*@editable*/
+            background-repeat: no-repeat;
+            /*@editable*/
+            background-position: center;
+            /*@editable*/
+            background-size: cover;
+            /*@editable*/
+            border-top: 0;
+            /*@editable*/
+            border-bottom: 0;
+            /*@editable*/
+            padding-top: 0;
+            /*@editable*/
+            padding-bottom: 0;
+        }
+        /*
+	@tab Footer
+	@section Footer Text
+	*/
+
+        .footerContainer .mcnTextContent,
+        .footerContainer .mcnTextContent p {
+            /*@editable*/
+            color: #FFFFFF;
+            /*@editable*/
+            font-family: Helvetica;
+            /*@editable*/
+            font-size: 12px;
+            /*@editable*/
+            line-height: 150%;
+            /*@editable*/
+            text-align: center;
+        }
+        /*
+	@tab Footer
+	@section Footer Link
+	*/
+
+        .footerContainer .mcnTextContent a,
+        .footerContainer .mcnTextContent p a {
+            /*@editable*/
+            color: #FFFFFF;
+            /*@editable*/
+            font-weight: normal;
+            /*@editable*/
+            text-decoration: underline;
+        }
+
+        @media only screen and (min-width:768px) {
+            .templateContainer {
+                width: 600px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            body,
+            table,
+            td,
+            p,
+            a,
+            li,
+            blockquote {
+                -webkit-text-size-adjust: none !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            body {
+                width: 100% !important;
+                min-width: 100% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImage {
+                width: 100% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnCartContainer,
+            .mcnCaptionTopContent,
+            .mcnRecContentContainer,
+            .mcnCaptionBottomContent,
+            .mcnTextContentContainer,
+            .mcnBoxedTextContentContainer,
+            .mcnImageGroupContentContainer,
+            .mcnCaptionLeftTextContentContainer,
+            .mcnCaptionRightTextContentContainer,
+            .mcnCaptionLeftImageContentContainer,
+            .mcnCaptionRightImageContentContainer,
+            .mcnImageCardLeftTextContentContainer,
+            .mcnImageCardRightTextContentContainer {
+                max-width: 100% !important;
+                width: 100% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnBoxedTextContentContainer {
+                min-width: 100% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImageGroupContent {
+                padding: 9px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnCaptionLeftContentOuter .mcnTextContent,
+            .mcnCaptionRightContentOuter .mcnTextContent {
+                padding-top: 9px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImageCardTopImageContent,
+            .mcnCaptionBlockInner .mcnCaptionTopContent:last-child .mcnTextContent {
+                padding-top: 18px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImageCardBottomImageContent {
+                padding-bottom: 9px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImageGroupBlockInner {
+                padding-top: 0 !important;
+                padding-bottom: 0 !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImageGroupBlockOuter {
+                padding-top: 9px !important;
+                padding-bottom: 9px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnTextContent,
+            .mcnBoxedTextContentColumn {
+                padding-right: 18px !important;
+                padding-left: 18px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcnImageCardLeftImageContent,
+            .mcnImageCardRightImageContent {
+                padding-right: 18px !important;
+                padding-bottom: 0 !important;
+                padding-left: 18px !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            .mcpreview-image-uploader {
+                display: none !important;
+                width: 100% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Heading 1
+	@tip Make the first-level headings larger in size for better readability on small screens.
+	*/
+            h1 {
+                /*@editable*/
+                font-size: 30px !important;
+                /*@editable*/
+                line-height: 125% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Heading 2
+	@tip Make the second-level headings larger in size for better readability on small screens.
+	*/
+            h2 {
+                /*@editable*/
+                font-size: 26px !important;
+                /*@editable*/
+                line-height: 125% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Heading 3
+	@tip Make the third-level headings larger in size for better readability on small screens.
+	*/
+            h3 {
+                /*@editable*/
+                font-size: 20px !important;
+                /*@editable*/
+                line-height: 150% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Heading 4
+	@tip Make the fourth-level headings larger in size for better readability on small screens.
+	*/
+            h4 {
+                /*@editable*/
+                font-size: 18px !important;
+                /*@editable*/
+                line-height: 150% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Boxed Text
+	@tip Make the boxed text larger in size for better readability on small screens. We recommend a font size of at least 16px.
+	*/
+            .mcnBoxedTextContentContainer .mcnTextContent,
+            .mcnBoxedTextContentContainer .mcnTextContent p {
+                /*@editable*/
+                font-size: 14px !important;
+                /*@editable*/
+                line-height: 150% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Header Text
+	@tip Make the header text larger in size for better readability on small screens.
+	*/
+            .headerContainer .mcnTextContent,
+            .headerContainer .mcnTextContent p {
+                /*@editable*/
+                font-size: 16px !important;
+                /*@editable*/
+                line-height: 150% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Body Text
+	@tip Make the body text larger in size for better readability on small screens. We recommend a font size of at least 16px.
+	*/
+            .bodyContainer .mcnTextContent,
+            .bodyContainer .mcnTextContent p {
+                /*@editable*/
+                font-size: 16px !important;
+                /*@editable*/
+                line-height: 150% !important;
+            }
+        }
+
+        @media only screen and (max-width: 480px) {
+            /*
+	@tab Mobile Styles
+	@section Footer Text
+	@tip Make the footer content text larger in size for better readability on small screens.
+	*/
+            .footerContainer .mcnTextContent,
+            .footerContainer .mcnTextContent p {
+                /*@editable*/
+                font-size: 14px !important;
+                /*@editable*/
+                line-height: 150% !important;
+            }
+        }
+    </style>
+</head>
+
+<body>
+    <!--*|IF:MC_PREVIEW_TEXT|*-->
+    <!--[if !gte mso 9]><!----><span class="mcnPreviewText" style="display:none; font-size:0px; line-height:0px; max-height:0px; max-width:0px; opacity:0; overflow:hidden; visibility:hidden; mso-hide:all;">*|MC_PREVIEW_TEXT|*</span>
+    <!--<![endif]-->
+    <!--*|END:IF|*-->
+    <center>
+        <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
+            <tr>
+                <td align="center" valign="top" id="bodyCell">
+                    <!-- BEGIN TEMPLATE // -->
+                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
+                        <tr>
+                            <td align="center" valign="top" id="templateHeader" data-template-container>
+                                <!--[if (gte mso 9)|(IE)]>
+									<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;">
+									<tr>
+									<td align="center" valign="top" width="600" style="width:600px;">
+									<![endif]-->
+                                <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer">
+                                    <tr>
+                                        <td valign="top" class="headerContainer">
+                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnImageBlock" style="min-width:100%;">
+                                                <tbody class="mcnImageBlockOuter">
+                                                    <tr>
+                                                        <td valign="top" style="padding:9px" class="mcnImageBlockInner">
+                                                            <table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" class="mcnImageContentContainer" style="min-width:100%;">
+                                                                <tbody>
+                                                                    <tr>
+                                                                        <td class="mcnImageContent" valign="top" style="padding-right: 9px; padding-left: 9px; padding-top: 0; padding-bottom: 0; text-align:center;">
+
+                                                                            <img align="center" alt="" src="'.emailTempateLogo.'" width="564" style="max-width:700px; padding-bottom: 0; display: inline !important; vertical-align: bottom;" class="mcnImage">
+
+                                                                        </td>
+                                                                    </tr>
+                                                                </tbody>
+                                                            </table>
+                                                        </td>
+                                                    </tr>
+                                                </tbody>
+                                            </table>
+                                        </td>
+                                    </tr>
+                                </table>
+                                <!--[if (gte mso 9)|(IE)]>
+									</td>
+									</tr>
+									</table>
+									<![endif]-->
+                            </td>
+                        </tr>
+                        <tr>
+                            <td align="center" valign="top" id="templateBody" data-template-container>
+                                <!--[if (gte mso 9)|(IE)]>
+									<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;">
+									<tr>
+									<td align="center" valign="top" width="600" style="width:600px;">
+									<![endif]-->
+                                <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer">
+                                    <tr>
+                                        <td valign="top" class="bodyContainer">
+                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;">
+                                                <tbody class="mcnTextBlockOuter">
+                                                    <tr>
+                                                        <td valign="top" class="mcnTextBlockInner" style="padding-top:9px;">
+                                                            <!--[if mso]>
+				<table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
+				<tr>
+				<![endif]-->
+
+                                                            <!--[if mso]>
+				<td valign="top" width="600" style="width:600px;">
+				<![endif]-->
+                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer">
+                                                                <tbody>
+                                                                    <tr>
+
+                                                                        <td valign="top" class="mcnTextContent" style="padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;">
+
+                                                                            '.$body.'
+
+                                                                        </td>
+                                                                    </tr>
+                                                                </tbody>
+                                                            </table>
+                                                            <!--[if mso]>
+				</td>
+				<![endif]-->
+
+                                                            <!--[if mso]>
+				</tr>
+				</table>
+				<![endif]-->
+                                                        </td>
+                                                    </tr>
+                                                </tbody>
+                                            </table>
+
+                                            '.$button.$info.'
+                                        </td>
+                                    </tr>
+                                </table>
+                                <!--[if (gte mso 9)|(IE)]>
+									</td>
+									</tr>
+									</table>
+									<![endif]-->
+                            </td>
+                        </tr>
+                        <tr>
+                            <td align="center" valign="top" id="templateFooter" data-template-container>
+                                <!--[if (gte mso 9)|(IE)]>
+									<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;">
+									<tr>
+									<td align="center" valign="top" width="600" style="width:600px;">
+									<![endif]-->
+                                <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer">
+                                    <tr>
+                                        <td valign="top" class="footerContainer">
+                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowBlock" style="min-width:100%;">
+                                                <tbody class="mcnFollowBlockOuter">
+                                                    <tr>
+                                                        <td align="center" valign="top" style="padding:9px" class="mcnFollowBlockInner">
+                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentContainer" style="min-width:100%;">
+                                                                <tbody>
+                                                                    <tr>
+                                                                        <td align="center" style="padding-left:9px;padding-right:9px;">
+                                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%; border: 1px none;" class="mcnFollowContent">
+                                                                                <tbody>
+                                                                                    <tr>
+                                                                                        <td align="center" valign="top" style="padding-top:9px; padding-right:9px; padding-left:9px;">
+                                                                                            <table align="center" border="0" cellpadding="0" cellspacing="0">
+                                                                                                <tbody>
+                                                                                                    <tr>
+                                                                                                        <td align="center" valign="top">
+                                                                                                            <!--[if mso]>
+                                    <table align="center" border="0" cellspacing="0" cellpadding="0">
+                                    <tr>
+                                    <![endif]-->
+
+                                                                                                            <!--[if mso]>
+                                        <td align="center" valign="top">
+                                        <![endif]-->
+
+                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" style="display:inline;">
+                                                                                                                <tbody>
+                                                                                                                    <tr>
+                                                                                                                        <td valign="top" style="padding-right:10px; padding-bottom:9px;" class="mcnFollowContentItemContainer">
+                                                                                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentItem">
+                                                                                                                                <tbody>
+                                                                                                                                    <tr>
+                                                                                                                                        <td align="left" valign="middle" style="padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;">
+                                                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="">
+                                                                                                                                                <tbody>
+                                                                                                                                                    <tr>
+
+                                                                                                                                                        <td align="center" valign="middle" width="24" class="mcnFollowIconContent">
+                                                                                                                                                            <a href="https://github.com/causefx/organizr" target="_blank"><img src="https://cdn-images.mailchimp.com/icons/social-block-v2/color-github-48.png" style="display:block;" height="24" width="24" class=""></a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                        <td align="left" valign="middle" class="mcnFollowTextContent" style="padding-left:5px;">
+                                                                                                                                                            <a href="https://github.com/causefx/organizr" target="" style="font-family: Helvetica;font-size: 12px;text-decoration: none;color: #FFFFFF;font-weight: bold;">GitHub</a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                    </tr>
+                                                                                                                                                </tbody>
+                                                                                                                                            </table>
+                                                                                                                                        </td>
+                                                                                                                                    </tr>
+                                                                                                                                </tbody>
+                                                                                                                            </table>
+                                                                                                                        </td>
+                                                                                                                    </tr>
+                                                                                                                </tbody>
+                                                                                                            </table>
+
+                                                                                                            <!--[if mso]>
+                                        </td>
+                                        <![endif]-->
+
+                                                                                                            <!--[if mso]>
+                                        <td align="center" valign="top">
+                                        <![endif]-->
+
+                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" style="display:inline;">
+                                                                                                                <tbody>
+                                                                                                                    <tr>
+                                                                                                                        <td valign="top" style="padding-right:10px; padding-bottom:9px;" class="mcnFollowContentItemContainer">
+                                                                                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentItem">
+                                                                                                                                <tbody>
+                                                                                                                                    <tr>
+                                                                                                                                        <td align="left" valign="middle" style="padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;">
+                                                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="">
+                                                                                                                                                <tbody>
+                                                                                                                                                    <tr>
+
+                                                                                                                                                        <td align="center" valign="middle" width="24" class="mcnFollowIconContent">
+                                                                                                                                                            <a href="https://www.reddit.com/r/organizr" target="_blank"><img src="https://cdn-images.mailchimp.com/icons/social-block-v2/color-reddit-48.png" style="display:block;" height="24" width="24" class=""></a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                        <td align="left" valign="middle" class="mcnFollowTextContent" style="padding-left:5px;">
+                                                                                                                                                            <a href="https://www.reddit.com/r/organizr" target="" style="font-family: Helvetica;font-size: 12px;text-decoration: none;color: #FFFFFF;font-weight: bold;">Reddit</a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                    </tr>
+                                                                                                                                                </tbody>
+                                                                                                                                            </table>
+                                                                                                                                        </td>
+                                                                                                                                    </tr>
+                                                                                                                                </tbody>
+                                                                                                                            </table>
+                                                                                                                        </td>
+                                                                                                                    </tr>
+                                                                                                                </tbody>
+                                                                                                            </table>
+
+                                                                                                            <!--[if mso]>
+                                        </td>
+                                        <![endif]-->
+
+                                                                                                            <!--[if mso]>
+                                        <td align="center" valign="top">
+                                        <![endif]-->
+
+                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" style="display:inline;">
+                                                                                                                <tbody>
+                                                                                                                    <tr>
+                                                                                                                        <td valign="top" style="padding-right:10px; padding-bottom:9px;" class="mcnFollowContentItemContainer">
+                                                                                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentItem">
+                                                                                                                                <tbody>
+                                                                                                                                    <tr>
+                                                                                                                                        <td align="left" valign="middle" style="padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;">
+                                                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="">
+                                                                                                                                                <tbody>
+                                                                                                                                                    <tr>
+
+                                                                                                                                                        <td align="center" valign="middle" width="24" class="mcnFollowIconContent">
+                                                                                                                                                            <a href="https://organizr.us" target="_blank"><img src="https://cdn-images.mailchimp.com/icons/social-block-v2/color-link-48.png" style="display:block;" height="24" width="24" class=""></a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                        <td align="left" valign="middle" class="mcnFollowTextContent" style="padding-left:5px;">
+                                                                                                                                                            <a href="https://organizr.us" target="" style="font-family: Helvetica;font-size: 12px;text-decoration: none;color: #FFFFFF;font-weight: bold;">Website</a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                    </tr>
+                                                                                                                                                </tbody>
+                                                                                                                                            </table>
+                                                                                                                                        </td>
+                                                                                                                                    </tr>
+                                                                                                                                </tbody>
+                                                                                                                            </table>
+                                                                                                                        </td>
+                                                                                                                    </tr>
+                                                                                                                </tbody>
+                                                                                                            </table>
+
+                                                                                                            <!--[if mso]>
+                                        </td>
+                                        <![endif]-->
+
+                                                                                                            <!--[if mso]>
+                                        <td align="center" valign="top">
+                                        <![endif]-->
+
+                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" style="display:inline;">
+                                                                                                                <tbody>
+                                                                                                                    <tr>
+                                                                                                                        <td valign="top" style="padding-right:0; padding-bottom:9px;" class="mcnFollowContentItemContainer">
+                                                                                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentItem">
+                                                                                                                                <tbody>
+                                                                                                                                    <tr>
+                                                                                                                                        <td align="left" valign="middle" style="padding-top:5px; padding-right:10px; padding-bottom:5px; padding-left:9px;">
+                                                                                                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" width="">
+                                                                                                                                                <tbody>
+                                                                                                                                                    <tr>
+
+                                                                                                                                                        <td align="center" valign="middle" width="24" class="mcnFollowIconContent">
+                                                                                                                                                            <a href="https://discord.gg/TrNtY7N" target="_blank"><img src="https://cdn-images.mailchimp.com/icons/social-block-v2/color-link-48.png" style="display:block;" height="24" width="24" class=""></a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                        <td align="left" valign="middle" class="mcnFollowTextContent" style="padding-left:5px;">
+                                                                                                                                                            <a href="https://discord.gg/TrNtY7N" target="" style="font-family: Helvetica;font-size: 12px;text-decoration: none;color: #FFFFFF;font-weight: bold;">Discord</a>
+                                                                                                                                                        </td>
+
+                                                                                                                                                    </tr>
+                                                                                                                                                </tbody>
+                                                                                                                                            </table>
+                                                                                                                                        </td>
+                                                                                                                                    </tr>
+                                                                                                                                </tbody>
+                                                                                                                            </table>
+                                                                                                                        </td>
+                                                                                                                    </tr>
+                                                                                                                </tbody>
+                                                                                                            </table>
+
+                                                                                                            <!--[if mso]>
+                                        </td>
+                                        <![endif]-->
+
+                                                                                                            <!--[if mso]>
+                                    </tr>
+                                    </table>
+                                    <![endif]-->
+                                                                                                        </td>
+                                                                                                    </tr>
+                                                                                                </tbody>
+                                                                                            </table>
+                                                                                        </td>
+                                                                                    </tr>
+                                                                                </tbody>
+                                                                            </table>
+                                                                        </td>
+                                                                    </tr>
+                                                                </tbody>
+                                                            </table>
+
+                                                        </td>
+                                                    </tr>
+                                                </tbody>
+                                            </table>
+                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;">
+                                                <tbody class="mcnDividerBlockOuter">
+                                                    <tr>
+                                                        <td class="mcnDividerBlockInner" style="min-width: 100%; padding: 0px 18px;">
+                                                            <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%;border-top: 2px solid #505050;">
+                                                                <tbody>
+                                                                    <tr>
+                                                                        <td>
+                                                                            <span></span>
+                                                                        </td>
+                                                                    </tr>
+                                                                </tbody>
+                                                            </table>
+                                                            <!--
+                <td class="mcnDividerBlockInner" style="padding: 18px;">
+                <hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" />
+-->
+                                                        </td>
+                                                    </tr>
+                                                </tbody>
+                                            </table>
+                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;">
+                                                <tbody class="mcnTextBlockOuter">
+                                                    <tr>
+                                                        <td valign="top" class="mcnTextBlockInner" style="padding-top:9px;">
+                                                            <!--[if mso]>
+				<table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
+				<tr>
+				<![endif]-->
+
+                                                            <!--[if mso]>
+				<td valign="top" width="600" style="width:600px;">
+				<![endif]-->
+                                                            <table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer">
+                                                                <tbody>
+                                                                    <tr>
+
+                                                                        <td valign="top" class="mcnTextContent" style="padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px;">
+
+                                                                            <em>Powered By: Organizr</em>
+                                                                        </td>
+                                                                    </tr>
+                                                                </tbody>
+                                                            </table>
+                                                            <!--[if mso]>
+				</td>
+				<![endif]-->
+
+                                                            <!--[if mso]>
+				</tr>
+				</table>
+				<![endif]-->
+                                                        </td>
+                                                    </tr>
+                                                </tbody>
+                                            </table>
+                                        </td>
+                                    </tr>
+                                </table>
+                                <!--[if (gte mso 9)|(IE)]>
+									</td>
+									</tr>
+									</table>
+									<![endif]-->
+                            </td>
+                        </tr>
+                    </table>
+                    <!-- // END TEMPLATE -->
+                </td>
+            </tr>
+        </table>
+    </center>
+</body>
+
+</html>
+';

+ 63 - 2
functions.php

@@ -4829,8 +4829,6 @@ function buildMenu($array){
 }
 
 function requestInvite($email, $username){
-	//sendEmail($email, $username = "Organizr User", $subject, $body, $cc = null){
-	//orgEmail($header = "Message From Admin", $title = "Important Message", $user = "Organizr User", $mainMessage = "", $button = null, $buttonURL = null, $subTitle = "", $subMessage = ""){
 	sendEmail($GLOBALS['USER']->adminEmail, "Admin", "Plex Invite Request", orgEmail("PLEX Invite Request", "Look who wants to join the cool club", "Admin", "Hey, The User: $user has requested access to your Plex Library.", "Generate Invite", null, "What Next?", "Well, That is up to you.  You can go check on them if you like."));
 
 }
@@ -5682,6 +5680,69 @@ function buildHomepageItem($homepageItem, $group, $user){
 	return $homepageItemBuilt;
 }
 
+function buildAccordion($items){
+	$i = 1;
+	$variables = '&nbsp; Available Variables: ';
+	$accordion = '<div style="margin-bottom: 0px;" class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">';
+	foreach ($items as $key => $value) {
+		foreach ($value['variables'] as $variable) {
+			$variables .= '<mark>'.$variable.'</mark>';
+		}
+		$accordion .= '
+		<div class="panel panel-default">
+			<div class="panel-heading" role="tab" id="heading-'.$i.'">
+				<h4 class="panel-title" style="text-decoration: none;" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-'.$i.'" aria-expanded="true" aria-controls="collapse-'.$i.'">'.$value['title'].'</h4>
+			</div>
+			<div id="collapse-'.$i.'" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-'.$i.'" aria-expanded="true">
+				<br/>'.$variables.'<br/></br/>
+				<div class="form-content col-sm-12 col-md-12 col-lg-12">
+					<input id="'.$value['template'].'Subject_id" name="'.$value['template'].'Subject" type="text" class="form-control material input-sm" autocorrect="off" autocapitalize="off" value="'.$value['subject'].'">
+					<p class="help-text">Email Subject</p>
+					</div>
+					<br/></br/>
+				<div class="summernote" name="'.$value['template'].'">'.$value['body'].'</div>
+			</div>
+		</div>
+		';
+		$i++;
+		$variables = '&nbsp; Available Variables: ';
+	}
+	$accordion .= '</div>';
+	return $accordion;
+}
+
+function emailTemplate($emailTemplate){
+	$variables = [
+		'{user}' => $emailTemplate['user'],
+		'{domain}' => DOMAIN,
+		'{password}' => $emailTemplate['password'],
+		'{inviteCode}' => $emailTemplate['inviteCode'],
+		'{fullDomain}' => getServerPath(),
+	];
+	$emailTemplate['body'] = strtr($emailTemplate['body'], $variables);
+	$emailTemplate['subject'] = strtr($emailTemplate['subject'], $variables);
+	return $emailTemplate;
+}
+
+function buildEmail($email){
+	$subject = (isset($email['subject'])) ? $email['subject'] : 'Message from Server';
+	$body = (isset($email['body'])) ? $email['body'] : 'Message Error Occured';
+	$type = (isset($email['type'])) ? $email['type'] : 'No Type';
+	switch ($type) {
+		case 'invite':
+			$extra = 'invite';
+			break;
+		case 'reset':
+			$extra = 'reset';
+			break;
+		default:
+			$extra = null;
+			break;
+	}
+	include('email.php');
+	return $email;
+}
+
 function buildDownloader($name, $type = 'both'){
 	if($type == 'both'){
 		$tabs = '

+ 49 - 8
settings.php

@@ -1443,13 +1443,6 @@ echo buildSettings(
 						'value' => DOWNLOADREFRESH,
 						'options' => $refreshSeconds,
 					),
-                    array(
-						'type' => $userSelectType,
-						'labelTranslate' => 'HISTORY_REFRESH',
-						'name' => 'historyRefresh',
-						'value' => HISTORYREFRESH,
-						'options' => $refreshSeconds,
-					),
 				),
 			),
 			array(
@@ -1745,7 +1738,29 @@ foreach (array_filter(get_defined_functions()['user'],function($v) { return strp
 	}
 }
 ksort($backendOptions);
-
+$emailTemplates = array(
+	array(
+		'title' => 'Password Reset',
+        'variables' => array('{user}','{domain}','{fullDomain}','{password}'),
+        'subject' => emailTemplateResetPasswordSubject,
+		'body' => emailTemplateResetPassword,
+        'template' => 'emailTemplateResetPassword',
+	),
+	array(
+		'title' => 'New Registration',
+        'variables' => array('{user}','{domain}','{fullDomain}'),
+        'subject' => emailTemplateRegisterUserSubject,
+		'body' => emailTemplateRegisterUser,
+        'template' => 'emailTemplateRegisterUser',
+	),
+    array(
+		'title' => 'Invite User',
+        'variables' => array('{user}','{domain}','{fullDomain}','{inviteCode}'),
+        'subject' => emailTemplateInviteUserSubject,
+		'body' => emailTemplateInviteUser,
+        'template' => 'emailTemplateInviteUser',
+	),
+);
 echo buildSettings(
 	array(
 		'title' => 'Advanced Settings',
@@ -2011,6 +2026,32 @@ echo buildSettings(
 					),
 				),
 			),
+            array(
+				'title' => 'Mail Template Settings',
+				'id' => 'mail_settings_templates',
+				'image' => 'images/settings/full-color/png/64px/clipboard.png',
+				'fields' => array(
+                    array(
+						'type' => 'text',
+						'labelTranslate' => 'LOGO_URL_TITLE',
+						'name' => 'emailTempateLogo',
+						'value' => emailTempateLogo,
+					),
+                    array(
+						'type' => 'custom',
+						'html' => buildAccordion($emailTemplates),
+					),
+                    array(
+						'type' => 'textarea',
+						'name' => 'emailTemplateCSS',
+						'value' => emailTemplateCSS,
+                        'labelTranslate' => 'EDIT_CUSTOM_CSS',
+                        'placeholder' => 'Please Include <script></script> tags',
+						'rows' => 25,
+						'style' => 'background: #000; color: #FFF;',
+					),
+				),
+			),
 			array(
 				'title' => 'Advanced Visual',
 				'id' => 'advanced_visual',

+ 33 - 41
user.php

@@ -403,21 +403,17 @@
 			$update = "UPDATE users SET password = '$dbpassword' WHERE email= '$email'";
    			writeLog("success", "$username has reset their password");
 			$this->database->exec($update);
-            //$this->info("Email has been sent with new password");
-			// step 3: notify the user of the new password
-			$subject = DOMAIN . " Password Reset";
-			$language = new setLanguage;
-			$domain = getServerPath();
-			$body = orgEmail(
-					$header = $language->translate('EMAIL_RESET_HEADER'),
-					$title = $language->translate('EMAIL_RESET_TITLE'),
-					$user = $username,
-					$mainMessage =$language->translate('EMAIL_RESET_MESSAGE')."<br/>".$newpassword,
-					$button = $language->translate('EMAIL_RESET_BUTTON'),
-					$buttonURL = $domain,
-					$subTitle = $language->translate('EMAIL_RESET_SUBTITLE'),
-					$subMessage = $language->translate('EMAIL_RESET_SUBMESSAGE')
-					);
+			$emailTemplate = array(
+				'type' => 'reset',
+				'body' => emailTemplateResetPassword,
+				'subject' => emailTemplateResetPasswordSubject,
+				'user' => $username,
+				'password' => $newpassword,
+				'inviteCode' => null,
+			);
+			$emailTemplate = emailTemplate($emailTemplate);
+			$subject = $emailTemplate['subject'];
+			$body = buildEmail($emailTemplate);
             $this->startEmail($email, $username, $subject, $body);
 		}
 	// ------------------
@@ -630,20 +626,17 @@
 				//send email
 				if($username && User::use_mail)
 				{
-					// send email notification
-					$subject = "Welcome to ".DOMAIN;
-					$language = new setLanguage;
-					$domain = getServerPath();
-					$body = orgEmail(
-						$header = $language->translate('EMAIL_NEWUSER_HEADER'),
-						$title = $language->translate('EMAIL_NEWUSER_TITLE'),
-						$user = $username,
-						$mainMessage =$language->translate('EMAIL_NEWUSER_MESSAGE'),
-						$button = $language->translate('EMAIL_NEWUSER_BUTTON'),
-						$buttonURL = $domain,
-						$subTitle = $language->translate('EMAIL_NEWUSER_SUBTITLE'),
-						$subMessage = $language->translate('EMAIL_NEWUSER_SUBMESSAGE')
-						);
+					$emailTemplate = array(
+						'type' => 'registration',
+						'body' => emailTemplateRegisterUser,
+						'subject' => emailTemplateRegisterUserSubject,
+						'user' => $username,
+						'password' => null,
+						'inviteCode' => null,
+					);
+					$emailTemplate = emailTemplate($emailTemplate);
+					$subject = $emailTemplate['subject'];
+					$body = buildEmail($emailTemplate);
 					$this->startEmail($email, $username, $subject, $body);
 				}
 				return true;
@@ -874,18 +867,17 @@
 			$this->info("$email has been invited to the $server server");
 			if($insert && User::use_mail)
 			{
-				// send email notification
-				$subject = DOMAIN . " $uServer ".$language->translate('INVITE_CODE');
-				$body = orgEmail(
-					$header = explosion($language->translate('EMAIL_INVITE_HEADER'), 0)." ".$uServer." ".explosion($language->translate('EMAIL_INVITE_HEADER'), 1),
-					$title = $language->translate('EMAIL_INVITE_TITLE'),
-					$user = $username,
-					$mainMessage = explosion($language->translate('EMAIL_INVITE_MESSAGE'), 0)." ".$uServer." ".explosion($language->translate('EMAIL_INVITE_MESSAGE'), 1)." ".$inviteCode,
-					$button = explosion($language->translate('EMAIL_INVITE_BUTTON'), 0)." ".$uServer." ".explosion($language->translate('EMAIL_INVITE_BUTTON'), 1),
-					$buttonURL = $link,
-					$subTitle = $language->translate('EMAIL_INVITE_SUBTITLE'),
-					$subMessage = explosion($language->translate('EMAIL_INVITE_SUBMESSAGE'), 0)." <a href='".$domain."?inviteCode'>".$domain."</a> ".explosion($language->translate('EMAIL_INVITE_SUBMESSAGE'), 1)
-					);
+				$emailTemplate = array(
+					'type' => 'invite',
+					'body' => emailTemplateInviteUser,
+					'subject' => emailTemplateInviteUserSubject,
+					'user' => $username,
+					'password' => null,
+					'inviteCode' => $inviteCode,
+				);
+				$emailTemplate = emailTemplate($emailTemplate);
+				$subject = $emailTemplate['subject'];
+				$body = buildEmail($emailTemplate);
                 $this->startEmail($email, $username, $subject, $body);
 			}
 		}