From 4b78946f603cb530652c9fac755c7c190e3dee68 Mon Sep 17 00:00:00 2001
From: Cameron <e107inc@gmail.com>
Date: Fri, 24 Oct 2014 13:10:20 -0700
Subject: [PATCH] Fixes #795 Sitebutton path error in emails. Use
 {SITEBUTTON=email} if you have a custom email template.

---
 e107_core/templates/email_template.php |  8 ++++----
 e107_plugins/siteinfo/e_shortcode.php  | 22 +++++++++++++++++++---
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php
index 67a563fa4..ab7192b68 100644
--- a/e107_core/templates/email_template.php
+++ b/e107_core/templates/email_template.php
@@ -172,8 +172,8 @@ $EMAIL_TEMPLATE['default']['header']		= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHT
 												<style type='text/css'>
 													body { padding:10px; background-color: #E1E1E1 } 
 													 div#body { padding:10px; width: 800px; background-color: #FFFFFF; border-radius: 5px; font-family: helvetica,arial }
-													.video-thumbnail { max-width: 100% }
-													
+													.video-thumbnail { max-width: 400px }
+													.media img { max-width:600px }
 												</style>
 												</head>
 												
@@ -181,7 +181,7 @@ $EMAIL_TEMPLATE['default']['header']		= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHT
 												<div id='body'>
 												";
 
-$EMAIL_TEMPLATE['default']['body']			= "{BODY}";											
+$EMAIL_TEMPLATE['default']['body']			= "{BODY}<br />{MEDIA1}{MEDIA2}{MEDIA3}{MEDIA4}{MEDIA5}";											
 
 $EMAIL_TEMPLATE['default']['footer']		= "<br /><br />
 												{SITENAME=link}
@@ -226,7 +226,7 @@ $EMAIL_TEMPLATE['signup']['body'] 			= "
 												{SITENAME=link}<br />
 												{SITEURL}
 											
-												<br /><br />".($includeSiteButton ? "<a href='".SITEURL."' title=''>{SITEBUTTON}</a>" : '')."
+												<br /><br />{SITEBUTTON=email}
 												</div>
 												
 												";
diff --git a/e107_plugins/siteinfo/e_shortcode.php b/e107_plugins/siteinfo/e_shortcode.php
index 312621e7e..408be73f1 100644
--- a/e107_plugins/siteinfo/e_shortcode.php
+++ b/e107_plugins/siteinfo/e_shortcode.php
@@ -8,11 +8,27 @@ if (!defined('e107_INIT')) { exit; }
 
 class siteinfo_shortcodes // must match the folder name of the plugin. 
 {
-	function sc_sitebutton()
+	function sc_sitebutton($parm='')
 	{
-		$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? e107::getParser()->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON);
+		
+		if($_POST['sitebutton'] && $_POST['ajax_used'])
+		{
+			$path = e107::getParser()->replaceConstants($_POST['sitebutton']);
+		}
+		else 
+		{
+			$path = (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON);
+		}
+		
+		if($parm == 'email')
+		{
+			$path = e107::getConfig()->get('sitebutton');
+		}
 		//TODO use CSS class?
-		return '<a href="'.SITEURL.'"><img src="'.$path.'" alt="'.SITENAME.'" /></a>';
+		if(!empty($path))
+		{
+			return '<a href="'.SITEURL.'"><img src="'.$path.'" alt="'.SITENAME.'" /></a>';
+		}
 	}
 
 	function sc_sitedisclaimer()