Browse Source

Added Emails - New User and Invite for now - Reset password next along with custom and email user directly

causefx 8 years ago
parent
commit
a28c700caf

+ 18 - 0
api/functions/auth-functions.php

@@ -3,6 +3,24 @@ function authRegister($username,$password,$defaults,$email){
 	$defaults = defaultUserGroup();
 	if(createUser($username,$password,$defaults,$email)){
 		writeLog('success', 'Registration Function - A User has registered', $username);
+		if($GLOBALS['PHPMAILER-enabled']){
+			$emailTemplate = array(
+				'type' => 'registration',
+				'body' => $GLOBALS['PHPMAILER-emailTemplateRegisterUser'],
+				'subject' => $GLOBALS['PHPMAILER-emailTemplateRegisterUserSubject'],
+				'user' => $username,
+				'password' => null,
+				'inviteCode' => null,
+			);
+			$emailTemplate = phpmEmailTemplate($emailTemplate);
+			$sendEmail = array(
+				'to' => $email,
+				'user' => $username,
+				'subject' => $emailTemplate['subject'],
+				'body' => phpmBuildEmail($emailTemplate),
+			);
+			phpmSendEmail($sendEmail);
+		}
 		if(createToken($username,$email,gravatar($email),$defaults['group'],$defaults['group_id'],$GLOBALS['organizrHash'],7)){
 			writeLoginLog($username, 'success');
 			writeLog('success', 'Login Function - A User has logged in', $username);

+ 6 - 1
api/functions/normal-functions.php

@@ -301,7 +301,12 @@ function qualifyURL($url, $return=false) {
 	);
 	return ($return) ? $array : $scheme.'://'.$host.$port.$path;
 }
-function getServerPath() {
+function getServerPath($over=false) {
+	if($over){
+		if($GLOBALS['PHPMAILER-domain'] !== ''){
+			return $GLOBALS['PHPMAILER-domain'];
+		}
+	}
 	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https"){
 		$protocol = "https://";
 	}elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {

+ 33 - 1
api/plugins/config/php-mailer.php

@@ -9,5 +9,37 @@ return array(
     'PHPMAILER-smtpHostSenderName' => 'Organizr',
     'PHPMAILER-smtpHostSenderEmail' => 'no-reply@Organizr.tld',
     'PHPMAILER-smtpHostType' => 'tls',
-	'PHPMAILER-domain' => ''
+	'PHPMAILER-domain' => '',
+	'PHPMAILER-template' => 'default',
+	'PHPMAILER-logo' => 'https://raw.githubusercontent.com/causefx/Organizr/master/images/organizr-logo-h.png',
+    'PHPMAILER-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 />
+	',
+	'PHPMAILER-emailTemplateResetPasswordSubject' => 'Password Reset',
+	'PHPMAILER-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 />
+	',
+	'PHPMAILER-emailTemplateInviteUserSubject' => 'You have been invited to join my server',
+	'PHPMAILER-emailTemplateRegisterUser' => '
+	<h2>Hey there {user}!</h2><br />
+	Welcome to my site.<br/>
+	If you need anything, please let me know.<br />
+	',
+	'PHPMAILER-emailTemplateRegisterUserSubject' => 'Thank you For Registering',
+	'PHPMAILER-emailTemplateCustomOne' => '',
+	'PHPMAILER-emailTemplateCustomOneName' => 'Template #1',
+	'PHPMAILER-emailTemplateCustomOneSubject' => '',
+	'PHPMAILER-emailTemplateCustomTwo' => '',
+	'PHPMAILER-emailTemplateCustomTwoName' => 'Template #2',
+	'PHPMAILER-emailTemplateCustomTwoSubject' => '',
+	'PHPMAILER-emailTemplateCustomThree' => '',
+	'PHPMAILER-emailTemplateCustomThreeName' => 'Template #3',
+	'PHPMAILER-emailTemplateCustomThreeSubject' => '',
+	'PHPMAILER-emailTemplateCustomFour' => '',
+	'PHPMAILER-emailTemplateCustomFourName' => 'Template #4',
+	'PHPMAILER-emailTemplateCustomFourSubject' => '',
 );

+ 18 - 1
api/plugins/invites.php

@@ -101,7 +101,24 @@ function inviteCodes($array) {
 							'type' => $GLOBALS['INVITES-type-include'],
 						];
 						$connect->query('INSERT INTO [invites]', $newCode);
-							writeLog('success', 'Invite Management Function -  Added Invite ['.$code.']', $GLOBALS['organizrUser']['username']);
+						writeLog('success', 'Invite Management Function -  Added Invite ['.$code.']', $GLOBALS['organizrUser']['username']);
+						if($GLOBALS['PHPMAILER-enabled']){
+							$emailTemplate = array(
+								'type' => 'invite',
+								'body' => $GLOBALS['PHPMAILER-emailTemplateInviteUser'],
+								'subject' => $GLOBALS['PHPMAILER-emailTemplateInviteUserSubject'],
+								'user' => $username,
+								'password' => null,
+								'inviteCode' => $code,
+							);
+							$emailTemplate = phpmEmailTemplate($emailTemplate);
+							$sendEmail = array(
+								'to' => $email,
+								'subject' => $emailTemplate['subject'],
+								'body' => phpmBuildEmail($emailTemplate),
+							);
+							phpmSendEmail($sendEmail);
+						}
 						return true;
 					} catch (Dibi\Exception $e) {
 						return false;

+ 1220 - 0
api/plugins/misc/emailTemplates/default.php

@@ -0,0 +1,1220 @@
+<?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(true).'?invite='.$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(true).'" 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(true).'</h3>
+                                            </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;"></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="'.$GLOBALS['PHPMAILER-logo'].'" 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>
+';

+ 154 - 14
api/plugins/php-mailer.php

@@ -19,6 +19,45 @@ $GLOBALS['plugins'][]['PHP Mailer'] = array( // Plugin Name
 // INCLUDE/REQUIRE FILES
 
 // PLUGIN FUNCTIONS
+function getTemplates(){
+	foreach (glob(dirname(__DIR__,2).DIRECTORY_SEPARATOR.'api' .DIRECTORY_SEPARATOR.'plugins' .DIRECTORY_SEPARATOR.'misc' . DIRECTORY_SEPARATOR . 'emailTemplates' . DIRECTORY_SEPARATOR . "*.php") as $filename){
+		$templates[] = array(
+			'name' => preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($filename)),
+			'value' => preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($filename))
+		);
+	}
+	return $templates;
+}
+function phpmEmailTemplate($emailTemplate){
+	$variables = [
+		'{user}' => $emailTemplate['user'],
+		'{domain}' => getServerPath(true),
+		'{password}' => $emailTemplate['password'],
+		'{inviteCode}' => $emailTemplate['inviteCode'],
+		'{fullDomain}' => getServerPath(true),
+	];
+	$emailTemplate['body'] = strtr($emailTemplate['body'], $variables);
+	$emailTemplate['subject'] = strtr($emailTemplate['subject'], $variables);
+	return $emailTemplate;
+}
+function phpmBuildEmail($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('misc/emailTemplates/'.$GLOBALS['PHPMAILER-template'].'.php');
+	return $email;
+}
 function phpmSendTestEmail(){
 	try {
 		$mail = new PHPMailer\PHPMailer\PHPMailer(true);
@@ -45,6 +84,50 @@ function phpmSendTestEmail(){
 	}
 	return false;
 }
+function phpmSendEmail($emailInfo){
+	$to = isset($emailInfo['to']) ? $emailInfo['to'] : null;
+	$cc = isset($emailInfo['cc']) ? $emailInfo['cc'] : null;
+	$bcc = isset($emailInfo['bcc']) ? $emailInfo['bcc'] : null;
+	$subject = isset($emailInfo['subject']) ? $emailInfo['subject'] : null;
+	$body = isset($emailInfo['body']) ? $emailInfo['body'] : null;
+	$username = isset($emailInfo['user']) ? $emailInfo['user'] : 'Organizr User';
+
+	try {
+		$mail = new PHPMailer\PHPMailer\PHPMailer(true);
+		$mail->isSMTP();
+		//$mail->SMTPDebug = 3;
+		$mail->Host = $GLOBALS['PHPMAILER-smtpHost'];
+		$mail->Port = $GLOBALS['PHPMAILER-smtpHostPort'];
+		$mail->SMTPSecure = $GLOBALS['PHPMAILER-smtpHostType'];
+		$mail->SMTPAuth = $GLOBALS['PHPMAILER-smtpHostAuth'];
+		$mail->Username = $GLOBALS['PHPMAILER-smtpHostUsername'];
+		$mail->Password = decrypt($GLOBALS['PHPMAILER-smtpHostPassword']);
+		$mail->setFrom($GLOBALS['PHPMAILER-smtpHostSenderEmail'], $GLOBALS['PHPMAILER-smtpHostSenderName']);
+		$mail->addReplyTo($GLOBALS['PHPMAILER-smtpHostSenderEmail'], $GLOBALS['PHPMAILER-smtpHostSenderName']);
+		$mail->isHTML(true);
+		if($to){ $mail->addAddress($to, $username); }
+		if($cc){ $mail->addCC($cc); }
+		if($bcc){
+			if(strpos($bcc , ',') === false){
+				$mail->addBCC($bcc);
+			}else{
+				$allEmails = explode(",",$bcc);
+				foreach($allEmails as $gotEmail){
+					$mail->addBCC($gotEmail);
+				}
+			}
+		}
+		$mail->Subject = $subject;
+		$mail->Body    = $body;
+		$mail->send();
+		//writeLog('success', 'Mail Function -  E-Mail Test Sent', $GLOBALS['organizrUser']['username']);
+		return true;
+	} catch (PHPMailer\PHPMailer\Exception $e) {
+		writeLog('error', 'Mail Function -  E-Mail Test Failed['.$mail->ErrorInfo.']', $GLOBALS['organizrUser']['username']);
+		return $e->errorMessage();
+	}
+	return false;
+}
 /* GET PHPMAILER SETTINGS */
 function phpmGetSettings(){
 	return array(
@@ -117,7 +200,7 @@ function phpmGetSettings(){
 				'placeholder' => 'i.e. same as username'
 			)
 		),
-		'Test & Domain' => array(
+		'Test & Options' => array(
 			array(
 				'type' => 'button',
 				'label' => 'Send Test',
@@ -129,34 +212,91 @@ function phpmGetSettings(){
 				'type' => 'input',
 				'name' => 'PHPMAILER-domain',
 				'label' => 'Domain Link Override',
-				'value' => $GLOBALS['PHPMAILER-domain']
+				'value' => $GLOBALS['PHPMAILER-domain'],
+				'placeholder' => 'https://domain.com/',
+			),
+			array(
+				'type' => 'select',
+				'name' => 'theme',
+				'label' => 'Theme',
+				'class' => 'themeChanger',
+				'value' => $GLOBALS['PHPMAILER-template'],
+				'options' => getTemplates()
+			),
+			array(
+				'type' => 'input',
+				'name' => 'PHPMAILER-logo',
+				'label' => 'WAN Logo URL',
+				'value' => $GLOBALS['PHPMAILER-logo'],
+				'placeholder' => 'Full URL',
 			),
 		),
 		'Templates' => array(
 			array(
 				'type' => 'accordion',
-				'label' => 'Choose Template',
+				'label' => 'Edit Template',
 				'id' => 'customEmailTemplates',
 				'override' => 12,
 				'options' => array(
 					array(
-						'id' => 'test-1',
-						'header' => 'test 1',
-						'body' => 'body here'
+						'id' => 'PHPMAILER-emailTemplateRegisterUserForm',
+						'header' => 'New Registration',
+						'body' => array(
+							array(
+								'type' => 'input',
+								'name' => 'PHPMAILER-emailTemplateRegisterUserSubject',
+								'smallLabel' => 'Subject',
+								'value' => $GLOBALS['PHPMAILER-emailTemplateRegisterUserSubject'],
+							),
+							array(
+								'type' => 'textbox',
+								'name' => 'PHPMAILER-emailTemplateRegisterUser',
+								'smallLabel' => 'Body',
+								'value' => $GLOBALS['PHPMAILER-emailTemplateRegisterUser'],
+								'attr' => 'rows="10"',
+							)
+						)
+					),
+					array(
+						'id' => 'PHPMAILER-emailTemplateResetPasswordForm',
+						'header' => 'Reset Password',
+						'body' => array(
+							array(
+								'type' => 'input',
+								'name' => 'PHPMAILER-emailTemplateResetPasswordSubject',
+								'smallLabel' => 'Subject',
+								'value' => $GLOBALS['PHPMAILER-emailTemplateResetPasswordSubject'],
+							),
+							array(
+								'type' => 'textbox',
+								'name' => 'PHPMAILER-emailTemplateResetPassword',
+								'smallLabel' => 'Body',
+								'value' => $GLOBALS['PHPMAILER-emailTemplateResetPassword'],
+								'attr' => 'rows="10"',
+							)
+						)
 					),
 					array(
-						'id' => 'test-2',
-						'header' => 'test 2',
+						'id' => 'PHPMAILER-emailTemplateInviteUserForm',
+						'header' => 'Invite User',
 						'body' => array(
-							'type' => 'input',
-							'name' => 'PHPMAILER-smtpHostSenderEmail',
-							'label' => 'Sender Email',
-							'value' => $GLOBALS['PHPMAILER-smtpHostSenderEmail'],
-							'placeholder' => 'i.e. same as username'
+							array(
+								'type' => 'input',
+								'name' => 'PHPMAILER-emailTemplateInviteUserSubject',
+								'smallLabel' => 'Subject',
+								'value' => $GLOBALS['PHPMAILER-emailTemplateInviteUserSubject'],
+							),
+							array(
+								'type' => 'textbox',
+								'name' => 'PHPMAILER-emailTemplateInviteUser',
+								'smallLabel' => 'Body',
+								'value' => $GLOBALS['PHPMAILER-emailTemplateInviteUser'],
+								'attr' => 'rows="10"',
+							)
 						)
 					),
 				)
 			)
-		),
+		)
 	);
 }

+ 4 - 1
css/themes/Organizr.css

@@ -323,8 +323,11 @@ a.mytooltip {
   vertical-align: middle;
   /*border-top: transparent;*/
 }
+.btn-default, .chat-list .chat-text h4, .dropdown-menu>li>a, .dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover, .flot-text, .footer, .form-control, .h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, .help-block, .input-group-addon, .text-muted, a.list-group-item:focus, a.list-group-item:hover, button.list-group-item:focus, button.list-group-item:hover, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small, tbody, th {
+    color: #ffffff;
+}
 .bootstrap-tagsinput, .calendar-widget, .chat-main-box, .content-wrap, .css-bar:after, .customtab li.active a, .customtab li.active a:focus, .customtab li.active a:hover, .daterangepicker .input-mini, .dropify-wrapper, .dropify-wrapper .dropify-preview, .dropzone, .footer, .form-control, .jsgrid-alt-row>td, .jsgrid-header-row>th, .jsgrid-row>td, .list-group-item, .list-group-item.disabled, .list-group-item.disabled:focus, .list-group-item.disabled:hover, .manage-table, .modal-content, .myadmin-dd .dd-list .dd-item .dd-handle, .myadmin-dd-empty .dd-list .dd3-content, .myadmin-dd-empty .dd-list .dd3-handle, .nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover, .pager li>a, .pager li>span, .pagination>li>a, .pagination>li>span, .panel, .panel .panel-footer, .panel-default .panel-body, .panel-default .panel-footer, .panel-default .panel-heading, .panel-footer textarea, .panel-white .panel-body, .panel-white .panel-footer, .panel-white .panel-heading, .radio label::before, .select2-container-multi .select2-choices, .table tbody tr.advance-table-row td, .thumbnail, .well, .white-box, input, pre, select, table.dataTable.display tbody tr.odd, table.dataTable.stripe tbody tr.odd {
-    background: #1f1f1f;
+    background: #1b1a1a;
 }
 .jq-icon-info { background-color: rgba(71, 68, 68, 0.93); color: #FFF; border-color: #bce8f1; }
 .jq-icon-warning { background-color: rgba(154, 83, 20, 0.93); color: #fcf8e3; border-color: #faebcc; }

+ 26 - 13
js/functions.js

@@ -193,7 +193,7 @@ function noTabs(arrayItems){
 			console.error("Organizr Function: API Connection Failed");
 		});
 	}else {
-		buildLogin();
+		$('.show-login').trigger('click');
 	}
 }
 function logout(){
@@ -534,15 +534,27 @@ function selectOptions(options, active){
 	return selectOptions;
 }
 function accordionOptions(options, parentID){
-	console.log(options);
+	//console.log(options);
 	var accordionOptions = '';
 	$.each(options, function(i,v) {
 		var id = v.id;
 		var extraClass = (v.class) ? ' '+v.class : '';
 		var header = (v.header) ? ' '+v.header : '';
 		if(typeof v.body == 'object'){
-			console.log(v.body);
-			var body = buildFormItem(v.body);
+
+			console.log(v.body.length);
+			if(typeof v.body.length == 'undefined'){
+				var body = buildFormItem(v.body);
+				console.log('single');
+
+			}else{
+				var body = '';
+				console.log('multiple');
+				$.each(v.body, function(int,val) {
+					body += buildFormItem(val);
+				});
+			}
+
 		}else{
 			var body = v.body;
 		}
@@ -550,7 +562,7 @@ function accordionOptions(options, parentID){
 		accordionOptions += `
 		<div class="panel">
 			<div class="panel-heading" id="`+id+`-heading" role="tab">
-				<a class="panel-title collapsed" data-toggle="collapse" href="#`+id+`-collapse" data-parent="#`+parentID+`" aria-expanded="false" aria-controls="`+id+`-collapse">`+header+`</a>
+				<a class="panel-title collapsed" data-toggle="collapse" href="#`+id+`-collapse" data-parent="#`+parentID+`" aria-expanded="false" aria-controls="`+id+`-collapse"><span lang="en">`+header+`</span></a>
 			</div>
 			<div class="panel-collapse collapse" id="`+id+`-collapse" aria-labelledby="`+id+`-heading" role="tabpanel" aria-expanded="false" style="height: 0px;">
 				<div class="panel-body">`+body+`</div>
@@ -573,36 +585,37 @@ function buildFormItem(item){
 	var attr = (item.attr) ? ' '+item.attr : '';
 	var disabled = (item.disabled) ? ' disabled' : '';
 	var href = (item.href) ? ' href="'+item.href+'"' : '';
+	var smallLabel = (item.smallLabel) ? '<label langl="en">'+item.smallLabel+'</label>' : '';
 	//+tof(item.value,'c')+`
 	switch (item.type) {
 		case 'input':
 		case 'text':
-			return '<input data-changed="false" lang=en" type="text" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" />';
+			return smallLabel+'<input data-changed="false" lang=en" type="text" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" />';
 			break;
 		case 'textbox':
-			return '<textarea data-changed="false" class="form-control'+extraClass+'"'+placeholder+id+name+disabled+type+attr+' autocomplete="new-password">'+textarea+'</textarea>';
+			return smallLabel+'<textarea data-changed="false" class="form-control'+extraClass+'"'+placeholder+id+name+disabled+type+attr+' autocomplete="new-password">'+textarea+'</textarea>';
 			break;
 		case 'password':
-			return '<input data-changed="false" lang=en" type="password" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" />';
+			return smallLabel+'<input data-changed="false" lang=en" type="password" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" />';
 			break;
 		case 'password-alt':
-			return '<div class="input-group m-b-30"><input data-changed="false" lang=en" type="password" class="password-alt form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" /><span class="input-group-btn"> <button class="btn btn-default showPassword" type="button"><i class="fa fa-eye passwordToggle"></i></button></span></div>';
+			return smallLabel+'<div class="input-group m-b-30"><input data-changed="false" lang=en" type="password" class="password-alt form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' autocomplete="new-password" /><span class="input-group-btn"> <button class="btn btn-default showPassword" type="button"><i class="fa fa-eye passwordToggle"></i></button></span></div>';
 			break;
 		case 'hidden':
 			return '<input data-changed="false" lang=en" type="hidden" class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' />';
 			break;
 		case 'select':
-			return '<select class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+'>'+selectOptions(item.options, item.value)+'</select>';
+			return smallLabel+'<select class="form-control'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+'>'+selectOptions(item.options, item.value)+'</select>';
 			break;
 		case 'select2':
-			return '<select class="select2 m-b-10 select2-multiple'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' multiple="multiple" data-placeholder="Choose">'+selectOptions(item.options, item.value)+'</select>';
+			return smallLabel+'<select class="select2 m-b-10 select2-multiple'+extraClass+'"'+placeholder+value+id+name+disabled+type+attr+' multiple="multiple" data-placeholder="Choose">'+selectOptions(item.options, item.value)+'</select>';
 			break;
 		case 'switch':
 		case 'checkbox':
-			return '<input data-changed="false" type="checkbox" class="js-switch'+extraClass+'" data-size="small" data-color="#99d683" data-secondary-color="#f96262"'+name+value+tof(item.value,'c')+id+disabled+type+attr+' /><input data-changed="false" type="hidden"'+name+'value="false">';
+			return smallLabel+'<input data-changed="false" type="checkbox" class="js-switch'+extraClass+'" data-size="small" data-color="#99d683" data-secondary-color="#f96262"'+name+value+tof(item.value,'c')+id+disabled+type+attr+' /><input data-changed="false" type="hidden"'+name+'value="false">';
 			break;
 		case 'button':
-			return '<button class="btn btn-sm btn-success btn-rounded waves-effect waves-light b-none'+extraClass+'" '+href+attr+'type="button"><span class="btn-label"><i class="'+icon+'"></i></span><span lang="en">'+text+'</span></button>';
+			return smallLabel+'<button class="btn btn-sm btn-success btn-rounded waves-effect waves-light b-none'+extraClass+'" '+href+attr+'type="button"><span class="btn-label"><i class="'+icon+'"></i></span><span lang="en">'+text+'</span></button>';
 			break;
 		case 'blank':
 			return '';